Home / Function/ analyseFunctions() — react Function Reference

analyseFunctions() — react Function Reference

Architecture documentation for the analyseFunctions() function in AnalyseFunctions.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ce023a8c_3a25_5d00_7cf2_2a9d39a7abfa["analyseFunctions()"]
  212338a1_d579_40dc_af88_824802fa3262["AnalyseFunctions.ts"]
  ce023a8c_3a25_5d00_7cf2_2a9d39a7abfa -->|defined in| 212338a1_d579_40dc_af88_824802fa3262
  549ab0df_dde0_c1fc_591d_a1d683921f55["lowerWithMutationAliasing()"]
  549ab0df_dde0_c1fc_591d_a1d683921f55 -->|calls| ce023a8c_3a25_5d00_7cf2_2a9d39a7abfa
  549ab0df_dde0_c1fc_591d_a1d683921f55["lowerWithMutationAliasing()"]
  ce023a8c_3a25_5d00_7cf2_2a9d39a7abfa -->|calls| 549ab0df_dde0_c1fc_591d_a1d683921f55
  style ce023a8c_3a25_5d00_7cf2_2a9d39a7abfa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/Inference/AnalyseFunctions.ts lines 17–46

export default function analyseFunctions(func: HIRFunction): void {
  for (const [_, block] of func.body.blocks) {
    for (const instr of block.instructions) {
      switch (instr.value.kind) {
        case 'ObjectMethod':
        case 'FunctionExpression': {
          lowerWithMutationAliasing(instr.value.loweredFunc.func);

          /**
           * Reset mutable range for outer inferReferenceEffects
           */
          for (const operand of instr.value.loweredFunc.func.context) {
            /**
             * NOTE: inferReactiveScopeVariables makes identifiers in the scope
             * point to the *same* mutableRange instance. Resetting start/end
             * here is insufficient, because a later mutation of the range
             * for any one identifier could affect the range for other identifiers.
             */
            operand.identifier.mutableRange = {
              start: makeInstructionId(0),
              end: makeInstructionId(0),
            };
            operand.identifier.scope = null;
          }
          break;
        }
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does analyseFunctions() do?
analyseFunctions() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Inference/AnalyseFunctions.ts.
Where is analyseFunctions() defined?
analyseFunctions() is defined in compiler/packages/babel-plugin-react-compiler/src/Inference/AnalyseFunctions.ts at line 17.
What does analyseFunctions() call?
analyseFunctions() calls 1 function(s): lowerWithMutationAliasing.
What calls analyseFunctions()?
analyseFunctions() is called by 1 function(s): lowerWithMutationAliasing.

Analyze Your Own Codebase

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

Try Supermodel Free