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

712 lines
18 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 61,
"end": 363,
"ctxt": 0
},
"body": [
{
"type": "ForStatement",
"span": {
"start": 61,
"end": 105,
"ctxt": 0
},
"init": {
"type": "VariableDeclaration",
"span": {
"start": 66,
"end": 83,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 70,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 70,
"end": 71,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": 0.0
},
"definite": false
},
{
"type": "VariableDeclarator",
"span": {
"start": 77,
"end": 83,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 77,
"end": 78,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 81,
"end": 83,
"ctxt": 0
},
"value": 10.0
},
"definite": false
}
]
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 85,
"end": 90,
"ctxt": 0
},
"operator": "<",
"left": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "i",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": "j",
"optional": false
}
},
"update": {
"type": "SequenceExpression",
"span": {
"start": 92,
"end": 100,
"ctxt": 0
},
"expressions": [
{
"type": "UpdateExpression",
"span": {
"start": 92,
"end": 95,
"ctxt": 0
},
"operator": "++",
"prefix": false,
"argument": {
"type": "Identifier",
"span": {
"start": 92,
"end": 93,
"ctxt": 0
},
"value": "i",
"optional": false
}
},
{
"type": "UpdateExpression",
"span": {
"start": 97,
"end": 100,
"ctxt": 0
},
"operator": "--",
"prefix": false,
"argument": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "j",
"optional": false
}
}
]
},
"body": {
"type": "BlockStatement",
"span": {
"start": 102,
"end": 105,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 166,
"end": 169,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 170,
"end": 179,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 171,
"end": 179,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 173,
"end": 179,
"ctxt": 0
},
"kind": "number"
}
}
}
},
{
"type": "Parameter",
"span": {
"start": 181,
"end": 190,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 181,
"end": 190,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 182,
"end": 190,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 184,
"end": 190,
"ctxt": 0
},
"kind": "string"
}
}
}
}
],
"decorators": [],
"span": {
"start": 157,
"end": 212,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 192,
"end": 212,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 198,
"end": 210,
"ctxt": 0
},
"argument": {
"type": "SequenceExpression",
"span": {
"start": 205,
"end": 209,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "x",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 208,
"end": 209,
"ctxt": 0
},
"value": "y",
"optional": false
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 213,
"end": 248,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 217,
"end": 247,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 217,
"end": 231,
"ctxt": 0
},
"value": "resultIsString",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 234,
"end": 247,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 234,
"end": 237,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 238,
"end": 239,
"ctxt": 0
},
"value": 1.0
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 241,
"end": 246,
"ctxt": 0
},
"value": "123",
"raw": "\"123\""
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 276,
"end": 280,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 267,
"end": 363,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 291,
"end": 363,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 297,
"end": 307,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 301,
"end": 306,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 301,
"end": 302,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 302,
"end": 306,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 304,
"end": 306,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 304,
"end": 306,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 312,
"end": 322,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 321,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 317,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 317,
"end": 321,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 319,
"end": 321,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 319,
"end": 321,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 327,
"end": 332,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 327,
"end": 331,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 327,
"end": 328,
"ctxt": 0
},
"value": "x",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "y",
"optional": false
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 337,
"end": 361,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 341,
"end": 360,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 341,
"end": 351,
"ctxt": 0
},
"value": "resultIsT1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ParenthesisExpression",
"span": {
"start": 354,
"end": 360,
"ctxt": 0
},
"expression": {
"type": "SequenceExpression",
"span": {
"start": 355,
"end": 359,
"ctxt": 0
},
"expressions": [
{
"type": "Identifier",
"span": {
"start": 355,
"end": 356,
"ctxt": 0
},
"value": "y",
"optional": false
},
{
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "x",
"optional": false
}
]
}
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 280,
"end": 288,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 281,
"end": 283,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 281,
"end": 283,
"ctxt": 0
},
"value": "T1",
"optional": false
},
"constraint": null,
"default": null
},
{
"type": "TsTypeParameter",
"span": {
"start": 285,
"end": 287,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 285,
"end": 287,
"ctxt": 0
},
"value": "T2",
"optional": false
},
"constraint": null,
"default": null
}
]
},
"returnType": null
}
],
"interpreter": null
}