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

Terser crashes on class property named get #1078

Closed
TimvdLippe opened this issue Sep 29, 2021 · 6 comments
Closed

Terser crashes on class property named get #1078

TimvdLippe opened this issue Sep 29, 2021 · 6 comments
Labels
bug parser Issue in the parse step

Comments

@TimvdLippe
Copy link

Bug report or Feature request?

Bug

Version (complete output of terser -V or specific git commit)
5.9.0
Complete CLI command or minify() options used

{
  module: true,
  compress: {},
  mangle: {},
  output: {},
  parse: {},
  rename: {},
}

terser input

class Bug {
  get;
}

terser output or error

Unexpected token: punc (;)

Expected result

class Bug {get;}
@jridgewell jridgewell added the parser Issue in the parse step label Sep 29, 2021
@fabiosantoscode
Copy link
Collaborator

Thanks for reporting! This was an easy fix

@jridgewell
Copy link
Collaborator

Reopening. I believe this can still fail if you're using semicolon-less ASI:

class Foo {
  get
  prop = 1;
}

@jridgewell jridgewell reopened this Oct 5, 2021
@fabiosantoscode
Copy link
Collaborator

Thanks @jridgewell!

@TimvdLippe
Copy link
Author

@jridgewell If I execute that code snippet in the console, I get `Uncaught SyntaxError: Unexpected token '='``. So I am not sure if ASI works with private class fields?

@jridgewell
Copy link
Collaborator

Ha, ASI doesn't apply because it tries to make a getter method (which then fails). Thanks!

@fabiosantoscode
Copy link
Collaborator

ASI is so weird :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug parser Issue in the parse step
Projects
None yet
Development

No branches or pull requests

3 participants