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

322 lines
7.0 KiB
JSON

{
"type": "Script",
"span": {
"start": 0,
"end": 147,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 6,
"end": 9,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"span": {
"start": 0,
"end": 13,
"ctxt": 0
},
"decorators": [],
"body": [],
"superClass": null,
"isAbstract": false,
"typeParams": null,
"superTypeParams": null,
"implements": []
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 31,
"end": 33,
"ctxt": 0
},
"value": "as",
"optional": false
},
"declare": true,
"params": [
{
"type": "Parameter",
"span": {
"start": 34,
"end": 48,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 34,
"end": 48,
"ctxt": 0
},
"rest": {
"start": 34,
"end": 37,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 37,
"end": 41,
"ctxt": 0
},
"value": "args",
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 41,
"end": 48,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 43,
"end": 48,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 43,
"end": 46,
"ctxt": 0
},
"kind": "any"
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 14,
"end": 50,
"ctxt": 0
},
"body": null,
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "VariableDeclaration",
"span": {
"start": 65,
"end": 75,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 69,
"end": 75,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 73,
"end": 75,
"ctxt": 0
},
"value": 10.0
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 76,
"end": 93,
"ctxt": 0
},
"expression": {
"type": "TaggedTemplateExpression",
"span": {
"start": 76,
"end": 92,
"ctxt": 0
},
"tag": {
"type": "Identifier",
"span": {
"start": 76,
"end": 78,
"ctxt": 0
},
"value": "as",
"optional": false
},
"typeParameters": null,
"template": {
"type": "TemplateLiteral",
"span": {
"start": 79,
"end": 92,
"ctxt": 0
},
"expressions": [],
"quasis": [
{
"type": "TemplateElement",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"tail": true,
"cooked": {
"type": "StringLiteral",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"value": "Hello world",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
},
"raw": {
"type": "StringLiteral",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"value": "Hello world",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": false
}
}
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 128,
"end": 138,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 132,
"end": 138,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 132,
"end": 133,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NumericLiteral",
"span": {
"start": 136,
"end": 138,
"ctxt": 0
},
"value": 20.0
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 139,
"end": 147,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 139,
"end": 146,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 139,
"end": 141,
"ctxt": 0
},
"value": "as",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 142,
"end": 145,
"ctxt": 0
},
"value": "Foo",
"optional": false
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}