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

365 lines
11 KiB
JSON

{
"type": "Script",
"span": {
"start": 15,
"end": 150,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 24,
"end": 43,
"ctxt": 0
},
"value": "takeFirstTwoEntries",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 44,
"end": 87,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "RestElement",
"span": {
"start": 44,
"end": 87,
"ctxt": 0
},
"rest": {
"start": 44,
"end": 47,
"ctxt": 0
},
"argument": {
"type": "ArrayPattern",
"span": {
"start": 47,
"end": 67,
"ctxt": 0
},
"elements": [
{
"type": "ArrayPattern",
"span": {
"start": 48,
"end": 56,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 49,
"end": 51,
"ctxt": 0
},
"value": "k1",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 53,
"end": 55,
"ctxt": 0
},
"value": "v1",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
{
"type": "ArrayPattern",
"span": {
"start": 58,
"end": 66,
"ctxt": 0
},
"elements": [
{
"type": "Identifier",
"span": {
"start": 59,
"end": 61,
"ctxt": 0
},
"value": "k2",
"optional": false,
"typeAnnotation": null
},
{
"type": "Identifier",
"span": {
"start": 63,
"end": 65,
"ctxt": 0
},
"value": "v2",
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
}
],
"optional": false,
"typeAnnotation": null
},
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 67,
"end": 87,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 69,
"end": 87,
"ctxt": 0
},
"elemType": {
"type": "TsTupleType",
"span": {
"start": 69,
"end": 85,
"ctxt": 0
},
"elemTypes": [
{
"type": "TsTupleElement",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"kind": "string"
}
},
{
"type": "TsTupleElement",
"span": {
"start": 78,
"end": 84,
"ctxt": 0
},
"label": null,
"ty": {
"type": "TsKeywordType",
"span": {
"start": 78,
"end": 84,
"ctxt": 0
},
"kind": "number"
}
}
]
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 15,
"end": 92,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 89,
"end": 92,
"ctxt": 0
},
"stmts": []
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
{
"type": "ExpressionStatement",
"span": {
"start": 93,
"end": 150,
"ctxt": 0
},
"expression": {
"type": "CallExpression",
"span": {
"start": 93,
"end": 149,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 93,
"end": 112,
"ctxt": 0
},
"value": "takeFirstTwoEntries",
"optional": false
},
"arguments": [
{
"spread": {
"start": 113,
"end": 116,
"ctxt": 0
},
"expression": {
"type": "NewExpression",
"span": {
"start": 116,
"end": 148,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 120,
"end": 123,
"ctxt": 0
},
"value": "Map",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 124,
"end": 147,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 125,
"end": 132,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 126,
"end": 128,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 130,
"end": 131,
"ctxt": 0
},
"value": 0.0
}
}
]
}
},
{
"spread": null,
"expression": {
"type": "ArrayExpression",
"span": {
"start": 134,
"end": 146,
"ctxt": 0
},
"elements": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 135,
"end": 142,
"ctxt": 0
},
"value": "hello",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"spread": null,
"expression": {
"type": "NumericLiteral",
"span": {
"start": 144,
"end": 145,
"ctxt": 0
},
"value": 1.0
}
}
]
}
}
]
}
}
],
"typeArguments": null
}
}
],
"typeArguments": null
}
}
],
"interpreter": null
}