Skip to content

Disallow super inside base classes#9316

Closed
nicolo-ribaudo wants to merge 1 commit intobabel:masterfrom
nicolo-ribaudo:parser-super-base-class
Closed

Disallow super inside base classes#9316
nicolo-ribaudo wants to merge 1 commit intobabel:masterfrom
nicolo-ribaudo:parser-super-base-class

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

Q                       A
Fixed Issues?
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@nicolo-ribaudo nicolo-ribaudo added PR: Spec Compliance 👓 A type of pull request used for our changelog categories pkg: parser Spec: Classes labels Jan 11, 2019
inDerived: boolean,
) {
const oldInDerivedClass = this.state.inDerivedClass;
this.state.inDerivedClass = inDerived;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All this things would be a nice usecase for a decorator, if we want to experiment with it. Probably it could even be removed at compile time to generate the current code, so that we avoid the runtime overhead.

class Parser {
  // ...

  @saveState("inDerivedClass")
  pushClassPrivateProperty(
    classBody: N.ClassBody,
    prop: N.ClassPrivateProperty,
    inDerived: boolean,
  ) {
    this.state.inDerivedClass = inDerived;
    this.expectPlugin("classPrivateProperties", prop.key.start);
    classBody.body.push(this.parseClassPrivateProperty(prop));
  }

  // ...
}

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Jan 11, 2019

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9782/

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9765/

@nicolo-ribaudo nicolo-ribaudo force-pushed the parser-super-base-class branch from 4dd0f4d to 29b1625 Compare January 12, 2019 00:13
@nicolo-ribaudo nicolo-ribaudo force-pushed the parser-super-base-class branch from 29b1625 to 3ff6e21 Compare January 13, 2019 23:05
@nicolo-ribaudo
Copy link
Copy Markdown
Member Author

Replaced by #9493

@nicolo-ribaudo nicolo-ribaudo deleted the parser-super-base-class branch February 11, 2019 16:27
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: Spec Compliance 👓 A type of pull request used for our changelog categories Spec: Classes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants