---
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/overlapping-scopes-while.js
---
Input:
function foo(a, b, c) {
  let x = [];
  let y = [];
  while (c) {
    y.push(b);
    x.push(a);
  }
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "foo",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          9,
          12
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "a",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            13,
            14
          ]
        },
        {
          "type": "Identifier",
          "name": "b",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            16,
            17
          ]
        },
        {
          "type": "Identifier",
          "name": "c",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            19,
            20
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    30,
                    31
                  ]
                },
                "init": {
                  "type": "ArrayExpression",
                  "elements": [],
                  "loc": null,
                  "range": [
                    34,
                    36
                  ]
                },
                "loc": null,
                "range": [
                  30,
                  36
                ]
              }
            ],
            "loc": null,
            "range": [
              26,
              37
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "y",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    44,
                    45
                  ]
                },
                "init": {
                  "type": "ArrayExpression",
                  "elements": [],
                  "loc": null,
                  "range": [
                    48,
                    50
                  ]
                },
                "loc": null,
                "range": [
                  44,
                  50
                ]
              }
            ],
            "loc": null,
            "range": [
              40,
              51
            ]
          },
          {
            "type": "WhileStatement",
            "test": {
              "type": "Identifier",
              "name": "c",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                61,
                62
              ]
            },
            "body": {
              "type": "BlockStatement",
              "body": [
                {
                  "type": "ExpressionStatement",
                  "expression": {
                    "type": "CallExpression",
                    "callee": {
                      "type": "MemberExpression",
                      "object": {
                        "type": "Identifier",
                        "name": "y",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          70,
                          71
                        ]
                      },
                      "property": {
                        "type": "Identifier",
                        "name": "push",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          72,
                          76
                        ]
                      },
                      "computed": false,
                      "loc": null,
                      "range": [
                        70,
                        76
                      ]
                    },
                    "arguments": [
                      {
                        "type": "Identifier",
                        "name": "b",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          77,
                          78
                        ]
                      }
                    ],
                    "loc": null,
                    "range": [
                      70,
                      79
                    ]
                  },
                  "directive": null,
                  "loc": null,
                  "range": [
                    70,
                    80
                  ]
                },
                {
                  "type": "ExpressionStatement",
                  "expression": {
                    "type": "CallExpression",
                    "callee": {
                      "type": "MemberExpression",
                      "object": {
                        "type": "Identifier",
                        "name": "x",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          85,
                          86
                        ]
                      },
                      "property": {
                        "type": "Identifier",
                        "name": "push",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          87,
                          91
                        ]
                      },
                      "computed": false,
                      "loc": null,
                      "range": [
                        85,
                        91
                      ]
                    },
                    "arguments": [
                      {
                        "type": "Identifier",
                        "name": "a",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          92,
                          93
                        ]
                      }
                    ],
                    "loc": null,
                    "range": [
                      85,
                      94
                    ]
                  },
                  "directive": null,
                  "loc": null,
                  "range": [
                    85,
                    95
                  ]
                }
              ],
              "loc": null,
              "range": [
                64,
                99
              ]
            },
            "loc": null,
            "range": [
              54,
              99
            ]
          }
        ],
        "loc": null,
        "range": [
          22,
          101
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        101
      ],
      "loc": null,
      "range": [
        0,
        101
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    101
  ]
}
