---
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/escape-analysis-not-switch-test.js
---
Input:
function Component(props) {
  const a = [props.a];
  let x = props.b;
  switch (a) {
    case true: {
      x = props.c;
    }
  }
  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": "a",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    36,
                    37
                  ]
                },
                "init": {
                  "type": "ArrayExpression",
                  "elements": [
                    {
                      "type": "MemberExpression",
                      "object": {
                        "type": "Identifier",
                        "name": "props",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          41,
                          46
                        ]
                      },
                      "property": {
                        "type": "Identifier",
                        "name": "a",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          47,
                          48
                        ]
                      },
                      "computed": false,
                      "loc": null,
                      "range": [
                        41,
                        48
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    40,
                    49
                  ]
                },
                "loc": null,
                "range": [
                  36,
                  49
                ]
              }
            ],
            "loc": null,
            "range": [
              30,
              50
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    57,
                    58
                  ]
                },
                "init": {
                  "type": "MemberExpression",
                  "object": {
                    "type": "Identifier",
                    "name": "props",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      61,
                      66
                    ]
                  },
                  "property": {
                    "type": "Identifier",
                    "name": "b",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      67,
                      68
                    ]
                  },
                  "computed": false,
                  "loc": null,
                  "range": [
                    61,
                    68
                  ]
                },
                "loc": null,
                "range": [
                  57,
                  68
                ]
              }
            ],
            "loc": null,
            "range": [
              53,
              69
            ]
          },
          {
            "type": "SwitchStatement",
            "discriminant": {
              "type": "Identifier",
              "name": "a",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                80,
                81
              ]
            },
            "cases": [
              {
                "type": "SwitchCase",
                "test": {
                  "type": "BooleanLiteral",
                  "value": true,
                  "loc": null,
                  "range": [
                    94,
                    98
                  ]
                },
                "consequent": [
                  {
                    "type": "BlockStatement",
                    "body": [
                      {
                        "type": "ExpressionStatement",
                        "expression": {
                          "type": "AssignmentExpression",
                          "operator": "=",
                          "left": {
                            "type": "Identifier",
                            "name": "x",
                            "typeAnnotation": null,
                            "loc": null,
                            "range": [
                              108,
                              109
                            ]
                          },
                          "right": {
                            "type": "MemberExpression",
                            "object": {
                              "type": "Identifier",
                              "name": "props",
                              "typeAnnotation": null,
                              "loc": null,
                              "range": [
                                112,
                                117
                              ]
                            },
                            "property": {
                              "type": "Identifier",
                              "name": "c",
                              "typeAnnotation": null,
                              "loc": null,
                              "range": [
                                118,
                                119
                              ]
                            },
                            "computed": false,
                            "loc": null,
                            "range": [
                              112,
                              119
                            ]
                          },
                          "loc": null,
                          "range": [
                            108,
                            119
                          ]
                        },
                        "directive": null,
                        "loc": null,
                        "range": [
                          108,
                          120
                        ]
                      }
                    ],
                    "loc": null,
                    "range": [
                      100,
                      126
                    ]
                  }
                ],
                "loc": null,
                "range": [
                  89,
                  126
                ]
              }
            ],
            "loc": null,
            "range": [
              72,
              130
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "Identifier",
              "name": "x",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                140,
                141
              ]
            },
            "loc": null,
            "range": [
              133,
              142
            ]
          }
        ],
        "loc": null,
        "range": [
          26,
          144
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        144
      ],
      "loc": null,
      "range": [
        0,
        144
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    144
  ]
}
