swc/crates/swc_ecma_parser/tests/tsc/logicalAssignment1.json
2022-02-04 17:08:38 +09:00

1071 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 60,
"end": 438,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 60,
"end": 93,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 72,
"end": 93,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 93,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 75,
"end": 93,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 84,
"end": 93,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 94,
"end": 127,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 106,
"end": 127,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 106,
"end": 107,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 107,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 109,
"end": 127,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 109,
"end": 115,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 118,
"end": 127,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 128,
"end": 161,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 140,
"end": 161,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 141,
"end": 161,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 143,
"end": 161,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 143,
"end": 149,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsKeywordType",
"span": {
"start": 152,
"end": 161,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 163,
"end": 196,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 175,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 175,
"end": 176,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 176,
"end": 196,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 178,
"end": 196,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 178,
"end": 184,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 187,
"end": 196,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 197,
"end": 230,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 209,
"end": 230,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 210,
"end": 230,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 212,
"end": 230,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 212,
"end": 218,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 221,
"end": 230,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 231,
"end": 264,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 243,
"end": 264,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 244,
"end": 264,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 246,
"end": 264,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 246,
"end": 252,
"ctxt": 0
},
"kind": "number"
},
{
"type": "TsKeywordType",
"span": {
"start": 255,
"end": 264,
"ctxt": 0
},
"kind": "undefined"
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 266,
"end": 291,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 278,
"end": 291,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 278,
"end": 279,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 279,
"end": 291,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 281,
"end": 291,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 281,
"end": 282,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 289,
"end": 291,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 289,
"end": 291,
"ctxt": 0
},
"value": 42.0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 292,
"end": 317,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 304,
"end": 317,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 304,
"end": 305,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 305,
"end": 317,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 307,
"end": 317,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 311,
"end": 312,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 315,
"end": 317,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 315,
"end": 317,
"ctxt": 0
},
"value": 42.0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 318,
"end": 343,
"ctxt": 0
},
"kind": "let",
"declare": true,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 330,
"end": 343,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 331,
"end": 343,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 333,
"end": 343,
"ctxt": 0
},
"types": [
{
"type": "TsLiteralType",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 333,
"end": 334,
"ctxt": 0
},
"value": 0.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 337,
"end": 338,
"ctxt": 0
},
"value": 1.0
}
},
{
"type": "TsLiteralType",
"span": {
"start": 341,
"end": 343,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 341,
"end": 343,
"ctxt": 0
},
"value": 42.0
}
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 346,
"end": 357,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 346,
"end": 357,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 346,
"end": 347,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 352,
"end": 357,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 358,
"end": 369,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 358,
"end": 359,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 364,
"end": 369,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 370,
"end": 381,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 370,
"end": 381,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 370,
"end": 371,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "StringLiteral",
"span": {
"start": 376,
"end": 381,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 384,
"end": 392,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 384,
"end": 392,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 384,
"end": 385,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 390,
"end": 392,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 393,
"end": 401,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 393,
"end": 401,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 393,
"end": 394,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 399,
"end": 401,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 402,
"end": 410,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 402,
"end": 410,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 402,
"end": 403,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 408,
"end": 410,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 412,
"end": 420,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 412,
"end": 420,
"ctxt": 0
},
"operator": "&&=",
"left": {
"type": "Identifier",
"span": {
"start": 412,
"end": 413,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 418,
"end": 420,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 421,
"end": 429,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 421,
"end": 429,
"ctxt": 0
},
"operator": "||=",
"left": {
"type": "Identifier",
"span": {
"start": 421,
"end": 422,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 427,
"end": 429,
"ctxt": 0
},
"value": 42.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 430,
"end": 438,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 430,
"end": 438,
"ctxt": 0
},
"operator": "??=",
"left": {
"type": "Identifier",
"span": {
"start": 430,
"end": 431,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 436,
"end": 438,
"ctxt": 0
},
"value": 42.0
}
}
}
],
"interpreter": null
}