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

1493 lines
39 KiB
JSON

{
"type": "Script",
"span": {
"start": 703,
"end": 2002,
"ctxt": 0
},
"body": [
{
"type": "VariableDeclaration",
"span": {
"start": 703,
"end": 732,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 707,
"end": 731,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 707,
"end": 709,
"ctxt": 0
},
"value": "a0",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 709,
"end": 726,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 711,
"end": 726,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 712,
"end": 715,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 712,
"end": 715,
"ctxt": 0
},
"kind": "any"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 717,
"end": 720,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 717,
"end": 720,
"ctxt": 0
},
"kind": "any"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 722,
"end": 725,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 722,
"end": 725,
"ctxt": 0
},
"kind": "any"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 729,
"end": 731,
"ctxt": 0
},
"elements": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 770,
"end": 826,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 774,
"end": 825,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 774,
"end": 776,
"ctxt": 0
},
"value": "a1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 776,
"end": 803,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 778,
"end": 803,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 779,
"end": 786,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 779,
"end": 786,
"ctxt": 0
},
"kind": "boolean"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 788,
"end": 794,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 788,
"end": 794,
"ctxt": 0
},
"kind": "string"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 796,
"end": 802,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 796,
"end": 802,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 806,
"end": 825,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 807,
"end": 815,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 817,
"end": 818,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 820,
"end": 824,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1155,
"end": 1211,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1159,
"end": 1210,
"ctxt": 0
},
"id": {
"type": "ArrayPattern",
"span": {
"start": 1159,
"end": 1167,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 1160,
"end": 1162,
"ctxt": 0
},
"value": "b1",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 1164,
"end": 1166,
"ctxt": 0
},
"value": "b2",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1167,
"end": 1185,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 1169,
"end": 1185,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 1170,
"end": 1176,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 1170,
"end": 1176,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 1178,
"end": 1184,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 1178,
"end": 1184,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1188,
"end": 1210,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1189,
"end": 1190,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1192,
"end": 1193,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1195,
"end": 1203,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
},
{
"spread": null,
"expression": {
"type": "BooleanLiteral",
"span": {
"start": 1205,
"end": 1209,
"ctxt": 0
},
"value": true
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1509,
"end": 1536,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1513,
"end": 1535,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1513,
"end": 1517,
"ctxt": 0
},
"value": "temp",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1520,
"end": 1535,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1521,
"end": 1524,
"ctxt": 0
},
"value": "s",
"raw": "\"s\""
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1526,
"end": 1529,
"ctxt": 0
},
"value": "t",
"raw": "\"t\""
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1531,
"end": 1534,
"ctxt": 0
},
"value": "r",
"raw": "\"r\""
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1537,
"end": 1559,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1541,
"end": 1558,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1541,
"end": 1546,
"ctxt": 0
},
"value": "temp1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1549,
"end": 1558,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1550,
"end": 1551,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1553,
"end": 1554,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1556,
"end": 1557,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1560,
"end": 1627,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1564,
"end": 1626,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1564,
"end": 1569,
"ctxt": 0
},
"value": "temp2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1569,
"end": 1591,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 1571,
"end": 1591,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 1572,
"end": 1580,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsArrayType",
"span": {
"start": 1572,
"end": 1580,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1572,
"end": 1578,
"ctxt": 0
},
"kind": "number"
}
}
},
{
"type": "TsTupleElement",
"span": {
"start": 1582,
"end": 1590,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsArrayType",
"span": {
"start": 1582,
"end": 1590,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1582,
"end": 1588,
"ctxt": 0
},
"kind": "string"
}
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1594,
"end": 1626,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 1595,
"end": 1604,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1596,
"end": 1597,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1599,
"end": 1600,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 1602,
"end": 1603,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
}
]
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 1606,
"end": 1625,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1607,
"end": 1614,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
},
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 1616,
"end": 1624,
"ctxt": 0
},
"value": "string",
"raw": "\"string\""
}
}
]
}
}
]
},
"definite": false
}
]
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1629,
"end": 1698,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1639,
"end": 1642,
"ctxt": 0
},
"value": "tup",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1643,
"end": 1698,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 1649,
"end": 1670,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 1649,
"end": 1650,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1650,
"end": 1669,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1652,
"end": 1669,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 1652,
"end": 1660,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1652,
"end": 1658,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsArrayType",
"span": {
"start": 1661,
"end": 1669,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1661,
"end": 1667,
"ctxt": 0
},
"kind": "string"
}
}
]
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 1675,
"end": 1696,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "NumericLiteral",
"span": {
"start": 1675,
"end": 1676,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1676,
"end": 1695,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 1678,
"end": 1695,
"ctxt": 0
},
"types": [
{
"type": "TsArrayType",
"span": {
"start": 1678,
"end": 1686,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1678,
"end": 1684,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsArrayType",
"span": {
"start": 1687,
"end": 1695,
"ctxt": 0
},
"elemType": {
"type": "TsKeywordType",
"span": {
"start": 1687,
"end": 1693,
"ctxt": 0
},
"kind": "string"
}
}
]
}
},
"typeParams": null
}
]
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1699,
"end": 1742,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1709,
"end": 1716,
"ctxt": 0
},
"value": "myArray",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 1725,
"end": 1738,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1725,
"end": 1730,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1730,
"end": 1738,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 1731,
"end": 1737,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1731,
"end": 1737,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
}
]
}
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1739,
"end": 1742,
"ctxt": 0
},
"body": []
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 1743,
"end": 1794,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1753,
"end": 1761,
"ctxt": 0
},
"value": "myArray2",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [
{
"type": "TsExpressionWithTypeArguments",
"span": {
"start": 1770,
"end": 1790,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1770,
"end": 1775,
"ctxt": 0
},
"value": "Array",
"optional": false
},
"typeArguments": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 1775,
"end": 1790,
"ctxt": 0
},
"params": [
{
"type": "TsUnionType",
"span": {
"start": 1776,
"end": 1789,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 1776,
"end": 1782,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1776,
"end": 1782,
"ctxt": 0
},
"value": "Number",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeReference",
"span": {
"start": 1783,
"end": 1789,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1783,
"end": 1789,
"ctxt": 0
},
"value": "String",
"optional": false
},
"typeParams": null
}
]
}
]
}
}
],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 1791,
"end": 1794,
"ctxt": 0
},
"body": []
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 1795,
"end": 1820,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1799,
"end": 1819,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1799,
"end": 1801,
"ctxt": 0
},
"value": "c0",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1801,
"end": 1806,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1803,
"end": 1806,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1803,
"end": 1806,
"ctxt": 0
},
"value": "tup",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1809,
"end": 1819,
"ctxt": 0
},
"elements": [
{
"spread": {
"start": 1810,
"end": 1813,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1813,
"end": 1818,
"ctxt": 0
},
"value": "temp2",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1854,
"end": 1900,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1858,
"end": 1899,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1858,
"end": 1860,
"ctxt": 0
},
"value": "c1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1860,
"end": 1886,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTupleType",
"span": {
"start": 1862,
"end": 1886,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 1863,
"end": 1869,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 1863,
"end": 1869,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 1871,
"end": 1877,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 1871,
"end": 1877,
"ctxt": 0
},
"kind": "number"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 1879,
"end": 1885,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 1879,
"end": 1885,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1889,
"end": 1899,
"ctxt": 0
},
"elements": [
{
"spread": {
"start": 1890,
"end": 1893,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1893,
"end": 1898,
"ctxt": 0
},
"value": "temp1",
"optional": false
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 1964,
"end": 2002,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 1968,
"end": 2001,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 1968,
"end": 1970,
"ctxt": 0
},
"value": "c2",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 1970,
"end": 1979,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 1972,
"end": 1979,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 1972,
"end": 1979,
"ctxt": 0
},
"value": "myArray",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ArrayExpression",
"span": {
"start": 1982,
"end": 2001,
"ctxt": 0
},
"elements": [
{
"spread": {
"start": 1983,
"end": 1986,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1986,
"end": 1991,
"ctxt": 0
},
"value": "temp1",
"optional": false
}
},
{
"spread": {
"start": 1993,
"end": 1996,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 1996,
"end": 2000,
"ctxt": 0
},
"value": "temp",
"optional": false
}
}
]
},
"definite": false
}
]
}
],
"interpreter": null
}