Skip to content

Commit ece6a66

Browse files
committed
work on #28
1 parent a609124 commit ece6a66

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3612,7 +3612,7 @@ export class Parser {
36123612
key = this.parseObjectPropertyKey(isPrivate);
36133613
value = this.parseGeneratorMethod(isAsync);
36143614
method = true;
3615-
} else if (token.type === Token.Punctuator && token.value === '[') {
3615+
} else if (token.type === Token.Punctuator && token.value === '[' && !this.match('(')) {
36163616
kind = 'property';
36173617
computed = true;
36183618

test/esprima-next.issue.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ test('esprima-next - #28 - simple ; ', () => {
6565
expect(ast).not.toBeNull();
6666
});
6767

68+
test('esprima-next - #28 - simple 2; ', () => {
69+
let code = `
70+
class A {static ["prototype"](){}}`;
71+
let ast = parseModule(code);
72+
expect(ast).not.toBeNull();
73+
});
74+
6875
test('esprima-next - #28 - Unexpected token ; ', () => {
6976
let code = `
7077
class ComputedRefImpl {

0 commit comments

Comments
 (0)