Add options.allowAwaitOutsideFunction. (#7637)
This commit is contained in:
committed by
Henry Zhu
parent
0200e6256a
commit
59ba3959dc
@@ -0,0 +1,3 @@
|
||||
function a() {
|
||||
return await 1
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"allowAwaitOutsideFunction": true,
|
||||
"throws": "Unexpected token, expected \";\" (2:15)"
|
||||
}
|
||||
1
packages/babylon/test/fixtures/es2017/async-functions/allow-await-outside-function/input.js
vendored
Normal file
1
packages/babylon/test/fixtures/es2017/async-functions/allow-await-outside-function/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
await 1
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"allowAwaitOutsideFunction": true
|
||||
}
|
||||
84
packages/babylon/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json
vendored
Normal file
84
packages/babylon/test/fixtures/es2017/async-functions/allow-await-outside-function/output.json
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"expression": {
|
||||
"type": "AwaitExpression",
|
||||
"start": 0,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"argument": {
|
||||
"type": "NumericLiteral",
|
||||
"start": 6,
|
||||
"end": 7,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": 1,
|
||||
"raw": "1"
|
||||
},
|
||||
"value": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user