[estree] Add SuperExpression.
(we're almost there)
This commit is contained in:
parent
876e774bfe
commit
024a98431d
5
acorn.js
5
acorn.js
@ -2315,6 +2315,11 @@
|
||||
if (this.inGenerator) unexpected();
|
||||
|
||||
case tt.name:
|
||||
if (this.value === "super") {
|
||||
var node = this.startNode();
|
||||
this.next();
|
||||
return this.finishNode(node, "SuperExpression");
|
||||
}
|
||||
var start = this.currentPos();
|
||||
var id = this.parseIdent(this.type !== tt.name);
|
||||
if (!this.canInsertSemicolon() && this.eat(tt.arrow)) {
|
||||
|
||||
@ -699,6 +699,11 @@
|
||||
return this.finishNode(node, "ThisExpression");
|
||||
|
||||
case tt.name:
|
||||
if (this.tok.value === "super") {
|
||||
var node = this.startNode();
|
||||
this.next();
|
||||
return this.finishNode(node, "SuperExpression");
|
||||
}
|
||||
var start = this.storeCurrentPos();
|
||||
var id = this.parseIdent();
|
||||
return this.eat(tt.arrow) ? this.parseArrowExpression(this.startNodeAt(start), [id]) : id;
|
||||
|
||||
@ -7391,8 +7391,7 @@ test("\"use strict\"; (class A {constructor() { super() }})", {
|
||||
expression: {
|
||||
type: "CallExpression",
|
||||
callee: {
|
||||
type: "Identifier",
|
||||
name: "super",
|
||||
type: "SuperExpression",
|
||||
loc: {
|
||||
start: {line: 1, column: 40},
|
||||
end: {line: 1, column: 45}
|
||||
@ -7723,8 +7722,7 @@ test("\"use strict\"; (class A { static constructor() { super() }})", {
|
||||
expression: {
|
||||
type: "CallExpression",
|
||||
callee: {
|
||||
type: "Identifier",
|
||||
name: "super",
|
||||
type: "SuperExpression",
|
||||
loc: {
|
||||
start: {line: 1, column: 48},
|
||||
end: {line: 1, column: 53}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user