---
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/gating-test.js
---
Input:
// @gating @compilationMode(annotation)
function Bar(props) {
  "use forget";
  return <div>{props.bar}</div>;
}

function NoForget(props) {
  return <Bar>{props.noForget}</Bar>;
}

function Foo(props) {
  "use forget";
  return <Foo>{props.bar}</Foo>;
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "Bar",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          49,
          52
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            53,
            58
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "ExpressionStatement",
            "expression": {
              "type": "StringLiteral",
              "value": "use forget",
              "loc": null,
              "range": [
                64,
                76
              ]
            },
            "directive": null,
            "loc": null,
            "range": [
              64,
              77
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "JSXElement",
              "openingElement": {
                "type": "JSXOpeningElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "div",
                  "loc": null,
                  "range": [
                    88,
                    91
                  ]
                },
                "attributes": [],
                "selfClosing": false,
                "loc": null,
                "range": [
                  87,
                  92
                ]
              },
              "children": [
                {
                  "type": "JSXExpressionContainer",
                  "expression": {
                    "type": "MemberExpression",
                    "object": {
                      "type": "Identifier",
                      "name": "props",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        93,
                        98
                      ]
                    },
                    "property": {
                      "type": "Identifier",
                      "name": "bar",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        99,
                        102
                      ]
                    },
                    "computed": false,
                    "loc": null,
                    "range": [
                      93,
                      102
                    ]
                  },
                  "loc": null,
                  "range": [
                    92,
                    103
                  ]
                }
              ],
              "closingElement": {
                "type": "JSXClosingElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "div",
                  "loc": null,
                  "range": [
                    105,
                    108
                  ]
                },
                "loc": null,
                "range": [
                  103,
                  109
                ]
              },
              "loc": null,
              "range": [
                87,
                109
              ]
            },
            "loc": null,
            "range": [
              80,
              110
            ]
          }
        ],
        "loc": null,
        "range": [
          60,
          112
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        40,
        112
      ],
      "loc": null,
      "range": [
        40,
        112
      ]
    },
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "NoForget",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          123,
          131
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            132,
            137
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "JSXElement",
              "openingElement": {
                "type": "JSXOpeningElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "Bar",
                  "loc": null,
                  "range": [
                    151,
                    154
                  ]
                },
                "attributes": [],
                "selfClosing": false,
                "loc": null,
                "range": [
                  150,
                  155
                ]
              },
              "children": [
                {
                  "type": "JSXExpressionContainer",
                  "expression": {
                    "type": "MemberExpression",
                    "object": {
                      "type": "Identifier",
                      "name": "props",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        156,
                        161
                      ]
                    },
                    "property": {
                      "type": "Identifier",
                      "name": "noForget",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        162,
                        170
                      ]
                    },
                    "computed": false,
                    "loc": null,
                    "range": [
                      156,
                      170
                    ]
                  },
                  "loc": null,
                  "range": [
                    155,
                    171
                  ]
                }
              ],
              "closingElement": {
                "type": "JSXClosingElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "Bar",
                  "loc": null,
                  "range": [
                    173,
                    176
                  ]
                },
                "loc": null,
                "range": [
                  171,
                  177
                ]
              },
              "loc": null,
              "range": [
                150,
                177
              ]
            },
            "loc": null,
            "range": [
              143,
              178
            ]
          }
        ],
        "loc": null,
        "range": [
          139,
          180
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        114,
        180
      ],
      "loc": null,
      "range": [
        114,
        180
      ]
    },
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "Foo",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          191,
          194
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            195,
            200
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "ExpressionStatement",
            "expression": {
              "type": "StringLiteral",
              "value": "use forget",
              "loc": null,
              "range": [
                206,
                218
              ]
            },
            "directive": null,
            "loc": null,
            "range": [
              206,
              219
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "JSXElement",
              "openingElement": {
                "type": "JSXOpeningElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "Foo",
                  "loc": null,
                  "range": [
                    230,
                    233
                  ]
                },
                "attributes": [],
                "selfClosing": false,
                "loc": null,
                "range": [
                  229,
                  234
                ]
              },
              "children": [
                {
                  "type": "JSXExpressionContainer",
                  "expression": {
                    "type": "MemberExpression",
                    "object": {
                      "type": "Identifier",
                      "name": "props",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        235,
                        240
                      ]
                    },
                    "property": {
                      "type": "Identifier",
                      "name": "bar",
                      "typeAnnotation": null,
                      "loc": null,
                      "range": [
                        241,
                        244
                      ]
                    },
                    "computed": false,
                    "loc": null,
                    "range": [
                      235,
                      244
                    ]
                  },
                  "loc": null,
                  "range": [
                    234,
                    245
                  ]
                }
              ],
              "closingElement": {
                "type": "JSXClosingElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "Foo",
                  "loc": null,
                  "range": [
                    247,
                    250
                  ]
                },
                "loc": null,
                "range": [
                  245,
                  251
                ]
              },
              "loc": null,
              "range": [
                229,
                251
              ]
            },
            "loc": null,
            "range": [
              222,
              252
            ]
          }
        ],
        "loc": null,
        "range": [
          202,
          254
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        182,
        254
      ],
      "loc": null,
      "range": [
        182,
        254
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    40,
    254
  ]
}
