diff options
Diffstat (limited to 'lib/parse.js')
-rw-r--r-- | lib/parse.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/parse.js b/lib/parse.js index d6893253..416c363a 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -748,7 +748,7 @@ function parse($TEXT, exigent_mode) { function parenthesised() { expect("("); - var exp = expression(true); + var exp = expression(); expect(")"); return exp; }; @@ -756,7 +756,7 @@ function parse($TEXT, exigent_mode) { function embed_tokens(parser) { return function() { var start = S.token; - var expr = parser(); + var expr = parser.apply(this, arguments); var end = prev(); expr.start = start; expr.end = end; @@ -933,9 +933,9 @@ function parse($TEXT, exigent_mode) { function regular_for(init) { expect(";"); - var test = is("punc", ";") ? null : expression(true); + var test = is("punc", ";") ? null : expression(); expect(";"); - var step = is("punc", ")") ? null : expression(true); + var step = is("punc", ")") ? null : expression(); expect(")"); return new AST_For({ init : init, @@ -947,7 +947,7 @@ function parse($TEXT, exigent_mode) { function for_in(init) { var lhs = init instanceof AST_Var ? init.definitions[0].name : null; - var obj = expression(true); + var obj = expression(); expect(")"); return new AST_ForIn({ init : init, @@ -957,20 +957,6 @@ function parse($TEXT, exigent_mode) { }); }; - var function_body = embed_tokens(function(){ - ++S.in_function; - var loop = S.in_loop; - var labels = S.labels; - S.in_directives = true; - S.in_loop = 0; - S.labels = []; - var a = block_(true); - --S.in_function; - S.in_loop = loop; - S.labels = labels; - return a; - }); - var function_ = function(in_statement) { var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun @@ -989,7 +975,19 @@ function parse($TEXT, exigent_mode) { next(); return a; })(true, []), - body: function_body() + body: embed_tokens(function(){ + ++S.in_function; + var loop = S.in_loop; + var labels = S.labels; + S.in_directives = true; + S.in_loop = 0; + S.labels = []; + var a = block_(true); + --S.in_function; + S.in_loop = loop; + S.labels = labels; + return a; + })() }); }; @@ -1034,7 +1032,7 @@ function parse($TEXT, exigent_mode) { cur = []; branch = new AST_Case({ start : prog1(S.token, next), - expression : expression(true), + expression : expression(), body : cur }); a.push(branch); @@ -1189,7 +1187,7 @@ function parse($TEXT, exigent_mode) { switch (start.value) { case "(": next(); - var ex = expression(true); + var ex = expression(); ex.start = start; ex.end = S.token; expect(")"); @@ -1333,7 +1331,7 @@ function parse($TEXT, exigent_mode) { } if (is("punc", "[")) { next(); - var prop = expression(true); + var prop = expression(); expect("]"); return subscripts(new AST_Sub({ start : start, @@ -1453,6 +1451,8 @@ function parse($TEXT, exigent_mode) { }; var expression = function(commas, no_in) { + if (arguments.length == 0) + commas = true; var start = S.token; var expr = maybe_assign(no_in); if (commas && is("punc", ",")) { |