---
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-logical.js
---
Input:
function Component(props) {
  const a = [props.a];
  const b = [props.b];
  const c = [props.c];
  // We don't do constant folding for non-primitive values (yet) so we consider
  // that any of a, b, or c could return here
  return (a && b) || c;
}


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": "const",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "b",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    59,
                    60
                  ]
                },
                "init": {
                  "type": "ArrayExpression",
                  "elements": [
                    {
                      "type": "MemberExpression",
                      "object": {
                        "type": "Identifier",
                        "name": "props",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          64,
                          69
                        ]
                      },
                      "property": {
                        "type": "Identifier",
                        "name": "b",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          70,
                          71
                        ]
                      },
                      "computed": false,
                      "loc": null,
                      "range": [
                        64,
                        71
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    63,
                    72
                  ]
                },
                "loc": null,
                "range": [
                  59,
                  72
                ]
              }
            ],
            "loc": null,
            "range": [
              53,
              73
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "const",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "c",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    82,
                    83
                  ]
                },
                "init": {
                  "type": "ArrayExpression",
                  "elements": [
                    {
                      "type": "MemberExpression",
                      "object": {
                        "type": "Identifier",
                        "name": "props",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          87,
                          92
                        ]
                      },
                      "property": {
                        "type": "Identifier",
                        "name": "c",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          93,
                          94
                        ]
                      },
                      "computed": false,
                      "loc": null,
                      "range": [
                        87,
                        94
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    86,
                    95
                  ]
                },
                "loc": null,
                "range": [
                  82,
                  95
                ]
              }
            ],
            "loc": null,
            "range": [
              76,
              96
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "LogicalExpression",
              "operator": "||",
              "left": {
                "type": "LogicalExpression",
                "operator": "&&",
                "left": {
                  "type": "Identifier",
                  "name": "a",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    233,
                    234
                  ]
                },
                "right": {
                  "type": "Identifier",
                  "name": "b",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    238,
                    239
                  ]
                },
                "loc": null,
                "range": [
                  233,
                  239
                ]
              },
              "right": {
                "type": "Identifier",
                "name": "c",
                "typeAnnotation": null,
                "loc": null,
                "range": [
                  244,
                  245
                ]
              },
              "loc": null,
              "range": [
                232,
                245
              ]
            },
            "loc": null,
            "range": [
              225,
              246
            ]
          }
        ],
        "loc": null,
        "range": [
          26,
          248
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        248
      ],
      "loc": null,
      "range": [
        0,
        248
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    248
  ]
}
