jquery / esprima

ECMAScript parsing infrastructure for multipurpose analysis
http://esprima.org
BSD 2-Clause "Simplified" License
7.04k stars 786 forks source link

Static property fails to parse #2111

Open OndrejSpanel opened 2 years ago

OndrejSpanel commented 2 years ago

Steps to reproduce

Parse following code:

class ClassWithStaticMethod {
  static staticProperty = 'someValue';
}

The code fails to parse, this can be reproduced using https://esprima.org/demo/parse.html

Actual output

The error is:

Error: Line 2: Unexpected token =

Relevant references

The code is extracted from example https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static

jogibear9988 commented 2 years ago

should work in esprima-next: https://github.com/node-projects/esprima-next