Change bargull-20110108-4LP by barg...@bargull02 on 2011-01-08 18:40:23
in /home/anba/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix grammar for "in" operator in lookahead

Bugs Fixed: LPP-6684 (Missing "var" in for-in loop)

Technical Reviewer: ptw
QA Reviewer: (pending)


Details:
JavaCC doesn't execute semantic actions while doing a lookahead, therefore setAllowIn() gets never called during lookahead. And because of that, getAllowIn() may not report the correct value during a semantic lookahead in the RelOP() production. Therefore I've added a couple of "xxxNoIn" productions instead of relying on semantic lookahead to determine when the "in" operator is allowed.

I've also changed ConditionalExpression() so it only allows AssignmentExpression() instead of Expression() in the first branch. Changing the 2nd branch to AssignmentExpression() instead of ConditionalExpression() caused some lookahead warnings, because AssignmentExpression() isn't compliant to ECMAScript. Changing AssignmentExpression() to make it ECMAScript compatible didn't work, because of more differences in CallExpression(), MemberExpression(), etc. At least the grammar doesn't anymore allow invalid code, it's now only a bit stricter than the standard. (Also see LPP-9571)

And added missing jjtAccept() methods for ASTModifiedDefinition and ASTFormalParameterList.


Tests:
test case from bug report compiles

Files:
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/Parser.jjt
M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/ASTModifiedDefinition.java M WEB-INF/lps/server/sc/src/org/openlaszlo/sc/parser/ASTFormalParameterList.java

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110108-4LP.tar

Reply via email to