Grammar question about ArrowFormalParameters

Cyrus Najmabadi cyrusn at microsoft.com
Wed Nov 12 16:46:02 PST 2014


Hey ES6ers,

I'm currently implementing some of the ES6 support for the next version of TypeScript.  The part I'm looking at right now is generators and yield expressions.  So far we feel fairly comfortable with the grammar and understand the implications of the [Yield] and [GeneratorParameter].  One spec issue that is getting us to scratch our heads though is this section:

When the production
ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]

is recognized the following grammar is used to refine the interpretation of
CoverParenthesizedExpressionAndArrowParameterList:

ArrowFormalParameters[Yield, GeneratorParameter] :
    ( StrictFormalParameters[?Yield, ?GeneratorParameter] )

The issue relates to the [GeneratorParamater] parameter on ArrowFormalParameters.  We can't see any path through the grammar that could ever end up enabling this parameter.  While CoverParenthesizedExpressionAndArrowParameterList picks up the 'yield' parameter from ArrowParameters, there seems to be nothing related to 'GeneratorParameter'.

We also find the presence of this grammar parameter here to be somewhat odd as arrow function can't be generators.

Is this an issue with the spec?  Or is there some subtlety here that we've missed that enables this parameter?

Thanks!

            -- Cyrus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141113/e4f3b8e5/attachment.html>


More information about the es-discuss mailing list