Re: An Arrow Parsing Edge Case

2014-03-21 Thread Jason Orendorff
`yield` is a keyword inside `function*` whether you're in strict or
non-strict code.

So that is a syntax error.

-j

On Thu, Mar 20, 2014 at 4:37 PM, Kevin Smith zenpars...@gmail.com wrote:
 Given the following edge case contained in non-strict code:

 function* g() { (yield) = null }

 Is this a syntax error, or not?

 The sequence `(yield)` will successfully parse as a parenthesized
 expression.  If we re-parse as an arrow parameter list, do we view the
 lexical token stream as containing a yield keyword, or an identifier whose
 value is yield?


 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: An Arrow Parsing Edge Case

2014-03-21 Thread Kevin Smith
 `yield` is a keyword inside `function*` whether you're in strict or
 non-strict code.


 Right, but not within the body of nested arrow functions:

function* g() { () = { var yield; } }

IIUC, this would parse fine.  So I'm asking whether a yield in the token
stream for an arrow parameter list should be interpreted as a keyword or an
identifier when we do the rewind/transform dance.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: An Arrow Parsing Edge Case

2014-03-21 Thread Allen Wirfs-Brock
On Mar 21, 2014, at 7:14 AM, Kevin Smith wrote:

 
 `yield` is a keyword inside `function*` whether you're in strict or
 non-strict code.
 
  Right, but not within the body of nested arrow functions:
 
 function* g() { () = { var yield; } }
 
 IIUC, this would parse fine.  So I'm asking whether a yield in the token 
 stream for an arrow parameter list should be interpreted as a keyword or an 
 identifier when we do the rewind/transform dance.

See bug https://bugs.ecmascript.org/show_bug.cgi?id=2504 

My current spec draft disallows 'yield' as a arrow function parameter when the 
arrow function is directly within a generator function.

Allen

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


An Arrow Parsing Edge Case

2014-03-20 Thread Kevin Smith
Given the following edge case contained in non-strict code:

function* g() { (yield) = null }

Is this a syntax error, or not?

The sequence `(yield)` will successfully parse as a parenthesized
expression.  If we re-parse as an arrow parameter list, do we view the
 lexical token stream as containing a yield keyword, or an identifier
whose value is yield?
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss