Skip to content

Commit

Permalink
Fix regression on static methods with keyword names
Browse files Browse the repository at this point in the history
Closes #1027
  • Loading branch information
marijnh committed Apr 24, 2021
1 parent f4a38f0 commit db13859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion acorn/src/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ pp.isClassElementNameStart = function() {
this.type === tt.privateId ||
this.type === tt.num ||
this.type === tt.string ||
this.type === tt.bracketL
this.type === tt.bracketL ||
this.type.keyword
)
}

Expand Down
1 change: 1 addition & 0 deletions test/tests-class-features-2022.js
Original file line number Diff line number Diff line change
Expand Up @@ -3848,3 +3848,4 @@ testFail("function F() { obj.#aaa }", "Private field '#aaa' must be declared in
test("class Outer { #outer; Inner = class { #inner; f(obj) { obj.#outer + this.#inner } }; }", {}, {ecmaVersion: 13})
test("class Outer { Inner = class { f(obj) { obj.#outer + this.#inner } #inner; }; #outer; }", {}, {ecmaVersion: 13})
testFail("class Outer { Inner = class { f(obj) { obj.#nonexist } #inner; }; #outer; }", "Private field '#nonexist' must be declared in an enclosing class (1:43)", {ecmaVersion: 13})
test("class C { static delete() {} }", {}, {ecmaVersion: 13})

0 comments on commit db13859

Please sign in to comment.