swc/crates/swc_ecma_parser/tests/tsc/for-inStatementsArrayErrors.json

639 lines
16 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
"start": 26,
"end": 238,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 26,
"end": 40,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 39,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 31,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 31,
"end": 39,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 33,
"end": 39,
"ctxt": 0
},
"elemType": {
"type": "TsTypeReference",
"span": {
"start": 33,
"end": 37,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 33,
"end": 37,
"ctxt": 0
},
"value": "Date",
"optional": false
},
"typeParams": null
}
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForInStatement",
"span": {
"start": 42,
"end": 165,
"ctxt": 0
},
"left": {
"type": "VariableDeclaration",
"span": {
"start": 47,
"end": 52,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 56,
"end": 57,
"ctxt": 0
},
"value": "a",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 59,
"end": 165,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 65,
"end": 83,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 69,
"end": 82,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 69,
"end": 71,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 74,
"end": 82,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 74,
"end": 75,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 75,
"end": 82,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 76,
"end": 81,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 88,
"end": 106,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 92,
"end": 105,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 92,
"end": 94,
"ctxt": 0
},
"value": "a2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 97,
"end": 105,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "a",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 98,
"end": 105,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 99,
"end": 104,
"ctxt": 0
},
"operator": "-",
"left": {
"type": "Identifier",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 103,
"end": 104,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
},
"definite": false
}
]
},
{
"type": "IfStatement",
"span": {
"start": 111,
"end": 131,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 115,
"end": 122,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "Identifier",
"span": {
"start": 115,
"end": 116,
"ctxt": 0
},
"value": "x",
"optional": false
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 121,
"end": 122,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 124,
"end": 131,
"ctxt": 0
},
"stmts": []
},
"alternate": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 136,
"end": 163,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 140,
"end": 162,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 140,
"end": 142,
"ctxt": 0
},
"value": "a3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 145,
"end": 162,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 145,
"end": 146,
"ctxt": 0
},
"value": "x",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 147,
"end": 162,
"ctxt": 0
},
"value": "unknownProperty",
"optional": false
}
},
"definite": false
}
]
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 167,
"end": 181,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 171,
"end": 180,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 172,
"end": 180,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 174,
"end": 180,
"ctxt": 0
},
"kind": "number"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForInStatement",
"span": {
"start": 182,
"end": 203,
"ctxt": 0
},
"left": {
"type": "VariableDeclaration",
"span": {
"start": 187,
"end": 192,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 191,
"end": 192,
"ctxt": 0
},
"value": "i",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 196,
"end": 197,
"ctxt": 0
},
"value": "a",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 200,
"end": 203,
"ctxt": 0
},
"stmts": []
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 205,
"end": 216,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 209,
"end": 215,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 209,
"end": 210,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 210,
"end": 215,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 212,
"end": 215,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "ForInStatement",
"span": {
"start": 217,
"end": 238,
"ctxt": 0
},
"left": {
"type": "VariableDeclaration",
"span": {
"start": 222,
"end": 227,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 226,
"end": 227,
"ctxt": 0
},
"value": "j",
"optional": false,
"typeAnnotation": null
},
"init": null,
"definite": false
}
]
},
"right": {
"type": "Identifier",
"span": {
"start": 231,
"end": 232,
"ctxt": 0
},
"value": "a",
"optional": false
},
"body": {
"type": "BlockStatement",
"span": {
"start": 235,
"end": 238,
"ctxt": 0
},
"stmts": []
}
}
],
"interpreter": null
}