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

1117 lines
33 KiB
JSON

{
"type": "Script",
"span": {
"start": 40,
"end": 707,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 49,
"end": 51,
"ctxt": 0
},
"value": "g1",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 52,
"end": 68,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 52,
"end": 68,
"ctxt": 0
},
"value": "headerNames",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 63,
"end": 68,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 65,
"end": 68,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 40,
"end": 176,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 70,
"end": 176,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 76,
"end": 121,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 80,
"end": 120,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 80,
"end": 81,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 84,
"end": 120,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 85,
"end": 119,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 87,
"end": 99,
"ctxt": 0
},
"value": "hasLineBreak",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 101,
"end": 106,
"ctxt": 0
},
"value": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 108,
"end": 113,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 115,
"end": 117,
"ctxt": 0
},
"elements": []
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 126,
"end": 174,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 132,
"end": 173,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 132,
"end": 137,
"ctxt": 0
},
"value": "table",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 140,
"end": 173,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 140,
"end": 170,
"ctxt": 0
},
"object": {
"type": "ArrayExpression",
"span": {
"start": 140,
"end": 163,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 141,
"end": 162,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 142,
"end": 147,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 149,
"end": 160,
"ctxt": 0
},
"value": "headerNames",
"optional": false
}
}
]
}
}
]
},
"property": {
"type": "Identifier",
"span": {
"start": 164,
"end": 170,
"ctxt": 0
},
"value": "concat",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 171,
"end": 172,
"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": 187,
"end": 189,
"ctxt": 0
},
"value": "g2",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 190,
"end": 206,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 190,
"end": 206,
"ctxt": 0
},
"value": "headerNames",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 201,
"end": 206,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 203,
"end": 206,
"ctxt": 0
},
"kind": "any"
}
}
}
}
],
"decorators": [],
"span": {
"start": 178,
"end": 317,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 208,
"end": 317,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 214,
"end": 259,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 218,
"end": 258,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 218,
"end": 219,
"ctxt": 0
},
"value": "t",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 222,
"end": 258,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 223,
"end": 257,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 225,
"end": 237,
"ctxt": 0
},
"value": "hasLineBreak",
"optional": false
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 239,
"end": 244,
"ctxt": 0
},
"value": false
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 246,
"end": 251,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "ArrayExpression",
"span": {
"start": 253,
"end": 255,
"ctxt": 0
},
"elements": []
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 264,
"end": 315,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 270,
"end": 314,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 270,
"end": 275,
"ctxt": 0
},
"value": "table",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 278,
"end": 314,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 278,
"end": 311,
"ctxt": 0
},
"object": {
"type": "ArrayExpression",
"span": {
"start": 278,
"end": 301,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 279,
"end": 300,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 280,
"end": 285,
"ctxt": 0
},
"value": "cells",
"optional": false
},
"value": {
"type": "Identifier",
"span": {
"start": 287,
"end": 298,
"ctxt": 0
},
"value": "headerNames",
"optional": false
}
}
]
}
}
]
},
"property": {
"type": "Computed",
"span": {
"start": 301,
"end": 311,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 302,
"end": 310,
"ctxt": 0
},
"value": "concat",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "Identifier",
"span": {
"start": 312,
"end": 313,
"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": 406,
"end": 409,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 410,
"end": 444,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 410,
"end": 444,
"ctxt": 0
},
"value": "options",
"optional": true,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 418,
"end": 444,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeLiteral",
"span": {
"start": 420,
"end": 444,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 422,
"end": 432,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 422,
"end": 423,
"ctxt": 0
},
"value": "a",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 423,
"end": 431,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 425,
"end": 431,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 433,
"end": 442,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 433,
"end": 434,
"ctxt": 0
},
"value": "b",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 434,
"end": 442,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 436,
"end": 442,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
}
}
}
}
],
"decorators": [],
"span": {
"start": 397,
"end": 707,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 446,
"end": 707,
"ctxt": 0
},
"stmts": [
{
"type": "VariableDeclaration",
"span": {
"start": 452,
"end": 479,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 456,
"end": 478,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 456,
"end": 458,
"ctxt": 0
},
"value": "x1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 461,
"end": 478,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 461,
"end": 476,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 462,
"end": 475,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 462,
"end": 469,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 473,
"end": 475,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 477,
"end": 478,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 515,
"end": 545,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 519,
"end": 544,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 519,
"end": 521,
"ctxt": 0
},
"value": "x2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "MemberExpression",
"span": {
"start": 524,
"end": 544,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 524,
"end": 539,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 525,
"end": 538,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 525,
"end": 532,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 536,
"end": 538,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 539,
"end": 544,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 540,
"end": 543,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"definite": false
}
]
},
{
"type": "ExpressionStatement",
"span": {
"start": 578,
"end": 600,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 578,
"end": 599,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 578,
"end": 595,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 578,
"end": 593,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 579,
"end": 592,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 579,
"end": 586,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 590,
"end": 592,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Identifier",
"span": {
"start": 594,
"end": 595,
"ctxt": 0
},
"value": "a",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 598,
"end": 599,
"ctxt": 0
},
"value": 1.0
}
}
},
{
"type": "ExpressionStatement",
"span": {
"start": 644,
"end": 669,
"ctxt": 0
},
"expression": {
"type": "AssignmentExpression",
"span": {
"start": 644,
"end": 668,
"ctxt": 0
},
"operator": "=",
"left": {
"type": "MemberExpression",
"span": {
"start": 644,
"end": 664,
"ctxt": 0
},
"object": {
"type": "ParenthesisExpression",
"span": {
"start": 644,
"end": 659,
"ctxt": 0
},
"expression": {
"type": "BinaryExpression",
"span": {
"start": 645,
"end": 658,
"ctxt": 0
},
"operator": "||",
"left": {
"type": "Identifier",
"span": {
"start": 645,
"end": 652,
"ctxt": 0
},
"value": "options",
"optional": false
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 656,
"end": 658,
"ctxt": 0
},
"properties": []
}
}
},
"property": {
"type": "Computed",
"span": {
"start": 659,
"end": 664,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 660,
"end": 663,
"ctxt": 0
},
"value": "a",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 667,
"end": 668,
"ctxt": 0
},
"value": 1.0
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
}
],
"interpreter": null
}