fix new keyword broken by recent refactoring (#9377)

This commit is contained in:
Daniel Tschinder 2019-01-21 22:25:37 -08:00 committed by GitHub
parent f6ee26c3da
commit af88e63dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 156 additions and 1 deletions

View File

@ -184,7 +184,7 @@ export const keywords = Object.create(null, {
const: makeKeywordProps("const"), const: makeKeywordProps("const"),
while: makeKeywordProps("while", { isLoop }), while: makeKeywordProps("while", { isLoop }),
with: makeKeywordProps("with"), with: makeKeywordProps("with"),
new: makeKeywordProps("new"), new: makeKeywordProps("new", { beforeExpr, startsExpr }),
this: makeKeywordProps("this", { startsExpr }), this: makeKeywordProps("this", { startsExpr }),
super: makeKeywordProps("super", { startsExpr }), super: makeKeywordProps("super", { startsExpr }),
class: makeKeywordProps("class", { startsExpr }), class: makeKeywordProps("class", { startsExpr }),

View File

@ -0,0 +1,3 @@
function* test() {
yield new Foo();
}

View File

@ -0,0 +1,152 @@
{
"type": "File",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 14,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 14
},
"identifierName": "test"
},
"name": "test"
},
"generator": true,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 17,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 21,
"end": 37,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 18
}
},
"expression": {
"type": "YieldExpression",
"start": 21,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 17
}
},
"delegate": false,
"argument": {
"type": "NewExpression",
"start": 27,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 17
}
},
"callee": {
"type": "Identifier",
"start": 31,
"end": 34,
"loc": {
"start": {
"line": 2,
"column": 12
},
"end": {
"line": 2,
"column": 15
},
"identifierName": "Foo"
},
"name": "Foo"
},
"arguments": []
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}