Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 feature: Generator: Tracking Issue #1033

Closed
2 tasks
ariya opened this issue Feb 14, 2015 · 5 comments
Closed
2 tasks

ES6 feature: Generator: Tracking Issue #1033

ariya opened this issue Feb 14, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@ariya
Copy link
Contributor

ariya commented Feb 14, 2015

Syntax:

Per Rev 32 (Feb 2, 2015) of the draft spec, the relevant grammar is on Section 14.4 Generator Function Definitions:

GeneratorMethod[Yield] :
    * PropertyName[?Yield] ( StrictFormalParameters[Yield,GeneratorParameter] )  { GeneratorBody[Yield]  }

GeneratorDeclaration[Yield, Default] :
    function * BindingIdentifier[?Yield] ( FormalParameters[Yield, GeneratorParameter] ) { GeneratorBody[Yield] }
    [+Default] function * ( FormalParameters[Yield, GeneratorParameter] ) { GeneratorBody[Yield] }

GeneratorExpression :
    function * BindingIdentifier[Yield]opt ( FormalParameters[Yield,GeneratorParameter] ) { GeneratorBody[Yield] }

GeneratorBody[Yield] :
    FunctionBody[?Yield]

YieldExpression[In] :
    yield
    yield [no LineTerminator here] [Lexical goal InputElementRegExp] AssignmentExpression[?In, Yield]
    yield [no LineTerminator here] * [Lexical goal InputElementRegExp] AssignmentExpression[?In, Yield]

AssignmentExpression[In, Yield] :
    [+Yield] YieldExpression[?In]

Spec:

https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions

Relevant AST interfaces (from https://github.com/estree/estree):

Functions:

extend interface Function {
    defaults: [ Expression ];
    rest: Identifier | null;
    generator: boolean;
}
interface ArrowExpression <: Function, Expression {
    type: "ArrowExpression";
    params: [ Pattern ];
    defaults: [ Expression ];
    rest: Identifier | null;
    body: BlockStatement | Expression;
    generator: boolean;
    expression: boolean;
}

YieldExpression:

interface YieldExpression <: Expression {
    type: "YieldExpression";
    argument: Expression | null;
}

See also:

Remaining Tasks:

  • Review V8 error messages on generator early error
  • Ensure the proper handling of yield* (old issue 617)
@ariya ariya self-assigned this Feb 14, 2015
@ariya ariya added this to the 2.1 milestone Feb 14, 2015
@ariya ariya added es6 and removed es6migration labels Feb 18, 2015
@ariya
Copy link
Contributor Author

ariya commented Feb 18, 2015

@jeffmo Here's the generator tracking issue, in case you want to grab this.

@jeffmo
Copy link
Member

jeffmo commented Feb 19, 2015

David (@dhe128) mentioned he'd be interested in giving generator support a go -- so cc'ing him here for reference

@nzakas
Copy link
Contributor

nzakas commented Feb 19, 2015

Was ArrowExpression vs. ArrowFunctionExpression resolved?

@jeffmo
Copy link
Member

jeffmo commented Feb 19, 2015

Hmm, well there isn't such a thing as generator arrow functions in ES6...

@nzakas
Copy link
Contributor

nzakas commented Feb 19, 2015

Good point, my comment was based on the inclusion of ArrowExpression as part of the relevant AST information in the description. It seems like generator is still there so all nodes representing functions have the same properties?

@mikesherov mikesherov modified the milestones: 2.1, 2.2 Mar 4, 2015
@ariya ariya assigned jeffmo and unassigned ariya Mar 5, 2015
@mikesherov mikesherov mentioned this issue Mar 7, 2015
25 tasks
@mikesherov mikesherov changed the title ES6 feature: Generator ES6 feature: Generator: Tracking Issue Mar 7, 2015
ariya pushed a commit to ariya/esprima that referenced this issue May 13, 2015
ariya added a commit to ariya/esprima that referenced this issue May 13, 2015
ariya added a commit to ariya/esprima that referenced this issue May 13, 2015
ariya added a commit to ariya/esprima that referenced this issue May 13, 2015
Until V8 has a specific message of the illegal use of yield, we stick
with the generic one.

Refs jquery#1033
ariya added a commit to ariya/esprima that referenced this issue May 13, 2015
ariya added a commit to ariya/esprima that referenced this issue May 13, 2015
Until V8 has a specific message of the illegal use of yield, we stick
with the generic one.

Refs jquery#1033
@ariya ariya assigned ariya and unassigned jeffmo May 13, 2015
@ariya ariya added this to the 2.3 milestone Jun 3, 2015
@ariya ariya removed this from the 2.2 milestone Jun 3, 2015
ariya pushed a commit to ariya/esprima that referenced this issue Jun 3, 2015
ariya added a commit to ariya/esprima that referenced this issue Jun 3, 2015
ariya added a commit to ariya/esprima that referenced this issue Jun 3, 2015
ariya added a commit to ariya/esprima that referenced this issue Jun 3, 2015
ariya added a commit to ariya/esprima that referenced this issue Jun 3, 2015
Until V8 has a specific message of the illegal use of yield, we stick
with the generic one.

Refs jquery#1033
ariya added a commit to ariya/esprima that referenced this issue Jun 3, 2015
ariya added a commit that referenced this issue Jun 16, 2015
@ariya ariya closed this as completed Jul 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

4 participants