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

539 lines
12 KiB
JSON

{
"type": "Script",
"span": {
"start": 22,
"end": 386,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 31,
"end": 41,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 42,
"end": 51,
"ctxt": 0
},
"value": "o",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 43,
"end": 51,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 45,
"end": 51,
"ctxt": 0
},
"kind": "object"
}
}
}
}
],
"decorators": [],
"span": {
"start": 22,
"end": 55,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 53,
"end": 55,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 65,
"end": 77,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 56,
"end": 106,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 88,
"end": 106,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 94,
"end": 104,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 101,
"end": 103,
"ctxt": 0
},
"properties": []
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 79,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 81,
"end": 87,
"ctxt": 0
},
"kind": "object"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 108,
"end": 133,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 112,
"end": 132,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 112,
"end": 124,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 124,
"end": 132,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 126,
"end": 132,
"ctxt": 0
},
"kind": "object"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 134,
"end": 157,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 138,
"end": 156,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 138,
"end": 147,
"ctxt": 0
},
"value": "primitive",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 147,
"end": 156,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 149,
"end": 156,
"ctxt": 0
},
"kind": "boolean"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 159,
"end": 184,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 159,
"end": 183,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 159,
"end": 169,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 170,
"end": 182,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 185,
"end": 215,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 185,
"end": 214,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 185,
"end": 197,
"ctxt": 0
},
"value": "nonPrimitive",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 200,
"end": 214,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 200,
"end": 212,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 217,
"end": 239,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 217,
"end": 238,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 217,
"end": 227,
"ctxt": 0
},
"value": "takeObject",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 228,
"end": 237,
"ctxt": 0
},
"value": "primitive",
"optional": false
}
}
],
"typeArguments": null
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 256,
"end": 283,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 256,
"end": 282,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "Identifier",
"span": {
"start": 256,
"end": 265,
"ctxt": 0
},
"value": "primitive",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "CallExpression",
"span": {
"start": 268,
"end": 282,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 268,
"end": 280,
"ctxt": 0
},
"value": "returnObject",
"optional": false
},
"arguments": [],
"typeArguments": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 310,
"end": 321,
"ctxt": 0
},
"value": "returnError",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 301,
"end": 386,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 332,
"end": 386,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 338,
"end": 352,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 342,
"end": 351,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 342,
"end": 345,
"ctxt": 0
},
"value": "ret",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 348,
"end": 351,
"ctxt": 0
},
"value": 123.0
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 357,
"end": 368,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 364,
"end": 367,
"ctxt": 0
},
"value": "ret",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 323,
"end": 331,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 325,
"end": 331,
"ctxt": 0
},
"kind": "object"
}
}
}
],
"interpreter": null
}