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

719 lines
18 KiB
JSON

{
"type": "Script",
"span": {
"start": 62,
"end": 364,
"ctxt": 0
},
"body": [
{
"type": "ForStatement",
"span": {
"start": 62,
"end": 106,
"ctxt": 0
},
"init": {
"type": "VariableDeclaration",
"span": {
"start": 67,
"end": 84,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 71,
"end": 76,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 78,
"end": 84,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 82,
"end": 84,
"ctxt": 0
},
"value": 10.0,
"raw": "10"
},
"definite": false
}
]
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 86,
"end": 91,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 86,
"end": 87,
"ctxt": 0
},
"value": "i",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 90,
"end": 91,
"ctxt": 0
},
"value": "j",
"optional": false
}
},
"update": {
"type": "SequenceExpression",
"span": {
"start": 93,
"end": 101,
"ctxt": 0
},
"expressions": [
{
"type": "UpdateExpression",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "Identifier",
"span": {
"start": 93,
"end": 94,
"ctxt": 0
},
"value": "i",
"optional": false
}
},
{
"type": "UpdateExpression",
"span": {
"start": 98,
"end": 101,
"ctxt": 0
},
"operator": "--",
"prefix": false,
"argument": {
"type": "Identifier",
"span": {
"start": 98,
"end": 99,
"ctxt": 0
},
"value": "j",
"optional": false
}
}
]
},
"body": {
"type": "BlockStatement",
"span": {
"start": 103,
"end": 106,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 167,
"end": 170,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 171,
"end": 180,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 171,
"end": 180,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 182,
"end": 191,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 183,
"end": 191,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 185,
"end": 191,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 158,
"end": 213,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 193,
"end": 213,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 199,
"end": 211,
"ctxt": 0
},
"argument": {
"type": "SequenceExpression",
"span": {
"start": 206,
"end": 210,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 206,
"end": 207,
"ctxt": 0
},
"value": "x",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "y",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 214,
"end": 249,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 218,
"end": 248,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 218,
"end": 232,
"ctxt": 0
},
"value": "resultIsString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 235,
"end": 248,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 235,
"end": 238,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 239,
"end": 240,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 242,
"end": 247,
"ctxt": 0
},
"value": "123",
"raw": "\"123\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 277,
"end": 281,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 268,
"end": 364,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 292,
"end": 364,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 298,
"end": 308,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 302,
"end": 307,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 303,
"end": 307,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 305,
"end": 307,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 305,
"end": 307,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 313,
"end": 323,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 317,
"end": 322,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 317,
"end": 318,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 318,
"end": 322,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 320,
"end": 322,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 320,
"end": 322,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 328,
"end": 333,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 328,
"end": 329,
"ctxt": 0
},
"value": "x",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"value": "y",
"optional": false
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 338,
"end": 362,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 342,
"end": 361,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 342,
"end": 352,
"ctxt": 0
},
"value": "resultIsT1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ParenthesisExpression",
"span": {
"start": 355,
"end": 361,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 356,
"end": 360,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": "y",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 359,
"end": 360,
"ctxt": 0
},
"value": "x",
"optional": false
}
]
}
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 281,
"end": 289,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 282,
"end": 284,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 282,
"end": 284,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 286,
"end": 288,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 286,
"end": 288,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"in": false,
"out": false,
"constraint": null,
"default": null
}
]
},
"returnType": null
}
],
"interpreter": null
}