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: Rest Parameters: tracking Issue #1011

Closed
mikesherov opened this issue Feb 9, 2015 · 15 comments
Closed

ES6 feature: Rest Parameters: tracking Issue #1011

mikesherov opened this issue Feb 9, 2015 · 15 comments
Assignees
Labels
es6
Milestone

Comments

@mikesherov
Copy link
Member

@mikesherov mikesherov commented Feb 9, 2015

Syntax:

FormalParameterList[Yield,GeneratorParameter] :
  FunctionRestParameter[?Yield]
  FormalsList[?Yield, ?GeneratorParameter]
  FormalsList[?Yield, ?GeneratorParameter] , FunctionRestParameter[?Yield]
FunctionRestParameter[Yield] :
  BindingRestElement[?Yield]
BindingRestElement[Yield, GeneratorParameter] :
  [+GeneratorParameter] ... BindingIdentifier[Yield]
  [~GeneratorParameter] ... BindingIdentifier[?Yield]

Spec:

https://people.mozilla.org/~jorendorff/es6-draft.html#sec-functions-and-classes

Remaining Tasks:

  • Review and Test Token Generation
  • Review Error Messages
  • Arrow Function Rest Parameters
  • estree/estree#37
@mikesherov mikesherov mentioned this issue Feb 9, 2015
8 of 8 tasks complete
@mikesherov mikesherov modified the milestone: 2.1 Feb 12, 2015
@mikesherov mikesherov self-assigned this Feb 13, 2015
@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Feb 15, 2015

@ariya can you respond to the estree issue about rest and defaults? I think we may want to take acorns approach here.

@ariya
Copy link
Contributor

@ariya ariya commented Feb 15, 2015

@mikesherov I'm not sure why we want to deviate from the existing SpiderMonkey AST for this case.

mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 16, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit to mikesherov/esprima that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs jquery#1011
mikesherov added a commit that referenced this issue Feb 17, 2015
Still errors on rest parameters for arrow function expressions for now as those
are a bit more involved and require a more significant refactor.

Refs #1011
Closes gh-1050
@ariya ariya added es6 and removed es6migration labels Feb 18, 2015
@nzakas
Copy link
Contributor

@nzakas nzakas commented Mar 2, 2015

Just a heads up: I was doing some experimentation and found that there's no good way to support both the harmony branch rest property and the newly-agreed Acorn-like approach (having the rest param in the params array) at the same time. This is because code exists that loops over the params array and then checks to see if rest has a value. That means adding the rest param into the params array would result in double evaluation of a rest param.

So we can really only do one or the other but not both (as opposed to handler and handlers, for instance).

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 2, 2015

@nzakas no way to add a flag rather than doing a second loop?

@nzakas
Copy link
Contributor

@nzakas nzakas commented Mar 2, 2015

Sure, but that's still a breaking change. My point is that existing code will break if we support both at the same time. If we need a breaking change, might as well go all the way and remove rest.

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 2, 2015

@nzakas I see, you mean consumer code. I'm +1 for removing all the way.

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 2, 2015

@jeffmo ^ ?

@jeffmo
Copy link
Member

@jeffmo jeffmo commented Mar 2, 2015

Agreed, let's rip the band-aid off

@ariya
Copy link
Contributor

@ariya ariya commented Mar 2, 2015

Hmm, maybe I missed something, but when did I discuss keeping the compatibility? Rest parameter was not feature in 2.0 anyway.

@jeffmo
Copy link
Member

@jeffmo jeffmo commented Mar 2, 2015

@ariya : I think the breaking-change-ness is only in reference to a breaking change within the harmony branch

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 2, 2015

@ariya we sort of glossed over it in the meeting quickly. Glad we're all in agreement to just rip off the baindaid!

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 4, 2015

@nzakas, you have sample code for the switch to restElement?

@nzakas
Copy link
Contributor

@nzakas nzakas commented Mar 5, 2015

Assuming you mean consumer code that would be confused by having both, escope is a good example: https://github.com/estools/escope/blob/master/src/referencer.js#L221

ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit to ikarienator/esprima that referenced this issue Mar 5, 2015
ikarienator added a commit that referenced this issue Mar 5, 2015
Refs #1011
Refs #1012
Closes gh-1093
@ariya
Copy link
Contributor

@ariya ariya commented Mar 6, 2015

@mikesherov Anything here that is still blocking 2.1?

@mikesherov
Copy link
Member Author

@mikesherov mikesherov commented Mar 6, 2015

@ariya, yes, the switch from defaults/rest properties to resElement/AssigmentPattern

mikesherov added a commit to mikesherov/esprima that referenced this issue Mar 6, 2015
mikesherov added a commit to mikesherov/esprima that referenced this issue Mar 7, 2015
@mikesherov mikesherov closed this in ab6b44b Mar 7, 2015
@mikesherov mikesherov mentioned this issue Mar 7, 2015
25 of 25 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.