sebastienros / esprima-dotnet

Esprima .NET (BSD license) is a .NET port of the esprima.org project. It is a standard-compliant ECMAScript parser (also popularly known as JavaScript).
BSD 3-Clause "New" or "Revised" License
425 stars 75 forks source link

Wrong handling of private Identifierers #354

Closed jogibear9988 closed 1 year ago

jogibear9988 commented 1 year ago

Try this:

    class aa {
        #aa = true;
    }

We do not create an instance of PrivateIdentifier. We create a normal node with "#" in the value

lahma commented 1 year ago

This should now be covered too.

adams85 commented 1 year ago

Unfortunately, not completely. Static private property and method declarations like

class X {
  static #privateField = 'super';
  static #getPrivateField() {
    return X.#privateField;
  }
}

are still parsed incorrectly as Identifiers. (Interestingly, static private getters/setters are handled correctly. Non-static private declarations are ok as well.)

jogibear9988 commented 1 year ago

fixed in my pull, missed one parameter