parser, smart pipes: Add test for async–await

This commit is contained in:
J. S. Choi 2018-12-20 00:15:11 -05:00 committed by Nicolò Ribaudo
parent b5177ce290
commit 60ffe1d103
3 changed files with 187 additions and 0 deletions

View File

@ -0,0 +1,3 @@
async function f () {
return x |> await #;
}

View File

@ -0,0 +1,3 @@
{
"plugins": [["pipelineOperator", { "proposal": "smart" }]]
}

View File

@ -0,0 +1,181 @@
{
"type": "File",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"sourceType": "script",
"interpreter": null,
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
},
"identifierName": "f"
},
"name": "f"
},
"generator": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"start": 20,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 3,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 24,
"end": 44,
"loc": {
"start": {
"line": 2,
"column": 2
},
"end": {
"line": 2,
"column": 22
}
},
"argument": {
"type": "BinaryExpression",
"start": 31,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 21
}
},
"left": {
"type": "Identifier",
"start": 31,
"end": 32,
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 10
},
"identifierName": "x"
},
"name": "x"
},
"operator": "|>",
"right": {
"type": "PipelineTopicExpression",
"start": 36,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 21
}
},
"expression": {
"type": "AwaitExpression",
"start": 36,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 14
},
"end": {
"line": 2,
"column": 21
}
},
"argument": {
"type": "PipelinePrimaryTopicReference",
"start": 42,
"end": 43,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 21
}
}
}
}
}
}
}
],
"directives": []
}
}
],
"directives": []
}
}