---
source: crates/react_hermes_parser/tests/parser_test.rs
expression: "format!(\"Input:\\n{input}\\n\\nOutput:\\n{output}\")"
input_file: crates/react_hermes_parser/tests/fixtures/object-literal-spread-element.js
---
Input:
function Component(props) {
  const x = { ...props.foo };
  return x;
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "Component",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          9,
          18
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            19,
            24
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "const",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    36,
                    37
                  ]
                },
                "init": {
                  "type": "ObjectExpression",
                  "properties": [
                    {
                      "type": "SpreadElement",
                      "argument": {
                        "type": "MemberExpression",
                        "object": {
                          "type": "Identifier",
                          "name": "props",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            45,
                            50
                          ]
                        },
                        "property": {
                          "type": "Identifier",
                          "name": "foo",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            51,
                            54
                          ]
                        },
                        "computed": false,
                        "loc": null,
                        "range": [
                          45,
                          54
                        ]
                      },
                      "loc": null,
                      "range": [
                        42,
                        54
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    40,
                    56
                  ]
                },
                "loc": null,
                "range": [
                  36,
                  56
                ]
              }
            ],
            "loc": null,
            "range": [
              30,
              57
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "Identifier",
              "name": "x",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                67,
                68
              ]
            },
            "loc": null,
            "range": [
              60,
              69
            ]
          }
        ],
        "loc": null,
        "range": [
          26,
          71
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        71
      ],
      "loc": null,
      "range": [
        0,
        71
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    71
  ]
}
