Home / Function/ codegenBlockNoReset() — react Function Reference

codegenBlockNoReset() — react Function Reference

Architecture documentation for the codegenBlockNoReset() function in CodegenReactiveFunction.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6913ca73_f3c4_9919_bf65_7b95559378b7["codegenBlockNoReset()"]
  dc7f10c2_c914_a162_d02b_a10a15c64a5f["CodegenReactiveFunction.ts"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|defined in| dc7f10c2_c914_a162_d02b_a10a15c64a5f
  b8125226_b7ac_716f_9ed0_db7e7d00571c["codegenBlock()"]
  b8125226_b7ac_716f_9ed0_db7e7d00571c -->|calls| 6913ca73_f3c4_9919_bf65_7b95559378b7
  d8edf87e_ea78_c9d0_b5c9_13d68891efec["codegenInstructionValue()"]
  d8edf87e_ea78_c9d0_b5c9_13d68891efec -->|calls| 6913ca73_f3c4_9919_bf65_7b95559378b7
  c65f3ebd_fe8f_602d_b885_bc79e6e81b1d["codegenInstructionNullable()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| c65f3ebd_fe8f_602d_b885_bc79e6e81b1d
  073c81a5_c389_d108_5b8f_4d6dc6eece83["push()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| 073c81a5_c389_d108_5b8f_4d6dc6eece83
  94638464_4710_0693_528f_4848cf25e876["codegenReactiveScope()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| 94638464_4710_0693_528f_4848cf25e876
  4f146c25_f9b5_fd01_865f_04b2fc3071a8["codegenTerminal()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| 4f146c25_f9b5_fd01_865f_04b2fc3071a8
  49736686_6dd0_c888_a448_9dcd1498a17a["codegenLabel()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| 49736686_6dd0_c888_a448_9dcd1498a17a
  d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"]
  6913ca73_f3c4_9919_bf65_7b95559378b7 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6
  style 6913ca73_f3c4_9919_bf65_7b95559378b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts lines 518–575

function codegenBlockNoReset(
  cx: Context,
  block: ReactiveBlock,
): t.BlockStatement {
  const statements: Array<t.Statement> = [];
  for (const item of block) {
    switch (item.kind) {
      case 'instruction': {
        const statement = codegenInstructionNullable(cx, item.instruction);
        if (statement !== null) {
          statements.push(statement);
        }
        break;
      }
      case 'pruned-scope': {
        const scopeBlock = codegenBlockNoReset(cx, item.instructions);
        statements.push(...scopeBlock.body);
        break;
      }
      case 'scope': {
        const temp = new Map(cx.temp);
        codegenReactiveScope(cx, statements, item.scope, item.instructions);
        cx.temp = temp;
        break;
      }
      case 'terminal': {
        const statement = codegenTerminal(cx, item.terminal);
        if (statement === null) {
          break;
        }
        if (item.label !== null && !item.label.implicit) {
          const block =
            statement.type === 'BlockStatement' && statement.body.length === 1
              ? statement.body[0]
              : statement;
          statements.push(
            t.labeledStatement(
              t.identifier(codegenLabel(item.label.id)),
              block,
            ),
          );
        } else if (statement.type === 'BlockStatement') {
          statements.push(...statement.body);
        } else {
          statements.push(statement);
        }
        break;
      }
      default: {
        assertExhaustive(
          item,
          `Unexpected item kind \`${(item as any).kind}\``,
        );
      }
    }
  }
  return t.blockStatement(statements);
}

Domain

Subdomains

Frequently Asked Questions

What does codegenBlockNoReset() do?
codegenBlockNoReset() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts.
Where is codegenBlockNoReset() defined?
codegenBlockNoReset() is defined in compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts at line 518.
What does codegenBlockNoReset() call?
codegenBlockNoReset() calls 6 function(s): assertExhaustive, codegenInstructionNullable, codegenLabel, codegenReactiveScope, codegenTerminal, push.
What calls codegenBlockNoReset()?
codegenBlockNoReset() is called by 2 function(s): codegenBlock, codegenInstructionValue.

Analyze Your Own Codebase

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

Try Supermodel Free