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

Parse error when "super" is used #9

Closed
lukastaegert opened this issue Apr 18, 2020 · 7 comments
Closed

Parse error when "super" is used #9

lukastaegert opened this issue Apr 18, 2020 · 7 comments

Comments

@lukastaegert
Copy link

Originally via rollup/rollup#3505, which bundles this plugin at the moment:

It is not possible to use super in class properties even though it probably should, at least according to https://2ality.com/2019/07/public-class-fields.html#the-scope-of-field-initializers (I know this is not official documentation...)

At the moment the following throws with a SyntaxError: 'super' keyword outside a method:

require('acorn')
  .Parser.extend(require('acorn-class-fields'), require('acorn-static-class-features'))
  .parse('class SubClass extends SuperClass { prop = super.getValue(); }');
@lukastaegert
Copy link
Author

cc @guybedford Apparently I cannot create an issue in your fork

@pschroen
Copy link

I should add super works as expected in Chrome with the reference link example.

Tested with Version 81.0.4044.113.

@guybedford
Copy link
Contributor

Ok I've added a fix in guybedford@8a1fe76. Apparently I am now maintaining this :P No guarantees going forward.....

@adrianheine
Copy link
Member

Fixed in #8.

@guybedford
Copy link
Contributor

@adrianheine note that #8 was a different PR to the changes in guybedford@8a1fe76. If you would like me to turn that commit into a PR here I can do that though.

This issue should likely remain open until that is merged.

@adrianheine
Copy link
Member

No, you pushed 8a1fe76 to that branch and I merged it.

@guybedford
Copy link
Contributor

Ah great, I actually didn't even realise my fork branch and that PR branch were the same one.

Much appreciated for merging these fixes!

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

No branches or pull requests

4 participants