tenderlove/rkelly — pull request #36 by scottrobertwhittaker (2014-10-22 02:15:59+00:00)
Title: Fix inadvertent automatic semicolon insertion

This patch fixes a bug in RKelly's automatic semicolon insertion logic: though the ECMAScript standard specifies that automatic semicolon insertion never takes place within the header of a `for` loop, this valid code would fail to parse:

for(a;
b;
++c) { /* ... */ }

...because RKelly erroneously attempts to insert a semicolon after `b`, which would be a valid insertion anywhere outside the header of a `for` loop.

To fix this, this modifies `RKelly::Parser` to explicitly track when we're inside the loop header, including any nested parenthetical sub-expressions, so it won't attempt to insert a semicolon.

(CCing @nene for rkelly-remix, too.)