Home / Function/ visitFunctionExpressionAndPropagateFireDependencies() — react Function Reference

visitFunctionExpressionAndPropagateFireDependencies() — react Function Reference

Architecture documentation for the visitFunctionExpressionAndPropagateFireDependencies() function in TransformFire.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7756ca6a_d541_c148_b849_a02c3a6f4e97["visitFunctionExpressionAndPropagateFireDependencies()"]
  6061353e_921a_a1a8_d6c1_777e8d9f8896["TransformFire.ts"]
  7756ca6a_d541_c148_b849_a02c3a6f4e97 -->|defined in| 6061353e_921a_a1a8_d6c1_777e8d9f8896
  38224692_55f3_a937_63fd_e0266e855650["replaceFireFunctions()"]
  38224692_55f3_a937_63fd_e0266e855650 -->|calls| 7756ca6a_d541_c148_b849_a02c3a6f4e97
  38224692_55f3_a937_63fd_e0266e855650["replaceFireFunctions()"]
  7756ca6a_d541_c148_b849_a02c3a6f4e97 -->|calls| 38224692_55f3_a937_63fd_e0266e855650
  87b734d8_7872_5707_79f3_c595b3542664["mergeCalleesFromInnerScope()"]
  7756ca6a_d541_c148_b849_a02c3a6f4e97 -->|calls| 87b734d8_7872_5707_79f3_c595b3542664
  style 7756ca6a_d541_c148_b849_a02c3a6f4e97 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Transform/TransformFire.ts lines 320–353

function visitFunctionExpressionAndPropagateFireDependencies(
  fnExpr: FunctionExpression,
  context: Context,
  enteringUseEffect: boolean,
): FireCalleesToFireFunctionBinding {
  let withScope = enteringUseEffect
    ? context.withUseEffectLambdaScope.bind(context)
    : context.withFunctionScope.bind(context);

  const calleesCapturedByFnExpression = withScope(() =>
    replaceFireFunctions(fnExpr.loweredFunc.func, context),
  );

  // For each replaced callee, update the context of the function expression to track it
  for (
    let contextIdx = 0;
    contextIdx < fnExpr.loweredFunc.func.context.length;
    contextIdx++
  ) {
    const contextItem = fnExpr.loweredFunc.func.context[contextIdx];
    const replacedCallee = calleesCapturedByFnExpression.get(
      contextItem.identifier.id,
    );
    if (replacedCallee != null) {
      fnExpr.loweredFunc.func.context[contextIdx] = {
        ...replacedCallee.fireFunctionBinding,
      };
    }
  }

  context.mergeCalleesFromInnerScope(calleesCapturedByFnExpression);

  return calleesCapturedByFnExpression;
}

Domain

Subdomains

Frequently Asked Questions

What does visitFunctionExpressionAndPropagateFireDependencies() do?
visitFunctionExpressionAndPropagateFireDependencies() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Transform/TransformFire.ts.
Where is visitFunctionExpressionAndPropagateFireDependencies() defined?
visitFunctionExpressionAndPropagateFireDependencies() is defined in compiler/packages/babel-plugin-react-compiler/src/Transform/TransformFire.ts at line 320.
What does visitFunctionExpressionAndPropagateFireDependencies() call?
visitFunctionExpressionAndPropagateFireDependencies() calls 2 function(s): mergeCalleesFromInnerScope, replaceFireFunctions.
What calls visitFunctionExpressionAndPropagateFireDependencies()?
visitFunctionExpressionAndPropagateFireDependencies() is called by 1 function(s): replaceFireFunctions.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free