---
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/fbt-call-complex-param-value.js
---
Input:
import fbt from "fbt";

function Component(props) {
  const text = fbt(
    `Hello, ${fbt.param("(key) name", capitalize(props.name))}!`,
    "(description) Greeting"
  );
  return <div>{text}</div>;
}


Output:
{
  "type": "Program",
  "body": [
    {
      "type": "ImportDeclaration",
      "specifiers": [
        {
          "type": "ImportDefaultSpecifier",
          "local": {
            "type": "Identifier",
            "name": "fbt",
            "typeAnnotation": null,
            "loc": null,
            "range": [
              7,
              10
            ]
          },
          "loc": null,
          "range": [
            7,
            10
          ]
        }
      ],
      "source": {
        "type": "StringLiteral",
        "value": "fbt",
        "loc": null,
        "range": [
          16,
          21
        ]
      },
      "loc": null,
      "range": [
        0,
        22
      ]
    },
    {
      "type": "FunctionDeclaration",
      "id": {
        "type": "Identifier",
        "name": "Component",
        "typeAnnotation": null,
        "loc": null,
        "range": [
          33,
          42
        ]
      },
      "params": [
        {
          "type": "Identifier",
          "name": "props",
          "typeAnnotation": null,
          "loc": null,
          "range": [
            43,
            48
          ]
        }
      ],
      "body": {
        "type": "BlockStatement",
        "body": [
          {
            "type": "VariableDeclaration",
            "kind": "const",
            "declarations": [
              {
                "type": "VariableDeclarator",
                "id": {
                  "type": "Identifier",
                  "name": "text",
                  "typeAnnotation": null,
                  "loc": null,
                  "range": [
                    60,
                    64
                  ]
                },
                "init": {
                  "type": "CallExpression",
                  "callee": {
                    "type": "Identifier",
                    "name": "fbt",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      67,
                      70
                    ]
                  },
                  "arguments": [
                    {
                      "type": "TemplateLiteral",
                      "quasis": [
                        {
                          "type": "TemplateElement",
                          "tail": false,
                          "value": {
                            "cooked": "Hello, ",
                            "raw": "Hello, "
                          },
                          "loc": null,
                          "range": [
                            76,
                            86
                          ]
                        },
                        {
                          "type": "TemplateElement",
                          "tail": true,
                          "value": {
                            "cooked": "!",
                            "raw": "!"
                          },
                          "loc": null,
                          "range": [
                            133,
                            136
                          ]
                        }
                      ],
                      "expressions": [
                        {
                          "type": "CallExpression",
                          "callee": {
                            "type": "MemberExpression",
                            "object": {
                              "type": "Identifier",
                              "name": "fbt",
                              "typeAnnotation": null,
                              "loc": null,
                              "range": [
                                86,
                                89
                              ]
                            },
                            "property": {
                              "type": "Identifier",
                              "name": "param",
                              "typeAnnotation": null,
                              "loc": null,
                              "range": [
                                90,
                                95
                              ]
                            },
                            "computed": false,
                            "loc": null,
                            "range": [
                              86,
                              95
                            ]
                          },
                          "arguments": [
                            {
                              "type": "StringLiteral",
                              "value": "(key) name",
                              "loc": null,
                              "range": [
                                96,
                                108
                              ]
                            },
                            {
                              "type": "CallExpression",
                              "callee": {
                                "type": "Identifier",
                                "name": "capitalize",
                                "typeAnnotation": null,
                                "loc": null,
                                "range": [
                                  110,
                                  120
                                ]
                              },
                              "arguments": [
                                {
                                  "type": "MemberExpression",
                                  "object": {
                                    "type": "Identifier",
                                    "name": "props",
                                    "typeAnnotation": null,
                                    "loc": null,
                                    "range": [
                                      121,
                                      126
                                    ]
                                  },
                                  "property": {
                                    "type": "Identifier",
                                    "name": "name",
                                    "typeAnnotation": null,
                                    "loc": null,
                                    "range": [
                                      127,
                                      131
                                    ]
                                  },
                                  "computed": false,
                                  "loc": null,
                                  "range": [
                                    121,
                                    131
                                  ]
                                }
                              ],
                              "loc": null,
                              "range": [
                                110,
                                132
                              ]
                            }
                          ],
                          "loc": null,
                          "range": [
                            86,
                            133
                          ]
                        }
                      ],
                      "loc": null,
                      "range": [
                        76,
                        136
                      ]
                    },
                    {
                      "type": "StringLiteral",
                      "value": "(description) Greeting",
                      "loc": null,
                      "range": [
                        142,
                        166
                      ]
                    }
                  ],
                  "loc": null,
                  "range": [
                    67,
                    170
                  ]
                },
                "loc": null,
                "range": [
                  60,
                  170
                ]
              }
            ],
            "loc": null,
            "range": [
              54,
              171
            ]
          },
          {
            "type": "ReturnStatement",
            "argument": {
              "type": "JSXElement",
              "openingElement": {
                "type": "JSXOpeningElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "div",
                  "loc": null,
                  "range": [
                    182,
                    185
                  ]
                },
                "attributes": [],
                "selfClosing": false,
                "loc": null,
                "range": [
                  181,
                  186
                ]
              },
              "children": [
                {
                  "type": "JSXExpressionContainer",
                  "expression": {
                    "type": "Identifier",
                    "name": "text",
                    "typeAnnotation": null,
                    "loc": null,
                    "range": [
                      187,
                      191
                    ]
                  },
                  "loc": null,
                  "range": [
                    186,
                    192
                  ]
                }
              ],
              "closingElement": {
                "type": "JSXClosingElement",
                "name": {
                  "type": "JSXIdentifier",
                  "name": "div",
                  "loc": null,
                  "range": [
                    194,
                    197
                  ]
                },
                "loc": null,
                "range": [
                  192,
                  198
                ]
              },
              "loc": null,
              "range": [
                181,
                198
              ]
            },
            "loc": null,
            "range": [
              174,
              199
            ]
          }
        ],
        "loc": null,
        "range": [
          50,
          201
        ]
      },
      "generator": false,
      "async": false,
      "loc": null,
      "range": [
        24,
        201
      ],
      "loc": null,
      "range": [
        24,
        201
      ]
    }
  ],
  "sourceType": "script",
  "loc": null,
  "range": [
    0,
    201
  ]
}
