Home / Function/ buildDependencyInstructions() — react Function Reference

buildDependencyInstructions() — react Function Reference

Architecture documentation for the buildDependencyInstructions() function in ScopeDependencyUtils.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  30907c46_684f_39cf_12ac_900130b902f4["buildDependencyInstructions()"]
  a4fd6965_224d_0ddc_a6f9_b2f74cfd3994["ScopeDependencyUtils.ts"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|defined in| a4fd6965_224d_0ddc_a6f9_b2f74cfd3994
  3522f83b_2dff_3c9f_920f_3e428eb62b31["inferEffectDependencies()"]
  3522f83b_2dff_3c9f_920f_3e428eb62b31 -->|calls| 30907c46_684f_39cf_12ac_900130b902f4
  d0800e5a_2d5f_1c1b_169c_b6c5cc895bee["writeNonOptionalDependency()"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|calls| d0800e5a_2d5f_1c1b_169c_b6c5cc895bee
  8e8a7c07_79b4_f2fb_53bd_2e3554679223["writeOptionalDependency()"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|calls| 8e8a7c07_79b4_f2fb_53bd_2e3554679223
  88ff4269_4045_952d_05c0_a73b9bcad451["terminate()"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|calls| 88ff4269_4045_952d_05c0_a73b9bcad451
  d0270ab6_a621_bd55_a1b9_a5cad8b406b2["makeInstructionId()"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|calls| d0270ab6_a621_bd55_a1b9_a5cad8b406b2
  5dec5bb8_e0f9_d79d_1c1d_65a05ff57391["build()"]
  30907c46_684f_39cf_12ac_900130b902f4 -->|calls| 5dec5bb8_e0f9_d79d_1c1d_65a05ff57391
  style 30907c46_684f_39cf_12ac_900130b902f4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/HIR/ScopeDependencyUtils.ts lines 25–58

export function buildDependencyInstructions(
  dep: ReactiveScopeDependency,
  env: Environment,
): DependencyInstructions {
  const builder = new HIRBuilder(env, {
    entryBlockKind: 'value',
  });
  let dependencyValue: Identifier;
  if (dep.path.every(path => !path.optional)) {
    dependencyValue = writeNonOptionalDependency(dep, env, builder);
  } else {
    dependencyValue = writeOptionalDependency(dep, builder, null);
  }

  const exitBlockId = builder.terminate(
    {
      kind: 'unsupported',
      loc: GeneratedSource,
      id: makeInstructionId(0),
    },
    null,
  );
  return {
    place: {
      kind: 'Identifier',
      identifier: dependencyValue,
      effect: Effect.Freeze,
      reactive: dep.reactive,
      loc: GeneratedSource,
    },
    value: builder.build(),
    exitBlockId,
  };
}

Subdomains

Frequently Asked Questions

What does buildDependencyInstructions() do?
buildDependencyInstructions() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ScopeDependencyUtils.ts.
Where is buildDependencyInstructions() defined?
buildDependencyInstructions() is defined in compiler/packages/babel-plugin-react-compiler/src/HIR/ScopeDependencyUtils.ts at line 25.
What does buildDependencyInstructions() call?
buildDependencyInstructions() calls 5 function(s): build, makeInstructionId, terminate, writeNonOptionalDependency, writeOptionalDependency.
What calls buildDependencyInstructions()?
buildDependencyInstructions() is called by 1 function(s): inferEffectDependencies.

Analyze Your Own Codebase

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

Try Supermodel Free