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

540 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 23,
"end": 387,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 32,
"end": 42,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 43,
"end": 52,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 44,
"end": 52,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 52,
"ctxt": 0
},
"kind": "object"
}
}
}
}
],
"decorators": [],
"span": {
"start": 23,
"end": 56,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 54,
"end": 56,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 66,
"end": 78,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 57,
"end": 107,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 89,
"end": 107,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 95,
"end": 105,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 102,
"end": 104,
"ctxt": 0
},
"properties": []
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 88,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 82,
"end": 88,
"ctxt": 0
},
"kind": "object"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 109,
"end": 134,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 113,
"end": 133,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 113,
"end": 125,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"kind": "object"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 135,
"end": 158,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 139,
"end": 157,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 139,
"end": 148,
"ctxt": 0
},
"value": "primitive",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 148,
"end": 157,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 150,
"end": 157,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 160,
"end": 185,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 160,
"end": 184,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 160,
"end": 170,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 171,
"end": 183,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 186,
"end": 216,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 186,
"end": 215,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 186,
"end": 198,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 201,
"end": 215,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 201,
"end": 213,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 218,
"end": 240,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 218,
"end": 239,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 218,
"end": 228,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 229,
"end": 238,
"ctxt": 0
},
"value": "primitive",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 257,
"end": 284,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 257,
"end": 283,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 257,
"end": 266,
"ctxt": 0
},
"value": "primitive",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 269,
"end": 283,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 269,
"end": 281,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 311,
"end": 322,
"ctxt": 0
},
"value": "returnError",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 302,
"end": 387,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 333,
"end": 387,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 339,
"end": 353,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 343,
"end": 352,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 343,
"end": 346,
"ctxt": 0
},
"value": "ret",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 349,
"end": 352,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 365,
"end": 368,
"ctxt": 0
},
"value": "ret",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 324,
"end": 332,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 326,
"end": 332,
"ctxt": 0
},
"kind": "object"
}
}
}
],
"interpreter": null
}