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

635 lines
15 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 204,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 7,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 11,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 13,
"end": 25,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 17,
"end": 24,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 17,
"end": 19,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 19,
"end": 24,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 21,
"end": 24,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 26,
"end": 43,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 30,
"end": 42,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 30,
"end": 32,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 32,
"end": 42,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 34,
"end": 42,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 34,
"end": 42,
"ctxt": 0
},
"value": "Function",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 45,
"end": 55,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 49,
"end": 54,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 49,
"end": 50,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 50,
"end": 54,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 52,
"end": 54,
"ctxt": 0
},
"members": []
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 56,
"end": 70,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 60,
"end": 69,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 60,
"end": 61,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 61,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"value": "Object",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 71,
"end": 80,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 75,
"end": 79,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 75,
"end": 76,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 76,
"end": 79,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 78,
"end": 79,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 81,
"end": 99,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 85,
"end": 98,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 86,
"end": 98,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 88,
"end": 98,
"ctxt": 0
},
"types": [
{
"type": "TsKeywordType",
"span": {
"start": 88,
"end": 94,
"ctxt": 0
},
"kind": "string"
},
{
"type": "TsTypeReference",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "C",
"optional": false
},
"typeParams": null
}
]
}
}
},
"init": null,
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 101,
"end": 126,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 105,
"end": 125,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 105,
"end": 107,
"ctxt": 0
},
"value": "r1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 110,
"end": 125,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "Identifier",
"span": {
"start": 110,
"end": 111,
"ctxt": 0
},
"value": "a",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 123,
"end": 125,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 127,
"end": 152,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 131,
"end": 151,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 131,
"end": 133,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 136,
"end": 151,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "Identifier",
"span": {
"start": 136,
"end": 137,
"ctxt": 0
},
"value": "b",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 149,
"end": 151,
"ctxt": 0
},
"value": "x2",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 153,
"end": 178,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 157,
"end": 177,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 157,
"end": 159,
"ctxt": 0
},
"value": "r3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 162,
"end": 177,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "Identifier",
"span": {
"start": 162,
"end": 163,
"ctxt": 0
},
"value": "c",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 175,
"end": 177,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 179,
"end": 204,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 183,
"end": 203,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 183,
"end": 185,
"ctxt": 0
},
"value": "r4",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 188,
"end": 203,
"ctxt": 0
},
"operator": "instanceof",
"left": {
"type": "Identifier",
"span": {
"start": 188,
"end": 189,
"ctxt": 0
},
"value": "d",
"optional": false
},
"right": {
"type": "Identifier",
"span": {
"start": 201,
"end": 203,
"ctxt": 0
},
"value": "x1",
"optional": false
}
},
"definite": false
}
]
}
],
"interpreter": null
}