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

554 lines
18 KiB
JSON

{
"type": "Module",
"span": {
"start": 45,
"end": 269,
"ctxt": 0
},
"body": [
{
"type": "ExportDeclaration",
"span": {
"start": 45,
"end": 115,
"ctxt": 0
},
"declaration": {
"type": "TsInterfaceDeclaration",
"span": {
"start": 52,
"end": 115,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 62,
"end": 65,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 66,
"end": 115,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 72,
"end": 82,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 72,
"end": 73,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 73,
"end": 81,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 75,
"end": 81,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 87,
"end": 97,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 88,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 88,
"end": 96,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 90,
"end": 96,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 102,
"end": 113,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 102,
"end": 103,
"ctxt": 0
},
"value": "c",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 112,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 105,
"end": 112,
"ctxt": 0
},
"kind": "boolean"
}
},
"typeParams": null
}
]
}
}
},
{
"type": "ExportDeclaration",
"span": {
"start": 117,
"end": 269,
"ctxt": 0
},
"declaration": {
"type": "VariableDeclaration",
"span": {
"start": 124,
"end": 269,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 130,
"end": 269,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 130,
"end": 133,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 136,
"end": 269,
"ctxt": 0
},
"properties": [
{
"type": "MethodProperty",
"key": {
"type": "Identifier",
"span": {
"start": 142,
"end": 143,
"ctxt": 0
},
"value": "m",
"optional": false
},
"params": [],
"decorators": [],
"span": {
"start": 142,
"end": 267,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 159,
"end": 267,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 169,
"end": 197,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 173,
"end": 196,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 173,
"end": 176,
"ctxt": 0
},
"value": "dis",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 179,
"end": 196,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 179,
"end": 189,
"ctxt": 0
},
"expression": {
"type": "ThisExpression",
"span": {
"start": 179,
"end": 183,
"ctxt": 0
}
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 187,
"end": 189,
"ctxt": 0
},
"members": []
}
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 193,
"end": 196,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
},
{
"type": "ReturnStatement",
"span": {
"start": 206,
"end": 261,
"ctxt": 0
},
"argument": {
"type": "BinaryExpression",
"span": {
"start": 213,
"end": 260,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 213,
"end": 243,
"ctxt": 0
},
"operator": "&&",
"left": {
"type": "BinaryExpression",
"span": {
"start": 213,
"end": 226,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "MemberExpression",
"span": {
"start": 213,
"end": 218,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 213,
"end": 216,
"ctxt": 0
},
"value": "dis",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 217,
"end": 218,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 222,
"end": 226,
"ctxt": 0
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 230,
"end": 243,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "MemberExpression",
"span": {
"start": 230,
"end": 235,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 230,
"end": 233,
"ctxt": 0
},
"value": "dis",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 234,
"end": 235,
"ctxt": 0
},
"value": "b",
"optional": false
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 239,
"end": 243,
"ctxt": 0
}
}
}
},
"right": {
"type": "BinaryExpression",
"span": {
"start": 247,
"end": 260,
"ctxt": 0
},
"operator": "!=",
"left": {
"type": "MemberExpression",
"span": {
"start": 247,
"end": 252,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 247,
"end": 250,
"ctxt": 0
},
"value": "dis",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": "c",
"optional": false
}
},
"right": {
"type": "NullLiteral",
"span": {
"start": 256,
"end": 260,
"ctxt": 0
}
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 145,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypePredicate",
"span": {
"start": 147,
"end": 158,
"ctxt": 0
},
"asserts": false,
"paramName": {
"type": "TsThisType",
"span": {
"start": 147,
"end": 151,
"ctxt": 0
}
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 155,
"end": 158,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
}
}
}
}
]
},
"definite": false
}
]
}
}
],
"interpreter": null
}