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

538 lines
13 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 152,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 36,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 36,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 5,
"end": 21,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 7,
"end": 21,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 9,
"end": 19,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 9,
"end": 10,
"ctxt": 0
},
"value": "o",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 10,
"end": 19,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 12,
"end": 19,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 24,
"end": 36,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"value": "o",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 29,
"end": 34,
"ctxt": 0
},
"value": false
}
}
]
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 37,
"end": 80,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 41,
"end": 57,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 41,
"end": 47,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 41,
"end": 42,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 42,
"end": 47,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"value": "o",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 52,
"end": 57,
"ctxt": 0
},
"value": false
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 59,
"end": 80,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 65,
"end": 78,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 65,
"end": 78,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 65,
"end": 71,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 65,
"end": 66,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 66,
"end": 71,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 67,
"end": 70,
"ctxt": 0
},
"value": "o",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 74,
"end": 78,
"ctxt": 0
},
"value": true
}
}
}
]
},
"alternate": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 82,
"end": 117,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 88,
"end": 116,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 88,
"end": 89,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 89,
"end": 107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 91,
"end": 107,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 92,
"end": 98,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 92,
"end": 98,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 100,
"end": 106,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 111,
"end": 112,
"ctxt": 0
},
"value": 0.0
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 114,
"end": 115,
"ctxt": 0
},
"value": 0.0
}
}
]
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 118,
"end": 152,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 122,
"end": 132,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 122,
"end": 126,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "y",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 123,
"end": 126,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 124,
"end": 125,
"ctxt": 0
},
"value": 0.0
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 131,
"end": 132,
"ctxt": 0
},
"value": 0.0
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 134,
"end": 152,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 140,
"end": 150,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 140,
"end": 149,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 140,
"end": 144,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 140,
"end": 141,
"ctxt": 0
},
"value": "y",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": 0.0
}
}
},
"right": {
"type": "UnaryExpression",
"span": {
"start": 147,
"end": 149,
"ctxt": 0
},
"operator": "-",
"argument": {
"type": "NumericLiteral",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": 1.0
}
}
}
}
]
},
"alternate": null
}
],
"interpreter": null
}