Skip to content

Commit

Permalink
Merge branch 'forLoopInExpression' of https://github.com/GregorR/narc…
Browse files Browse the repository at this point in the history
…issus into GregorR-forLoopInExpression
  • Loading branch information
Gregor Richards committed Apr 21, 2011
2 parents 3856781 + d813f43 commit e5c1fb4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/jsparse.js
Expand Up @@ -554,7 +554,8 @@ Narcissus.parser = (function() {
t.mustMatch(LEFT_PAREN);
x2 = x.pushTarget(n).nest();
x3 = x.update({ inForLoopInit: true });
if ((tt = t.peek()) !== SEMICOLON) {
n2 = null;
if ((tt = t.peek(true)) !== SEMICOLON) {
if (tt === VAR || tt === CONST) {
t.get();
n2 = Variables(t, x3);
Expand Down Expand Up @@ -599,15 +600,16 @@ Narcissus.parser = (function() {
n.iterator = n2;
}
} else {
x3.inForLoopInit = false;
n.setup = n2;
t.mustMatch(SEMICOLON);
if (n.isEach)
throw t.newSyntaxError("Invalid for each..in loop");
n.condition = (t.peek() === SEMICOLON)
n.condition = (t.peek(true) === SEMICOLON)
? null
: Expression(t, x3);
t.mustMatch(SEMICOLON);
tt2 = t.peek();
tt2 = t.peek(true);
n.update = (x.parenFreeMode
? tt2 === LEFT_CURLY || definitions.isStatementStartCode[tt2]
: tt2 === RIGHT_PAREN)
Expand Down

0 comments on commit e5c1fb4

Please sign in to comment.