swc/crates/swc_ecma_parser/tests/tsc/parser536727.json

468 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 143,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 13,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 14,
"end": 38,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 14,
"end": 38,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 15,
"end": 38,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsFunctionType",
"span": {
"start": 17,
"end": 38,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 18,
"end": 27,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 19,
"end": 27,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 21,
"end": 27,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeParams": null,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 29,
"end": 38,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 32,
"end": 38,
"ctxt": 0
},
"kind": "string"
}
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 61,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 40,
"end": 61,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 46,
"end": 59,
"ctxt": 0
},
"argument": {
"type": "CallExpression",
"span": {
"start": 53,
"end": 58,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 53,
"end": 54,
"ctxt": 0
},
"value": "f",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 55,
"end": 57,
"ctxt": 0
},
"value": "",
"raw": "\"\""
}
}
],
"typeArguments": null
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 62,
"end": 96,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 66,
"end": 95,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 66,
"end": 67,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 70,
"end": 95,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 71,
"end": 80,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 72,
"end": 80,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 74,
"end": 80,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"body": {
"type": "BinaryExpression",
"span": {
"start": 85,
"end": 95,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "StringLiteral",
"span": {
"start": 89,
"end": 95,
"ctxt": 0
},
"value": "blah",
"raw": "\"blah\""
}
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 97,
"end": 113,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 101,
"end": 112,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 101,
"end": 102,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrowFunctionExpression",
"span": {
"start": 105,
"end": 112,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": "g",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 114,
"end": 121,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 114,
"end": 120,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 114,
"end": 117,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 118,
"end": 119,
"ctxt": 0
},
"value": "g",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 122,
"end": 135,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 122,
"end": 134,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 122,
"end": 125,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrowFunctionExpression",
"span": {
"start": 126,
"end": 133,
"ctxt": 0
},
"params": [],
"body": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "g",
"optional": false
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 136,
"end": 143,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 136,
"end": 142,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 136,
"end": 139,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}