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

303 lines
7.4 KiB
JSON

{
"type": "Script",
"span": {
"start": 35,
"end": 164,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 44,
"end": 47,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 48,
"end": 55,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 48,
"end": 55,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 49,
"end": 55,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 51,
"end": 55,
"ctxt": 0
},
"literal": {
"type": "BooleanLiteral",
"span": {
"start": 51,
"end": 55,
"ctxt": 0
},
"value": true
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 35,
"end": 60,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 57,
"end": 60,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": "f",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 62,
"end": 146,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 75,
"end": 146,
"ctxt": 0
},
"stmts": [
{
"type": "IfStatement",
"span": {
"start": 79,
"end": 144,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 83,
"end": 109,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "MemberExpression",
"span": {
"start": 83,
"end": 100,
"ctxt": 0
},
"object": {
"type": "MetaProperty",
"span": {
"start": 83,
"end": 93,
"ctxt": 0
},
"kind": "new.target"
},
"property": {
"type": "Identifier",
"span": {
"start": 94,
"end": 100,
"ctxt": 0
},
"value": "marked",
"optional": false
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 105,
"end": 109,
"ctxt": 0
},
"value": true
}
},
"consequent": {
"type": "BlockStatement",
"span": {
"start": 111,
"end": 144,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 117,
"end": 140,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 117,
"end": 139,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "MemberExpression",
"span": {
"start": 121,
"end": 138,
"ctxt": 0
},
"object": {
"type": "MetaProperty",
"span": {
"start": 121,
"end": 131,
"ctxt": 0
},
"kind": "new.target"
},
"property": {
"type": "Identifier",
"span": {
"start": 132,
"end": 138,
"ctxt": 0
},
"value": "marked",
"optional": false
}
}
}
],
"typeArguments": null
}
}
]
},
"alternate": null
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 148,
"end": 164,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 148,
"end": 163,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 148,
"end": 156,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 148,
"end": 149,
"ctxt": 0
},
"value": "f",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 150,
"end": 156,
"ctxt": 0
},
"value": "marked",
"optional": false
}
},
"right": {
"type": "BooleanLiteral",
"span": {
"start": 159,
"end": 163,
"ctxt": 0
},
"value": true
}
}
}
],
"interpreter": null
}