---
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/error.invalid-useMemo-async-callback.js
---
Input:
function component(a, b) {
  let x = useMemo(async () => {
    await a;
  }, []);
  return x;
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "component",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          9,
          18
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "a",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            19,
            20
          ]
        },
        {
          "type": "Identifier",
          "name": "b",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            22,
            23
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "let",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "x",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    33,
                    34
                  ]
                },
                "init": {
                  "type": "CallExpression",
                  "callee": {
                    "type": "Identifier",
                    "name": "useMemo",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      37,
                      44
                    ]
                  },
                  "arguments": [
                    {
                      "type": "ArrowFunctionExpression",
                      "id": null,
                      "params": [],
                      "body": {
                        "type": "BlockStatement",
                        "body": [
                          {
                            "type": "ExpressionStatement",
                            "expression": {
                              "type": "AwaitExpression",
                              "argument": {
                                "type": "Identifier",
                                "name": "a",
                                "typeAnnotation": null,
                                "loc": null,
                                "range": [
                                  69,
                                  70
                                ]
                              },
                              "loc": null,
                              "range": [
                                63,
                                70
                              ]
                            },
                            "directive": null,
                            "loc": null,
                            "range": [
                              63,
                              71
                            ]
                          }
                        ],
                        "loc": null,
                        "range": [
                          57,
                          75
                        ]
                      },
                      "generator": false,
                      "async": true,
                      "loc": null,
                      "range": [
                        45,
                        75
                      ],
                      "expression": false,
                      "loc": null,
                      "range": [
                        45,
                        75
                      ]
                    },
                    {
                      "type": "ArrayExpression",
                      "elements": [],
                      "loc": null,
                      "range": [
                        77,
                        79
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    37,
                    80
                  ]
                },
                "loc": null,
                "range": [
                  33,
                  80
                ]
              }
            ],
            "loc": null,
            "range": [
              29,
              81
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "Identifier",
              "name": "x",
              "typeAnnotation": null,
              "loc": null,
              "range": [
                91,
                92
              ]
            },
            "loc": null,
            "range": [
              84,
              93
            ]
          }
        ],
        "loc": null,
        "range": [
          25,
          95
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        0,
        95
      ],
      "loc": null,
      "range": [
        0,
        95
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    95
  ]
}
