aboutsummaryrefslogtreecommitdiff
path: root/lib/parse.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parse.js')
-rw-r--r--lib/parse.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/parse.js b/lib/parse.js
index 69c14e4a..82717d26 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -753,7 +753,7 @@ function parse($TEXT, options) {
}
}
- var statement = embed_tokens(function(strict_defun) {
+ var statement = embed_tokens(function() {
handle_regexp();
switch (S.token.type) {
case "string":
@@ -844,9 +844,6 @@ function parse($TEXT, options) {
return for_();
case "function":
- if (!strict_defun && S.input.has_directive("use strict")) {
- croak("In strict mode code, functions can only be declared at top level or immediately within another function.");
- }
next();
return function_(AST_Defun);
@@ -1038,7 +1035,7 @@ function parse($TEXT, options) {
S.input.push_directives_stack();
S.in_loop = 0;
S.labels = [];
- var body = block_(true);
+ var body = block_();
if (S.input.has_directive("use strict")) {
if (name) strict_verify_symbol(name);
argnames.forEach(strict_verify_symbol);
@@ -1067,12 +1064,12 @@ function parse($TEXT, options) {
});
}
- function block_(strict_defun) {
+ function block_() {
expect("{");
var a = [];
while (!is("punc", "}")) {
if (is("eof")) expect_token("punc", "}");
- a.push(statement(strict_defun));
+ a.push(statement());
}
next();
return a;
@@ -1616,7 +1613,7 @@ function parse($TEXT, options) {
var body = [];
S.input.push_directives_stack();
while (!is("eof"))
- body.push(statement(true));
+ body.push(statement());
S.input.pop_directives_stack();
var end = prev();
var toplevel = options.toplevel;