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

1107 lines
33 KiB
JSON

{
"type": "Script",
"span": {
"start": 41,
"end": 708,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 50,
"end": 52,
"ctxt": 0
},
"value": "g1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 53,
"end": 69,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 53,
"end": 69,
"ctxt": 0
},
"value": "headerNames",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 66,
"end": 69,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 41,
"end": 177,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 71,
"end": 177,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 77,
"end": 122,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 81,
"end": 121,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 81,
"end": 82,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 85,
"end": 121,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 86,
"end": 120,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 88,
"end": 100,
"ctxt": 0
},
"value": "hasLineBreak",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 102,
"end": 107,
"ctxt": 0
},
"value": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 109,
"end": 114,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 116,
"end": 118,
"ctxt": 0
},
"elements": []
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 127,
"end": 175,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 133,
"end": 174,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 133,
"end": 138,
"ctxt": 0
},
"value": "table",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 141,
"end": 174,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 141,
"end": 171,
"ctxt": 0
},
"object": {
"type": "ArrayExpression",
"span": {
"start": 141,
"end": 164,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 142,
"end": 163,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 143,
"end": 148,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 150,
"end": 161,
"ctxt": 0
},
"value": "headerNames",
"optional": false
}
}
]
}
}
]
},
"property": {
"type": "Identifier",
"span": {
"start": 165,
"end": 171,
"ctxt": 0
},
"value": "concat",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 172,
"end": 173,
"ctxt": 0
},
"value": "t",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 188,
"end": 190,
"ctxt": 0
},
"value": "g2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 191,
"end": 207,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 191,
"end": 207,
"ctxt": 0
},
"value": "headerNames",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 202,
"end": 207,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 204,
"end": 207,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 179,
"end": 318,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 209,
"end": 318,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 215,
"end": 260,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 219,
"end": 259,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 219,
"end": 220,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 223,
"end": 259,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 224,
"end": 258,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 226,
"end": 238,
"ctxt": 0
},
"value": "hasLineBreak",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 240,
"end": 245,
"ctxt": 0
},
"value": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 247,
"end": 252,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 254,
"end": 256,
"ctxt": 0
},
"elements": []
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 265,
"end": 316,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 271,
"end": 315,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 271,
"end": 276,
"ctxt": 0
},
"value": "table",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 279,
"end": 315,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 279,
"end": 312,
"ctxt": 0
},
"object": {
"type": "ArrayExpression",
"span": {
"start": 279,
"end": 302,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 280,
"end": 301,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 281,
"end": 286,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 288,
"end": 299,
"ctxt": 0
},
"value": "headerNames",
"optional": false
}
}
]
}
}
]
},
"property": {
"type": "Computed",
"span": {
"start": 302,
"end": 312,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 303,
"end": 311,
"ctxt": 0
},
"value": "concat",
"raw": "\"concat\""
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 313,
"end": 314,
"ctxt": 0
},
"value": "t",
"optional": false
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 407,
"end": 410,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 411,
"end": 445,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 411,
"end": 445,
"ctxt": 0
},
"value": "options",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 419,
"end": 445,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 421,
"end": 445,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 423,
"end": 433,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 423,
"end": 424,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 424,
"end": 432,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 426,
"end": 432,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 434,
"end": 443,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 434,
"end": 435,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 435,
"end": 443,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 437,
"end": 443,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 398,
"end": 708,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 447,
"end": 708,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 453,
"end": 480,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 457,
"end": 479,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 457,
"end": 459,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 462,
"end": 479,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 462,
"end": 477,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 463,
"end": 476,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 463,
"end": 470,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 474,
"end": 476,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 478,
"end": 479,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 516,
"end": 546,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 520,
"end": 545,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 520,
"end": 522,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 525,
"end": 545,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 525,
"end": 540,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 526,
"end": 539,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 526,
"end": 533,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 537,
"end": 539,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 540,
"end": 545,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 541,
"end": 544,
"ctxt": 0
},
"value": "a",
"raw": "\"a\""
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 579,
"end": 601,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 579,
"end": 600,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 579,
"end": 596,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 579,
"end": 594,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 580,
"end": 593,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 580,
"end": 587,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 591,
"end": 593,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 595,
"end": 596,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 599,
"end": 600,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 645,
"end": 670,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 645,
"end": 669,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 645,
"end": 665,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 645,
"end": 660,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 646,
"end": 659,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 646,
"end": 653,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 657,
"end": 659,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 660,
"end": 665,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 661,
"end": 664,
"ctxt": 0
},
"value": "a",
"raw": "\"a\""
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 668,
"end": 669,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}