---
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/ssa-objectexpression-phi.js
---
Input:
function foo() {
  let x = 1;
  let y = 2;

  if (x > 1) {
    x = 2;
  } else {
    y = 3;
  }

  let t = { x: x, y: y };
  return t;
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "foo",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          9,
          12
        ]
      },
      "params": [],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    23,
                    24
                  ]
                },
                "init": {
                  "type": "NumericLiteral",
                  "value": 1.0,
                  "loc": null,
                  "range": [
                    27,
                    28
                  ]
                },
                "loc": null,
                "range": [
                  23,
                  28
                ]
              }
            ],
            "loc": null,
            "range": [
              19,
              29
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "y",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    36,
                    37
                  ]
                },
                "init": {
                  "type": "NumericLiteral",
                  "value": 2.0,
                  "loc": null,
                  "range": [
                    40,
                    41
                  ]
                },
                "loc": null,
                "range": [
                  36,
                  41
                ]
              }
            ],
            "loc": null,
            "range": [
              32,
              42
            ]
          },
          {
            "type": "IfStatement",
            "test": {
              "type": "BinaryExpression",
              "left": {
                "type": "Identifier",
                "name": "x",
                "typeAnnotation": null,
                "loc": null,
                "range": [
                  50,
                  51
                ]
              },
              "operator": ">",
              "right": {
                "type": "NumericLiteral",
                "value": 1.0,
                "loc": null,
                "range": [
                  54,
                  55
                ]
              },
              "loc": null,
              "range": [
                50,
                55
              ]
            },
            "consequent": {
              "type": "BlockStatement",
              "body": [
                {
                  "type": "ExpressionStatement",
                  "expression": {
                    "type": "AssignmentExpression",
                    "operator": "=",
                    "left": {
                      "type": "Identifier",
                      "name": "x",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        63,
                        64
                      ]
                    },
                    "right": {
                      "type": "NumericLiteral",
                      "value": 2.0,
                      "loc": null,
                      "range": [
                        67,
                        68
                      ]
                    },
                    "loc": null,
                    "range": [
                      63,
                      68
                    ]
                  },
                  "directive": null,
                  "loc": null,
                  "range": [
                    63,
                    69
                  ]
                }
              ],
              "loc": null,
              "range": [
                57,
                73
              ]
            },
            "alternate": {
              "type": "BlockStatement",
              "body": [
                {
                  "type": "ExpressionStatement",
                  "expression": {
                    "type": "AssignmentExpression",
                    "operator": "=",
                    "left": {
                      "type": "Identifier",
                      "name": "y",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        85,
                        86
                      ]
                    },
                    "right": {
                      "type": "NumericLiteral",
                      "value": 3.0,
                      "loc": null,
                      "range": [
                        89,
                        90
                      ]
                    },
                    "loc": null,
                    "range": [
                      85,
                      90
                    ]
                  },
                  "directive": null,
                  "loc": null,
                  "range": [
                    85,
                    91
                  ]
                }
              ],
              "loc": null,
              "range": [
                79,
                95
              ]
            },
            "loc": null,
            "range": [
              46,
              95
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "t",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    103,
                    104
                  ]
                },
                "init": {
                  "type": "ObjectExpression",
                  "properties": [
                    {
                      "type": "Property",
                      "key": {
                        "type": "Identifier",
                        "name": "x",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          109,
                          110
                        ]
                      },
                      "value": {
                        "type": "Identifier",
                        "name": "x",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          112,
                          113
                        ]
                      },
                      "kind": "init",
                      "method": false,
                      "shorthand": false,
                      "computed": false,
                      "loc": null,
                      "range": [
                        109,
                        113
                      ]
                    },
                    {
                      "type": "Property",
                      "key": {
                        "type": "Identifier",
                        "name": "y",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          115,
                          116
                        ]
                      },
                      "value": {
                        "type": "Identifier",
                        "name": "y",
                        "typeAnnotation": null,
                        "loc": null,
                        "range": [
                          118,
                          119
                        ]
                      },
                      "kind": "init",
                      "method": false,
                      "shorthand": false,
                      "computed": false,
                      "loc": null,
                      "range": [
                        115,
                        119
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    107,
                    121
                  ]
                },
                "loc": null,
                "range": [
                  103,
                  121
                ]
              }
            ],
            "loc": null,
            "range": [
              99,
              122
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "Identifier",
              "name": "t",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                132,
                133
              ]
            },
            "loc": null,
            "range": [
              125,
              134
            ]
          }
        ],
        "loc": null,
        "range": [
          15,
          136
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        136
      ],
      "loc": null,
      "range": [
        0,
        136
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    136
  ]
}
