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

927 lines
23 KiB
JSON

{
"type": "Script",
"span": {
"start": 1,
"end": 346,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 18,
"end": 21,
"ctxt": 0
},
"value": "tag",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 22,
"end": 33,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 22,
"end": 33,
"ctxt": 0
},
"rest": {
"start": 22,
"end": 25,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 26,
"end": 33,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 28,
"end": 33,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 28,
"end": 31,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 40,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 39,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 36,
"end": 39,
"ctxt": 0
},
"kind": "any"
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 42,
"end": 75,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 46,
"end": 74,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 46,
"end": 47,
"ctxt": 0
},
"value": "a",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TemplateLiteral",
"span": {
"start": 50,
"end": 74,
"ctxt": 0
},
"expressions": [
{
"type": "TsAsExpression",
"span": {
"start": 53,
"end": 72,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 53,
"end": 62,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 53,
"end": 56,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 59,
"end": 62,
"ctxt": 0
},
"value": 456.0,
"raw": "456"
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 66,
"end": 72,
"ctxt": 0
},
"kind": "number"
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 51,
"end": 51,
"ctxt": 0
},
"tail": false,
"cooked": "",
"raw": ""
},
{
"type": "TemplateElement",
"span": {
"start": 73,
"end": 73,
"ctxt": 0
},
"tail": true,
"cooked": "",
"raw": ""
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 76,
"end": 117,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 80,
"end": 116,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "b",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TemplateLiteral",
"span": {
"start": 84,
"end": 116,
"ctxt": 0
},
"expressions": [
{
"type": "TsAsExpression",
"span": {
"start": 95,
"end": 114,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 95,
"end": 104,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 95,
"end": 98,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 101,
"end": 104,
"ctxt": 0
},
"value": 456.0,
"raw": "456"
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 108,
"end": 114,
"ctxt": 0
},
"kind": "number"
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 85,
"end": 93,
"ctxt": 0
},
"tail": false,
"cooked": "leading ",
"raw": "leading "
},
{
"type": "TemplateElement",
"span": {
"start": 115,
"end": 115,
"ctxt": 0
},
"tail": true,
"cooked": "",
"raw": ""
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 118,
"end": 160,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 122,
"end": 159,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 122,
"end": 123,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TemplateLiteral",
"span": {
"start": 126,
"end": 159,
"ctxt": 0
},
"expressions": [
{
"type": "TsAsExpression",
"span": {
"start": 129,
"end": 148,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 129,
"end": 138,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 129,
"end": 132,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"value": 456.0,
"raw": "456"
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 142,
"end": 148,
"ctxt": 0
},
"kind": "number"
}
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 127,
"end": 127,
"ctxt": 0
},
"tail": false,
"cooked": "",
"raw": ""
},
{
"type": "TemplateElement",
"span": {
"start": 149,
"end": 158,
"ctxt": 0
},
"tail": true,
"cooked": " trailing",
"raw": " trailing"
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 161,
"end": 200,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 165,
"end": 199,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 165,
"end": 166,
"ctxt": 0
},
"value": "d",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 169,
"end": 199,
"ctxt": 0
},
"expression": {
"type": "TemplateLiteral",
"span": {
"start": 169,
"end": 189,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 170,
"end": 176,
"ctxt": 0
},
"tail": false,
"cooked": "Hello ",
"raw": "Hello "
},
{
"type": "TemplateElement",
"span": {
"start": 182,
"end": 188,
"ctxt": 0
},
"tail": true,
"cooked": " World",
"raw": " World"
}
]
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 193,
"end": 199,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 201,
"end": 227,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 205,
"end": 226,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 205,
"end": 206,
"ctxt": 0
},
"value": "e",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 209,
"end": 226,
"ctxt": 0
},
"expression": {
"type": "TemplateLiteral",
"span": {
"start": 209,
"end": 216,
"ctxt": 0
},
"expressions": [],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 210,
"end": 215,
"ctxt": 0
},
"tail": true,
"cooked": "Hello",
"raw": "Hello"
}
]
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 220,
"end": 226,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 228,
"end": 271,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 232,
"end": 270,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 232,
"end": 233,
"ctxt": 0
},
"value": "f",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 236,
"end": 270,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 236,
"end": 260,
"ctxt": 0
},
"operator": "+",
"left": {
"type": "NumericLiteral",
"span": {
"start": 236,
"end": 237,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "TemplateLiteral",
"span": {
"start": 240,
"end": 260,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 243,
"end": 244,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 241,
"end": 241,
"ctxt": 0
},
"tail": false,
"cooked": "",
"raw": ""
},
{
"type": "TemplateElement",
"span": {
"start": 245,
"end": 259,
"ctxt": 0
},
"tail": true,
"cooked": " end of string",
"raw": " end of string"
}
]
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 264,
"end": 270,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 272,
"end": 315,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 276,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 276,
"end": 277,
"ctxt": 0
},
"value": "g",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 280,
"end": 314,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 280,
"end": 304,
"ctxt": 0
},
"tag": {
"type": "Identifier",
"span": {
"start": 280,
"end": 283,
"ctxt": 0
},
"value": "tag",
"optional": false
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 284,
"end": 304,
"ctxt": 0
},
"expressions": [
{
"type": "NumericLiteral",
"span": {
"start": 293,
"end": 296,
"ctxt": 0
},
"value": 123.0,
"raw": "123"
}
],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 285,
"end": 291,
"ctxt": 0
},
"tail": false,
"cooked": "Hello ",
"raw": "Hello "
},
{
"type": "TemplateElement",
"span": {
"start": 297,
"end": 303,
"ctxt": 0
},
"tail": true,
"cooked": " World",
"raw": " World"
}
]
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 308,
"end": 314,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 316,
"end": 346,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 320,
"end": 345,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 320,
"end": 321,
"ctxt": 0
},
"value": "h",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 324,
"end": 345,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 324,
"end": 335,
"ctxt": 0
},
"tag": {
"type": "Identifier",
"span": {
"start": 324,
"end": 327,
"ctxt": 0
},
"value": "tag",
"optional": false
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 328,
"end": 335,
"ctxt": 0
},
"expressions": [],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 329,
"end": 334,
"ctxt": 0
},
"tail": true,
"cooked": "Hello",
"raw": "Hello"
}
]
}
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 339,
"end": 345,
"ctxt": 0
},
"kind": "string"
}
},
"definite": false
}
]
}
],
"interpreter": null
}