---
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/update-expression.js
---
Input:
function foo(props) {
  let x = props.x;
  let y = x++;
  let z = x--;
  return { x, y, z };
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "foo",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          9,
          12
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            13,
            18
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    28,
                    29
                  ]
                },
                "init": {
                  "type": "MemberExpression",
                  "object": {
                    "type": "Identifier",
                    "name": "props",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      32,
                      37
                    ]
                  },
                  "property": {
                    "type": "Identifier",
                    "name": "x",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      38,
                      39
                    ]
                  },
                  "computed": false,
                  "loc": null,
                  "range": [
                    32,
                    39
                  ]
                },
                "loc": null,
                "range": [
                  28,
                  39
                ]
              }
            ],
            "loc": null,
            "range": [
              24,
              40
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "y",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    47,
                    48
                  ]
                },
                "init": {
                  "type": "UpdateExpression",
                  "operator": "++",
                  "argument": {
                    "type": "Identifier",
                    "name": "x",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      51,
                      52
                    ]
                  },
                  "prefix": false,
                  "loc": null,
                  "range": [
                    51,
                    54
                  ]
                },
                "loc": null,
                "range": [
                  47,
                  54
                ]
              }
            ],
            "loc": null,
            "range": [
              43,
              55
            ]
          },
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "z",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    62,
                    63
                  ]
                },
                "init": {
                  "type": "UpdateExpression",
                  "operator": "--",
                  "argument": {
                    "type": "Identifier",
                    "name": "x",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      66,
                      67
                    ]
                  },
                  "prefix": false,
                  "loc": null,
                  "range": [
                    66,
                    69
                  ]
                },
                "loc": null,
                "range": [
                  62,
                  69
                ]
              }
            ],
            "loc": null,
            "range": [
              58,
              70
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "ObjectExpression",
              "properties": [
                {
                  "type": "Property",
                  "key": {
                    "type": "Identifier",
                    "name": "x",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      82,
                      83
                    ]
                  },
                  "value": {
                    "type": "Identifier",
                    "name": "x",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      82,
                      83
                    ]
                  },
                  "kind": "init",
                  "method": false,
                  "shorthand": true,
                  "computed": false,
                  "loc": null,
                  "range": [
                    82,
                    83
                  ]
                },
                {
                  "type": "Property",
                  "key": {
                    "type": "Identifier",
                    "name": "y",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      85,
                      86
                    ]
                  },
                  "value": {
                    "type": "Identifier",
                    "name": "y",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      85,
                      86
                    ]
                  },
                  "kind": "init",
                  "method": false,
                  "shorthand": true,
                  "computed": false,
                  "loc": null,
                  "range": [
                    85,
                    86
                  ]
                },
                {
                  "type": "Property",
                  "key": {
                    "type": "Identifier",
                    "name": "z",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      88,
                      89
                    ]
                  },
                  "value": {
                    "type": "Identifier",
                    "name": "z",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      88,
                      89
                    ]
                  },
                  "kind": "init",
                  "method": false,
                  "shorthand": true,
                  "computed": false,
                  "loc": null,
                  "range": [
                    88,
                    89
                  ]
                }
              ],
              "loc": null,
              "range": [
                80,
                91
              ]
            },
            "loc": null,
            "range": [
              73,
              92
            ]
          }
        ],
        "loc": null,
        "range": [
          20,
          94
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        94
      ],
      "loc": null,
      "range": [
        0,
        94
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    94
  ]
}
