swc/crates/swc_ecma_parser/tests/tsc/stringLiteralsAssertionsInEqualityComparisons01.json
2022-02-04 20:17:42 +09:00

286 lines
6.9 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 102,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 0,
"end": 34,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 4,
"end": 33,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 4,
"end": 5,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 8,
"end": 33,
"ctxt": 0
},
"operator": "===",
"left": {
"type": "StringLiteral",
"span": {
"start": 8,
"end": 13,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "TsAsExpression",
"span": {
"start": 18,
"end": 33,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 18,
"end": 23,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 27,
"end": 33,
"ctxt": 0
},
"kind": "string"
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 35,
"end": 71,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 39,
"end": 70,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 43,
"end": 70,
"ctxt": 0
},
"operator": "!==",
"left": {
"type": "StringLiteral",
"span": {
"start": 43,
"end": 48,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 53,
"end": 70,
"ctxt": 0
},
"expression": {
"type": "TsAsExpression",
"span": {
"start": 54,
"end": 69,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 54,
"end": 59,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"kind": "string"
}
}
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 72,
"end": 102,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 76,
"end": 101,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 76,
"end": 77,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "BinaryExpression",
"span": {
"start": 80,
"end": 101,
"ctxt": 0
},
"operator": "==",
"left": {
"type": "StringLiteral",
"span": {
"start": 80,
"end": 85,
"ctxt": 0
},
"value": "foo",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"right": {
"type": "ParenthesisExpression",
"span": {
"start": 89,
"end": 101,
"ctxt": 0
},
"expression": {
"type": "TsTypeAssertion",
"span": {
"start": 90,
"end": 100,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 95,
"end": 100,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 91,
"end": 94,
"ctxt": 0
},
"kind": "any"
}
}
}
},
"definite": false
}
]
}
],
"interpreter": null
}