---
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/destructuring-property-inference.js
---
Input:
function Component(props) {
  const x = [];
  x.push(props.value);
  const { length: y } = x;
  foo(y);
  return [x, y];
}


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": [],
                  "loc": null,
                  "range": [
                    40,
                    42
                  ]
                },
                "loc": null,
                "range": [
                  36,
                  42
                ]
              }
            ],
            "loc": null,
            "range": [
              30,
              43
            ]
          },
          {
            "type": "ExpressionStatement",
            "expression": {
              "type": "CallExpression",
              "callee": {
                "type": "MemberExpression",
                "object": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    46,
                    47
                  ]
                },
                "property": {
                  "type": "Identifier",
                  "name": "push",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    48,
                    52
                  ]
                },
                "computed": false,
                "loc": null,
                "range": [
                  46,
                  52
                ]
              },
              "arguments": [
                {
                  "type": "MemberExpression",
                  "object": {
                    "type": "Identifier",
                    "name": "props",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      53,
                      58
                    ]
                  },
                  "property": {
                    "type": "Identifier",
                    "name": "value",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      59,
                      64
                    ]
                  },
                  "computed": false,
                  "loc": null,
                  "range": [
                    53,
                    64
                  ]
                }
              ],
              "loc": null,
              "range": [
                46,
                65
              ]
            },
            "directive": null,
            "loc": null,
            "range": [
              46,
              66
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "const",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "ObjectPattern",
                  "properties": [
                    {
                      "type": "Property",
                      "key": {
                        "type": "Identifier",
                        "name": "length",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          77,
                          83
                        ]
                      },
                      "value": {
                        "type": "Identifier",
                        "name": "y",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          85,
                          86
                        ]
                      },
                      "kind": "init",
                      "computed": false,
                      "shorthand": false,
                      "method": false,
                      "loc": null,
                      "range": [
                        77,
                        86
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    75,
                    88
                  ]
                },
                "init": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    91,
                    92
                  ]
                },
                "loc": null,
                "range": [
                  75,
                  92
                ]
              }
            ],
            "loc": null,
            "range": [
              69,
              93
            ]
          },
          {
            "type": "ExpressionStatement",
            "expression": {
              "type": "CallExpression",
              "callee": {
                "type": "Identifier",
                "name": "foo",
                "typeAnnotation": null,
                "loc": null,
                "range": [
                  96,
                  99
                ]
              },
              "arguments": [
                {
                  "type": "Identifier",
                  "name": "y",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    100,
                    101
                  ]
                }
              ],
              "loc": null,
              "range": [
                96,
                102
              ]
            },
            "directive": null,
            "loc": null,
            "range": [
              96,
              103
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "ArrayExpression",
              "elements": [
                {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    114,
                    115
                  ]
                },
                {
                  "type": "Identifier",
                  "name": "y",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    117,
                    118
                  ]
                }
              ],
              "loc": null,
              "range": [
                113,
                119
              ]
            },
            "loc": null,
            "range": [
              106,
              120
            ]
          }
        ],
        "loc": null,
        "range": [
          26,
          122
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        122
      ],
      "loc": null,
      "range": [
        0,
        122
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    122
  ]
}
