---
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/array-expression-spread.js
---
Input:
function Component(props) {
  const x = [0, ...props.foo, null, ...props.bar, "z"];
  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": "ArrayExpression",
                  "elements": [
                    {
                      "type": "NumericLiteral",
                      "value": 0.0,
                      "loc": null,
                      "range": [
                        41,
                        42
                      ]
                    },
                    {
                      "type": "SpreadElement",
                      "argument": {
                        "type": "MemberExpression",
                        "object": {
                          "type": "Identifier",
                          "name": "props",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            47,
                            52
                          ]
                        },
                        "property": {
                          "type": "Identifier",
                          "name": "foo",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            53,
                            56
                          ]
                        },
                        "computed": false,
                        "loc": null,
                        "range": [
                          47,
                          56
                        ]
                      },
                      "loc": null,
                      "range": [
                        44,
                        56
                      ]
                    },
                    {
                      "type": "NullLiteral",
                      "loc": null,
                      "range": [
                        58,
                        62
                      ]
                    },
                    {
                      "type": "SpreadElement",
                      "argument": {
                        "type": "MemberExpression",
                        "object": {
                          "type": "Identifier",
                          "name": "props",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            67,
                            72
                          ]
                        },
                        "property": {
                          "type": "Identifier",
                          "name": "bar",
                          "typeAnnotation": null,
                          "loc": null,
                          "range": [
                            73,
                            76
                          ]
                        },
                        "computed": false,
                        "loc": null,
                        "range": [
                          67,
                          76
                        ]
                      },
                      "loc": null,
                      "range": [
                        64,
                        76
                      ]
                    },
                    {
                      "type": "StringLiteral",
                      "value": "z",
                      "loc": null,
                      "range": [
                        78,
                        81
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    40,
                    82
                  ]
                },
                "loc": null,
                "range": [
                  36,
                  82
                ]
              }
            ],
            "loc": null,
            "range": [
              30,
              83
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "Identifier",
              "name": "x",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                93,
                94
              ]
            },
            "loc": null,
            "range": [
              86,
              95
            ]
          }
        ],
        "loc": null,
        "range": [
          26,
          97
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        97
      ],
      "loc": null,
      "range": [
        0,
        97
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    97
  ]
}
