Home / Function/ removeCallArguments() — react Function Reference

removeCallArguments() — react Function Reference

Architecture documentation for the removeCallArguments() function in minimize.ts from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f03b45b7_6931_37a3_cfc1_e985e2ab8de8["removeCallArguments()"]
  9c061da8_dbf8_4168_823d_991654a3c55d["minimize.ts"]
  f03b45b7_6931_37a3_cfc1_e985e2ab8de8 -->|defined in| 9c061da8_dbf8_4168_823d_991654a3c55d
  7a9af496_ef6a_d9e8_8eaf_1f386f49e4b3["cloneAst()"]
  f03b45b7_6931_37a3_cfc1_e985e2ab8de8 -->|calls| 7a9af496_ef6a_d9e8_8eaf_1f386f49e4b3
  style f03b45b7_6931_37a3_cfc1_e985e2ab8de8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/packages/snap/src/minimize.ts lines 191–225

function* removeCallArguments(ast: t.File): Generator<t.File> {
  // Collect all call expressions with their argument counts
  const callSites: Array<{callIndex: number; argCount: number}> = [];
  let callIndex = 0;
  t.traverseFast(ast, node => {
    if (t.isCallExpression(node) && node.arguments.length > 0) {
      callSites.push({callIndex, argCount: node.arguments.length});
      callIndex++;
    }
  });

  // For each call site, try removing each argument one at a time (from end to start)
  for (const {callIndex: targetCallIdx, argCount} of callSites) {
    for (let argIdx = argCount - 1; argIdx >= 0; argIdx--) {
      const cloned = cloneAst(ast);
      let idx = 0;
      let modified = false;

      t.traverseFast(cloned, node => {
        if (modified) return;
        if (t.isCallExpression(node) && node.arguments.length > 0) {
          if (idx === targetCallIdx && argIdx < node.arguments.length) {
            node.arguments.splice(argIdx, 1);
            modified = true;
          }
          idx++;
        }
      });

      if (modified) {
        yield cloned;
      }
    }
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does removeCallArguments() do?
removeCallArguments() is a function in the react codebase, defined in compiler/packages/snap/src/minimize.ts.
Where is removeCallArguments() defined?
removeCallArguments() is defined in compiler/packages/snap/src/minimize.ts at line 191.
What does removeCallArguments() call?
removeCallArguments() calls 1 function(s): cloneAst.

Analyze Your Own Codebase

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

Try Supermodel Free