On Nov 29, 2013, at 5:21 PM, Kevin Smith wrote:
>
> x => { "use strict"; with (x) {} } // Not a strict-mode error
>
> Spec bug if so -- that should make the arrow function so stated have strict
> code.
>
>
> That would probably be the expectation, and I'm possibly just missing
> something in the spec.
Or the spec. is incomplete...
I actually haven't updated the Directive Prologue section yet, from the ES5
text.
It would be appropriate to file bug reports at bugs.ecmascript.org whenever you
find something like this missing or even if it just isn't clear. I use such
bugs as todo items WRT improving the draft.
> It does add an extra degree of complexity, though. Consider this edge case:
>
> (x = function z(x) { delete x }) => { "use strict" }
>
> When we parse the invalid unary expression in function 'z', we don't even
> know that we're in a "maybe strict" context yet. It's only after we see the
> "=>" that we know. It's still doable without an AST walk though, I think.
And you don't know if the parens are delimiting a ParenthesisedExpression or an
ArrowParameterList until you do/don't see the =>
Jason suggests keeping the token stream and backing up. Another alternative is
remembering the source position of the start of the parameter list and
reparsing when the ambiguity and strictness is resolved. Whether text, token,
or AST based reprocessing is better is an implementation decision.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss