Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Initializer Containing arrow containing arguments #25

Closed
bakkot opened this issue Jul 21, 2017 · 3 comments
Closed

Initializer Containing arrow containing arguments #25

bakkot opened this issue Jul 21, 2017 · 3 comments

Comments

@bakkot
Copy link
Contributor

bakkot commented Jul 21, 2017

The rule which prevents initializers from referring to arguments uses Contains, which does not descend into arrow functions except for new.target, super, and this.

It should be an early error, I think. Including recursively - we should disallow

class A {
  a = b => c => { return arguments; };
}

Not entirely sure how to spec it though.

@bakkot
Copy link
Contributor Author

bakkot commented Jul 21, 2017

As a strawman, we could add a new algorithm ContainsArguments which descends into everything except FunctionDeclaration/Expression and ClassBody (taking advantage of chain productions to minimize the amount of spec text necessary). I'll try to spec that to see how it looks.

@bakkot
Copy link
Contributor Author

bakkot commented Jul 21, 2017

Also, strictly speaking, I don't think Contains can be used for something as specific as 'an IdentifierReference whose StringValue is "arguments".' It takes a terminal or nonterminal as an argument; I don't know if it can be used to look for nonterminals with specific properties.

@littledan
Copy link
Member

Thanks for following up here; this seems to be a continuation of https://github.com/tc39/proposal-class-public-fields/pull/41/files/d2faa6128850b575057f727075256d0b95d5322f#r72339498 . Sorry for dropping the ball on that issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants