Jason Orendorff wrote:
SpiderMonkey rewinds the token stream and re-parses.
I'm past the point of feeling sheepish about it, honestly. The code
would have to be super strange for us to rewind much (but yes, in the
worst case we can be O(n^2)). The rewinding code is fairly clean and
localized. It's also "obviously correct", as long as strict mode is
syntactically a subset of sloppy mode. This was true in ES5 and I
think it's true in ES6.
Doing it the other way effectively makes a third mode in the parser:
strict, non-strict, and "we don't know yet". That's the obnoxious bit.
Not hard to make it correct, perhaps; but impossible to make it
obviously correct.
Solid reasoning, nothing to feel sheepish about.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss