Skip to content

Commit 90b51c0

Browse files
committed
fix original fix haha
1 parent c6df31d commit 90b51c0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/index.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@ describe('parser', () => {
2323

2424
expect(expressions).toContain('super(1)');
2525
});
26+
27+
it('should allow super alone as expression', () => {
28+
const tree = parse(`
29+
class B extends A {
30+
public B() {
31+
super;
32+
}
33+
}
34+
`);
35+
36+
const expressions = [];
37+
walk({ enterExpression: (c) => expressions.push(c.text) }, tree);
38+
39+
expect(expressions).toContain('super');
40+
});
2641
});
2742

2843
describe('usage example', () => {

src/parser/JavaParser.g4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ expression
475475
)
476476
| expression '[' expression ']'
477477
| methodCall
478+
| SUPER superSuffix
478479
| NEW creator
479480
| '(' typeType ')' expression
480481
| expression postfix=('++' | '--')
@@ -524,7 +525,7 @@ lambdaBody
524525
primary
525526
: '(' expression ')'
526527
| THIS
527-
| SUPER superSuffix
528+
| SUPER
528529
| literal
529530
| IDENTIFIER
530531
| typeTypeOrVoid '.' CLASS

0 commit comments

Comments
 (0)