[estree] Add SuperExpression.

(we're almost there)
This commit is contained in:
Ingvar Stepanyan 2015-03-17 23:01:42 +02:00
parent 876e774bfe
commit 024a98431d
3 changed files with 12 additions and 4 deletions

View File

@ -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)) {

View File

@ -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;

View File

@ -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}