-
Notifications
You must be signed in to change notification settings - Fork 875
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17a73fc
commit 65a9137
Showing
8 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
if (typeof exports != "undefined") { | ||
var test = require("./driver.js").test | ||
var testFail = require("./driver.js").testFail | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
// await-top-level | ||
//------------------------------------------------------------------------------ | ||
|
||
testFail("await 1", "Unexpected token (1:6)", {ecmaVersion: 8}) | ||
test("await 1", { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 7, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start": 0, | ||
"end": 7, | ||
"expression": { | ||
"type": "AwaitExpression", | ||
"start": 0, | ||
"end": 7, | ||
"argument": { | ||
"type": "Literal", | ||
"start": 6, | ||
"end": 7, | ||
"value": 1 | ||
} | ||
} | ||
} | ||
] | ||
}, {allowAwaitOutsideFunction: true, ecmaVersion: 8}) | ||
testFail("function foo() {return await 1}", "Unexpected token (1:29)", {ecmaVersion: 8}) | ||
testFail("function foo() {return await 1}", "Unexpected token (1:29)", { | ||
allowAwaitOutsideFunction: true, | ||
ecmaVersion: 8 | ||
}) |
👆 Boolean checks (as the second half) are probably cheaper than the
isContextual
call. The order could be switched since both are required, to perform the cheaper check first.