swc/crates/swc_ecma_parser/tests/tsc/tsxSpreadAttributesResolution10.json
2022-02-04 17:08:38 +09:00

928 lines
23 KiB
JSON

{
"type": "Module",
"span": {
"start": 115,
"end": 487,
"ctxt": 0
},
"body": [
{
"type": "TsImportEqualsDeclaration",
"span": {
"start": 115,
"end": 147,
"ctxt": 0
},
"declare": false,
"isExport": false,
"isTypeOnly": false,
"id": {
"type": "Identifier",
"span": {
"start": 122,
"end": 127,
"ctxt": 0
},
"value": "React",
"optional": false
},
"moduleRef": {
"type": "TsExternalModuleReference",
"span": {
"start": 130,
"end": 146,
"ctxt": 0
},
"expression": {
"type": "StringLiteral",
"span": {
"start": 138,
"end": 145,
"ctxt": 0
},
"value": "react",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
},
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 149,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 159,
"end": 169,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 170,
"end": 183,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 176,
"end": 181,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 176,
"end": 177,
"ctxt": 0
},
"value": "x",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 178,
"end": 181,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsLiteralType",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"literal": {
"type": "NumericLiteral",
"span": {
"start": 180,
"end": 181,
"ctxt": 0
},
"value": 2.0
}
}
},
"typeParams": null
}
]
}
},
{
"type": "ClassDeclaration",
"identifier": {
"type": "Identifier",
"span": {
"start": 191,
"end": 194,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"declare": false,
"span": {
"start": 185,
"end": 292,
"ctxt": 0
},
"decorators": [],
"body": [
{
"type": "ClassMethod",
"span": {
"start": 241,
"end": 290,
"ctxt": 0
},
"key": {
"type": "Identifier",
"span": {
"start": 241,
"end": 247,
"ctxt": 0
},
"value": "render",
"optional": false
},
"function": {
"params": [],
"decorators": [],
"span": {
"start": 241,
"end": 290,
"ctxt": 0
},
"body": {
"type": "BlockStatement",
"span": {
"start": 250,
"end": 290,
"ctxt": 0
},
"stmts": [
{
"type": "ReturnStatement",
"span": {
"start": 260,
"end": 284,
"ctxt": 0
},
"argument": {
"type": "JSXElement",
"span": {
"start": 267,
"end": 283,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 268,
"end": 271,
"ctxt": 0
},
"value": "div",
"optional": false
},
"span": {
"start": 267,
"end": 272,
"ctxt": 0
},
"attributes": [],
"selfClosing": false,
"typeArguments": null
},
"children": [
{
"type": "JSXText",
"span": {
"start": 272,
"end": 277,
"ctxt": 0
},
"value": "Hello",
"raw": "Hello"
}
],
"closing": {
"type": "JSXClosingElement",
"span": {
"start": 277,
"end": 283,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 279,
"end": 282,
"ctxt": 0
},
"value": "div",
"optional": false
}
}
}
}
]
},
"generator": false,
"async": false,
"typeParameters": null,
"returnType": null
},
"kind": "method",
"isStatic": false,
"accessibility": null,
"isAbstract": false,
"isOptional": false,
"isOverride": false
}
],
"superClass": {
"type": "MemberExpression",
"span": {
"start": 203,
"end": 218,
"ctxt": 0
},
"object": {
"type": "Identifier",
"span": {
"start": 203,
"end": 208,
"ctxt": 0
},
"value": "React",
"optional": false
},
"property": {
"type": "Identifier",
"span": {
"start": 209,
"end": 218,
"ctxt": 0
},
"value": "Component",
"optional": false
}
},
"isAbstract": false,
"typeParams": null,
"superTypeParams": {
"type": "TsTypeParameterInstantiation",
"span": {
"start": 218,
"end": 234,
"ctxt": 0
},
"params": [
{
"type": "TsTypeReference",
"span": {
"start": 219,
"end": 229,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 219,
"end": 229,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
},
{
"type": "TsTypeLiteral",
"span": {
"start": 231,
"end": 233,
"ctxt": 0
},
"members": []
}
]
},
"implements": []
},
{
"type": "VariableDeclaration",
"span": {
"start": 294,
"end": 321,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 300,
"end": 320,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 300,
"end": 303,
"ctxt": 0
},
"value": "obj",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 303,
"end": 315,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 305,
"end": 315,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 305,
"end": 315,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 318,
"end": 320,
"ctxt": 0
},
"properties": []
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 322,
"end": 359,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 328,
"end": 359,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 328,
"end": 332,
"ctxt": 0
},
"value": "obj1",
"optional": false,
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 332,
"end": 344,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 334,
"end": 344,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 334,
"end": 344,
"ctxt": 0
},
"value": "OptionProp",
"optional": false
},
"typeParams": null
}
}
},
"init": {
"type": "ObjectExpression",
"span": {
"start": 347,
"end": 359,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 353,
"end": 354,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "NumericLiteral",
"span": {
"start": 356,
"end": 357,
"ctxt": 0
},
"value": 2.0
}
}
]
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 370,
"end": 400,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 374,
"end": 399,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 374,
"end": 375,
"ctxt": 0
},
"value": "y",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 378,
"end": 399,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 379,
"end": 382,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 378,
"end": 399,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 384,
"end": 387,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 387,
"end": 390,
"ctxt": 0
},
"value": "obj",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 392,
"end": 397,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 392,
"end": 393,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 394,
"end": 397,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 395,
"end": 396,
"ctxt": 0
},
"value": 3.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 401,
"end": 434,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 405,
"end": 433,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 405,
"end": 407,
"ctxt": 0
},
"value": "y1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 410,
"end": 433,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 411,
"end": 414,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 410,
"end": 433,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 416,
"end": 419,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 419,
"end": 423,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 425,
"end": 431,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 425,
"end": 426,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 427,
"end": 431,
"ctxt": 0
},
"value": "Hi",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 435,
"end": 467,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 439,
"end": 466,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 439,
"end": 441,
"ctxt": 0
},
"value": "y2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 444,
"end": 466,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 445,
"end": 448,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 444,
"end": 466,
"ctxt": 0
},
"attributes": [
{
"type": "SpreadElement",
"spread": {
"start": 450,
"end": 453,
"ctxt": 0
},
"arguments": {
"type": "Identifier",
"span": {
"start": 453,
"end": 457,
"ctxt": 0
},
"value": "obj1",
"optional": false
}
},
{
"type": "JSXAttribute",
"span": {
"start": 459,
"end": 464,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 459,
"end": 460,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": {
"type": "JSXExpressionContainer",
"span": {
"start": 461,
"end": 464,
"ctxt": 0
},
"expression": {
"type": "NumericLiteral",
"span": {
"start": 462,
"end": 463,
"ctxt": 0
},
"value": 3.0
}
}
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 468,
"end": 487,
"ctxt": 0
},
"kind": "let",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 472,
"end": 486,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 472,
"end": 474,
"ctxt": 0
},
"value": "y3",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "JSXElement",
"span": {
"start": 477,
"end": 486,
"ctxt": 0
},
"opening": {
"type": "JSXOpeningElement",
"name": {
"type": "Identifier",
"span": {
"start": 478,
"end": 481,
"ctxt": 0
},
"value": "Opt",
"optional": false
},
"span": {
"start": 477,
"end": 486,
"ctxt": 0
},
"attributes": [
{
"type": "JSXAttribute",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"name": {
"type": "Identifier",
"span": {
"start": 482,
"end": 483,
"ctxt": 0
},
"value": "x",
"optional": false
},
"value": null
}
],
"selfClosing": true,
"typeArguments": null
},
"children": [],
"closing": null
},
"definite": false
}
]
}
],
"interpreter": null
}