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

1547 lines
39 KiB
JSON

{
"type": "Script",
"span": {
"start": 362,
"end": 1608,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 362,
"end": 390,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 366,
"end": 389,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 366,
"end": 372,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 368,
"end": 370,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 368,
"end": 370,
"ctxt": 0
},
"value": "a1",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 372,
"end": 377,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 374,
"end": 377,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": {
"type": "Identifier",
"span": {
"start": 380,
"end": 389,
"ctxt": 0
},
"value": "undefined",
"optional": false
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 391,
"end": 412,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 395,
"end": 411,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 395,
"end": 401,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 397,
"end": 399,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 397,
"end": 399,
"ctxt": 0
},
"value": "a2",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 401,
"end": 406,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 403,
"end": 406,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 409,
"end": 411,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 636,
"end": 660,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 640,
"end": 659,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 640,
"end": 647,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 642,
"end": 644,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 642,
"end": 644,
"ctxt": 0
},
"value": "b1",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 650,
"end": 659,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 652,
"end": 654,
"ctxt": 0
},
"value": "b1",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 655,
"end": 656,
"ctxt": 0
},
"value": 1.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 661,
"end": 729,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 665,
"end": 728,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 665,
"end": 701,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 667,
"end": 669,
"ctxt": 0
},
"value": "b2",
"optional": false
},
"value": {
"type": "AssignmentPattern",
"span": {
"start": 671,
"end": 698,
"ctxt": 0
},
"left": {
"type": "ObjectPattern",
"span": {
"start": 671,
"end": 678,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 673,
"end": 676,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 673,
"end": 676,
"ctxt": 0
},
"value": "b21",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
},
"right": {
"type": "ObjectExpression",
"span": {
"start": 681,
"end": 698,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 683,
"end": 686,
"ctxt": 0
},
"value": "b21",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 688,
"end": 696,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 704,
"end": 728,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 706,
"end": 708,
"ctxt": 0
},
"value": "b2",
"optional": false
},
"value": {
"type": "ObjectExpression",
"span": {
"start": 710,
"end": 726,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 712,
"end": 715,
"ctxt": 0
},
"value": "b21",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 717,
"end": 724,
"ctxt": 0
},
"value": "world",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 730,
"end": 760,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 734,
"end": 759,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 734,
"end": 741,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 735,
"end": 736,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "Identifier",
"span": {
"start": 738,
"end": 740,
"ctxt": 0
},
"value": "b3",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 744,
"end": 759,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 746,
"end": 747,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "StringLiteral",
"span": {
"start": 749,
"end": 757,
"ctxt": 0
},
"value": "string",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 761,
"end": 796,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 765,
"end": 795,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 765,
"end": 773,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 766,
"end": 772,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 766,
"end": 768,
"ctxt": 0
},
"value": "b4",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 771,
"end": 772,
"ctxt": 0
},
"value": 1.0
}
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 773,
"end": 778,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 775,
"end": 778,
"ctxt": 0
},
"kind": "any"
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 781,
"end": 795,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 783,
"end": 785,
"ctxt": 0
},
"value": "b4",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 787,
"end": 793,
"ctxt": 0
},
"value": 100000.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 797,
"end": 835,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 801,
"end": 834,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 801,
"end": 816,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "Identifier",
"span": {
"start": 802,
"end": 804,
"ctxt": 0
},
"value": "b5",
"optional": false
},
"value": {
"type": "ObjectPattern",
"span": {
"start": 806,
"end": 813,
"ctxt": 0
},
"properties": [
{
"type": "AssignmentPatternProperty",
"span": {
"start": 808,
"end": 811,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 808,
"end": 811,
"ctxt": 0
},
"value": "b52",
"optional": false
},
"value": null
}
],
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 819,
"end": 834,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 821,
"end": 823,
"ctxt": 0
},
"value": "b5",
"optional": false
},
"value": {
"type": "ObjectExpression",
"span": {
"start": 825,
"end": 832,
"ctxt": 0
},
"properties": [
{
"type": "Identifier",
"span": {
"start": 827,
"end": 830,
"ctxt": 0
},
"value": "b52",
"optional": false
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1067,
"end": 1110,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1077,
"end": 1078,
"ctxt": 0
},
"value": "F",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1079,
"end": 1110,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 1086,
"end": 1097,
"ctxt": 0
},
"value": "idx",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1089,
"end": 1097,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1091,
"end": 1097,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1098,
"end": 1107,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1100,
"end": 1107,
"ctxt": 0
},
"kind": "boolean"
}
},
"readonly": false,
"static": false,
"span": {
"start": 1085,
"end": 1108,
"ctxt": 0
}
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1121,
"end": 1124,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1112,
"end": 1169,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1130,
"end": 1169,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1136,
"end": 1167,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 1143,
"end": 1166,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 1153,
"end": 1154,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 1156,
"end": 1160,
"ctxt": 0
},
"value": true
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1126,
"end": 1129,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1128,
"end": 1129,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1128,
"end": 1129,
"ctxt": 0
},
"value": "F",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1180,
"end": 1183,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1171,
"end": 1228,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1189,
"end": 1228,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1195,
"end": 1226,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 1202,
"end": 1225,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 1212,
"end": 1213,
"ctxt": 0
},
"value": 2.0
},
"value": {
"type": "BooleanLiteral",
"span": {
"start": 1215,
"end": 1219,
"ctxt": 0
},
"value": true
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1185,
"end": 1188,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1187,
"end": 1188,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1187,
"end": 1188,
"ctxt": 0
},
"value": "F",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1229,
"end": 1249,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1233,
"end": 1248,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 1233,
"end": 1240,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 1234,
"end": 1235,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "Identifier",
"span": {
"start": 1237,
"end": 1239,
"ctxt": 0
},
"value": "c0",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 1243,
"end": 1248,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1243,
"end": 1246,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1250,
"end": 1270,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1254,
"end": 1269,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 1254,
"end": 1261,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "NumericLiteral",
"span": {
"start": 1255,
"end": 1256,
"ctxt": 0
},
"value": 1.0
},
"value": {
"type": "Identifier",
"span": {
"start": 1258,
"end": 1260,
"ctxt": 0
},
"value": "c1",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 1264,
"end": 1269,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1264,
"end": 1267,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1445,
"end": 1488,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1455,
"end": 1457,
"ctxt": 0
},
"value": "F1",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1458,
"end": 1488,
"ctxt": 0
},
"body": [
{
"type": "TsIndexSignature",
"params": [
{
"type": "Identifier",
"span": {
"start": 1465,
"end": 1476,
"ctxt": 0
},
"value": "str",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1468,
"end": 1476,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1470,
"end": 1476,
"ctxt": 0
},
"kind": "string"
}
}
}
],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1477,
"end": 1485,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 1479,
"end": 1485,
"ctxt": 0
},
"kind": "number"
}
},
"readonly": false,
"static": false,
"span": {
"start": 1464,
"end": 1486,
"ctxt": 0
}
}
]
}
},
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 1499,
"end": 1503,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"declare": false,
"params": [],
"decorators": [],
"span": {
"start": 1490,
"end": 1551,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 1510,
"end": 1551,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 1516,
"end": 1549,
"ctxt": 0
},
"argument": {
"type": "ObjectExpression",
"span": {
"start": 1523,
"end": 1549,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "StringLiteral",
"span": {
"start": 1533,
"end": 1540,
"ctxt": 0
},
"value": "prop1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 1542,
"end": 1543,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 1505,
"end": 1509,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1507,
"end": 1509,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1507,
"end": 1509,
"ctxt": 0
},
"value": "F1",
"optional": false
},
"typeParams": null
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1553,
"end": 1580,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1557,
"end": 1579,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 1557,
"end": 1570,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "StringLiteral",
"span": {
"start": 1558,
"end": 1565,
"ctxt": 0
},
"value": "prop1",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"value": {
"type": "Identifier",
"span": {
"start": 1567,
"end": 1569,
"ctxt": 0
},
"value": "d1",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 1573,
"end": 1579,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1573,
"end": 1577,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1581,
"end": 1608,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1585,
"end": 1607,
"ctxt": 0
},
"id": {
"type": "ObjectPattern",
"span": {
"start": 1585,
"end": 1598,
"ctxt": 0
},
"properties": [
{
"type": "KeyValuePatternProperty",
"key": {
"type": "StringLiteral",
"span": {
"start": 1586,
"end": 1593,
"ctxt": 0
},
"value": "prop2",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
},
"value": {
"type": "Identifier",
"span": {
"start": 1595,
"end": 1597,
"ctxt": 0
},
"value": "d1",
"optional": false,
"typeAnnotation": null
}
}
],
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 1601,
"end": 1607,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 1601,
"end": 1605,
"ctxt": 0
},
"value": "foo1",
"optional": false
},
"arguments": [],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}