swc/crates/swc_ecma_parser/tests/tsc/wrappedAndRecursiveConstraints3.json
2022-02-04 20:17:42 +09:00

851 lines
25 KiB
JSON

{
"type": "Script",
"span": {
"start": 23,
"end": 327,
"ctxt": 0
},
"body": [
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 29,
"end": 30,
"ctxt": 0
},
"value": "C",
"optional": false
},
"declare": false,
"span": {
"start": 23,
"end": 219,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "Constructor",
"span": {
"start": 67,
"end": 88,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 67,
"end": 78,
"ctxt": 0
},
"value": "constructor",
"optional": false
},
"params": [
{
"type": "Parameter",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 79,
"end": 83,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 80,
"end": 83,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 82,
"end": 83,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
}
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 85,
"end": 88,
"ctxt": 0
},
"stmts": []
},
"accessibility": null,
"isOptional": false
},
{
"type": "ClassMethod",
"span": {
"start": 93,
"end": 217,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 93,
"end": 96,
"ctxt": 0
},
"value": "foo",
"optional": false
},
"function": {
"params": [
{
"type": "Parameter",
"span": {
"start": 110,
"end": 114,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 110,
"end": 114,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 111,
"end": 114,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 113,
"end": 114,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 93,
"end": 217,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 116,
"end": 217,
"ctxt": 0
},
"stmts": [
{
"type": "FunctionDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 135,
"end": 138,
"ctxt": 0
},
"value": "bar",
"optional": false
},
"declare": false,
"params": [
{
"type": "Parameter",
"span": {
"start": 152,
"end": 156,
"ctxt": 0
},
"decorators": [],
"pat": {
"type": "Identifier",
"span": {
"start": 152,
"end": 156,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 155,
"end": 156,
"ctxt": 0
},
"value": "V",
"optional": false
},
"typeParams": null
}
}
}
}
],
"decorators": [],
"span": {
"start": 126,
"end": 191,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 158,
"end": 191,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 172,
"end": 181,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 179,
"end": 180,
"ctxt": 0
},
"value": "x",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 138,
"end": 151,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 139,
"end": 150,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 139,
"end": 140,
"ctxt": 0
},
"value": "V",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 149,
"end": 150,
"ctxt": 0
},
"value": "U",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
},
{
"type": "ReturnStatement",
"span": {
"start": 200,
"end": 211,
"ctxt": 0
},
"argument": {
"type": "Identifier",
"span": {
"start": 207,
"end": 210,
"ctxt": 0
},
"value": "bar",
"optional": false
}
}
]
},
"generator": false,
"async": false,
"typeParameters": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 96,
"end": 109,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 97,
"end": 108,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 97,
"end": 98,
"ctxt": 0
},
"value": "U",
"optional": false
},
"constraint": {
"type": "TsTypeReference",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 107,
"end": 108,
"ctxt": 0
},
"value": "T",
"optional": false
},
"typeParams": null
},
"default": null
}
]
},
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": null,
"isAbstract": false,
"typeParams": {
"type": "TsTypeParameterDeclaration",
"span": {
"start": 30,
"end": 60,
"ctxt": 0
},
"parameters": [
{
"type": "TsTypeParameter",
"span": {
"start": 31,
"end": 59,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": "T",
"optional": false
},
"constraint": {
"type": "TsTypeLiteral",
"span": {
"start": 41,
"end": 59,
"ctxt": 0
},
"members": [
{
"type": "TsPropertySignature",
"span": {
"start": 43,
"end": 57,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 43,
"end": 49,
"ctxt": 0
},
"value": "length",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 49,
"end": 57,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 51,
"end": 57,
"ctxt": 0
},
"kind": "number"
}
},
"typeParams": null
}
]
},
"default": null
}
]
},
"superTypeParams": null,
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 221,
"end": 250,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 225,
"end": 249,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 225,
"end": 226,
"ctxt": 0
},
"value": "c",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "NewExpression",
"span": {
"start": 229,
"end": 249,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 233,
"end": 234,
"ctxt": 0
},
"value": "C",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 235,
"end": 248,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 237,
"end": 243,
"ctxt": 0
},
"value": "length",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 245,
"end": 246,
"ctxt": 0
},
"value": 2.0
}
}
]
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 251,
"end": 311,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 255,
"end": 310,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 255,
"end": 256,
"ctxt": 0
},
"value": "r",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 259,
"end": 310,
"ctxt": 0
},
"callee": {
"type": "MemberExpression",
"span": {
"start": 259,
"end": 264,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 259,
"end": 260,
"ctxt": 0
},
"value": "c",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 261,
"end": 264,
"ctxt": 0
},
"value": "foo",
"optional": false
}
},
"arguments": [
{
"spread": null,
"expression": {
"type": "ObjectExpression",
"span": {
"start": 265,
"end": 309,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 267,
"end": 273,
"ctxt": 0
},
"value": "length",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 275,
"end": 276,
"ctxt": 0
},
"value": 3.0
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 278,
"end": 284,
"ctxt": 0
},
"value": "charAt",
"optional": false
},
"value": {
"type": "ArrowFunctionExpression",
"span": {
"start": 286,
"end": 307,
"ctxt": 0
},
"params": [
{
"type": "Identifier",
"span": {
"start": 287,
"end": 296,
"ctxt": 0
},
"value": "x",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 288,
"end": 296,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 290,
"end": 296,
"ctxt": 0
},
"kind": "number"
}
}
}
],
"body": {
"type": "BlockStatement",
"span": {
"start": 301,
"end": 307,
"ctxt": 0
},
"stmts": [
{
"type": "ExpressionStatement",
"span": {
"start": 303,
"end": 305,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 303,
"end": 305,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"async": false,
"generator": false,
"typeParameters": null,
"returnType": null
}
}
]
}
}
],
"typeArguments": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 312,
"end": 327,
"ctxt": 0
},
"kind": "var",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 316,
"end": 326,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 316,
"end": 318,
"ctxt": 0
},
"value": "r2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "CallExpression",
"span": {
"start": 321,
"end": 326,
"ctxt": 0
},
"callee": {
"type": "Identifier",
"span": {
"start": 321,
"end": 322,
"ctxt": 0
},
"value": "r",
"optional": false
},
"arguments": [
{
"spread": null,
"expression": {
"type": "StringLiteral",
"span": {
"start": 323,
"end": 325,
"ctxt": 0
},
"value": "",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"typeArguments": null
},
"definite": false
}
]
}
],
"interpreter": null
}