Skip to content

Commit

Permalink
Update test refs
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Mar 18, 2024
1 parent 4c40a7e commit f91a0c3
Show file tree
Hide file tree
Showing 2 changed files with 708 additions and 0 deletions.
354 changes: 354 additions & 0 deletions crates/swc_ecma_parser/tests/typescript/issue-8735/1/input.ts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,354 @@
{
"type": "Script",
"span": {
"start": 1,
"end": 151,
"ctxt": 0
},
"body": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 10,
"end": 25,
"ctxt": 0
},
"value": "getFirstElement",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 29,
"end": 39,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 29,
"end": 39,
"ctxt": 0
},
"value": "array",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 34,
"end": 39,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsArrayType",
"span": {
"start": 36,
"end": 39,
"ctxt": 0
},
"elemType": {
"type": "TsTypeReference",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 36,
"end": 37,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
}
],
"decorators": [],
"span": {
"start": 1,
"end": 101,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 51,
"end": 101,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 57,
"end": 99,
"ctxt": 0
},
"argument": {
"type": "ConditionalExpression",
"span": {
"start": 64,
"end": 98,
"ctxt": 0
},
"test": {
"type": "BinaryExpression",
"span": {
"start": 64,
"end": 80,
"ctxt": 0
},
"operator": ">",
"left": {
"type": "MemberExpression",
"span": {
"start": 64,
"end": 76,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 64,
"end": 69,
"ctxt": 0
},
"value": "array",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 70,
"end": 76,
"ctxt": 0
},
"value": "length",
"optional": false
}
},
"right": {
"type": "NumericLiteral",
"span": {
"start": 79,
"end": 80,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
},
"consequent": {
"type": "MemberExpression",
"span": {
"start": 83,
"end": 91,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 83,
"end": 88,
"ctxt": 0
},
"value": "array",
"optional": false
},
"property": {
"type": "Computed",
"span": {
"start": 88,
"end": 91,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": 0.0,
"raw": "0"
}
}
},
"alternate": {
"type": "NullLiteral",
"span": {
"start": 94,
"end": 98,
"ctxt": 0
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 25,
"end": 28,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"value": "T",
"optional": false
},
"in": false,
"out": false,
"const": false,
"constraint": null,
"default": null
}
]
},
"returnType": {
"type": "TsTypeAnnotation",
"span": {
"start": 40,
"end": 50,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsUnionType",
"span": {
"start": 42,
"end": 50,
"ctxt": 0
},
"types": [
{
"type": "TsTypeReference",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 42,
"end": 43,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
{
"type": "TsKeywordType",
"span": {
"start": 46,
"end": 50,
"ctxt": 0
},
"kind": "null"
}
]
}
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 103,
"end": 151,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 107,
"end": 146,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 107,
"end": 117,
"ctxt": 0
},
"value": "myFunction",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 120,
"end": 146,
"ctxt": 0
},
"expression": {
"type": "Identifier",
"span": {
"start": 120,
"end": 135,
"ctxt": 0
},
"value": "getFirstElement",
"optional": false
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 144,
"end": 146,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 144,
"end": 146,
"ctxt": 0
},
"value": "as",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}
Loading

0 comments on commit f91a0c3

Please sign in to comment.