Add options.allowAwaitOutsideFunction. (#7637)

This commit is contained in:
John-David Dalton
2018-03-29 07:41:14 -07:00
committed by Henry Zhu
parent 0200e6256a
commit 59ba3959dc
8 changed files with 117 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
function a() {
return await 1
}

View File

@@ -0,0 +1,4 @@
{
"allowAwaitOutsideFunction": true,
"throws": "Unexpected token, expected \";\" (2:15)"
}

View File

@@ -0,0 +1,3 @@
{
"allowAwaitOutsideFunction": true
}

View 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": []
}
}