From f4e4dc0f44a9ef453392ed63e02254f9acc947ec Mon Sep 17 00:00:00 2001 From: Nathan Marks Date: Thu, 13 Nov 2025 08:07:23 -0500 Subject: [PATCH 1/4] Fix variable declarator source locations --- .../src/HIR/BuildHIR.ts | 2 + .../src/HIR/HIR.ts | 2 + .../src/Optimization/OutlineJsx.ts | 1 + .../ReactiveScopes/CodegenReactiveFunction.ts | 42 ++++++-- ...or.todo-missing-source-locations.expect.md | 97 +------------------ 5 files changed, 41 insertions(+), 103 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts index f6872da1117..4a170cdbdf3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts @@ -4026,6 +4026,7 @@ function lowerAssignment( pattern: { kind: 'ArrayPattern', items, + loc: lvalue.node.loc ?? GeneratedSource, }, }, value, @@ -4203,6 +4204,7 @@ function lowerAssignment( pattern: { kind: 'ObjectPattern', properties, + loc: lvalue.node.loc ?? GeneratedSource, }, }, value, diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts index 41e957a5467..ff5e7d25c63 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts @@ -694,11 +694,13 @@ export type SpreadPattern = { export type ArrayPattern = { kind: 'ArrayPattern'; items: Array; + loc: SourceLocation; }; export type ObjectPattern = { kind: 'ObjectPattern'; properties: Array; + loc: SourceLocation; }; export type ObjectPropertyKey = diff --git a/compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts b/compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts index 5c98997953d..a38256896b1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Optimization/OutlineJsx.ts @@ -515,6 +515,7 @@ function emitDestructureProps( pattern: { kind: 'ObjectPattern', properties, + loc: GeneratedSource, }, kind: InstructionKind.Let, }, diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index c497253a22f..0afd0b5d764 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -1406,7 +1406,7 @@ function codegenInstructionNullable( suggestions: null, }); return createVariableDeclaration(instr.loc, 'const', [ - t.variableDeclarator(codegenLValue(cx, lvalue), value), + createVariableDeclarator(codegenLValue(cx, lvalue), value), ]); } case InstructionKind.Function: { @@ -1470,7 +1470,7 @@ function codegenInstructionNullable( suggestions: null, }); return createVariableDeclaration(instr.loc, 'let', [ - t.variableDeclarator(codegenLValue(cx, lvalue), value), + createVariableDeclarator(codegenLValue(cx, lvalue), value), ]); } case InstructionKind.Reassign: { @@ -1710,6 +1710,9 @@ function withLoc) => t.Node>( }; } +const createIdentifier = withLoc(t.identifier); +const createArrayPattern = withLoc(t.arrayPattern); +const createObjectPattern = withLoc(t.objectPattern); const createBinaryExpression = withLoc(t.binaryExpression); const createExpressionStatement = withLoc(t.expressionStatement); const _createLabelledStatement = withLoc(t.labeledStatement); @@ -1741,6 +1744,29 @@ const createTryStatement = withLoc(t.tryStatement); const createBreakStatement = withLoc(t.breakStatement); const createContinueStatement = withLoc(t.continueStatement); +function createVariableDeclarator( + id: t.LVal, + init?: t.Expression | null, +): t.VariableDeclarator { + const node = t.variableDeclarator(id, init); + + /* + * The variable declarator location is not preserved in HIR, however, we can use the + * start location of the id and the end location of the init to recreate the + * exact original variable declarator location. + */ + if (id.loc && init?.loc) { + node.loc = { + start: id.loc.start, + end: init.loc.end, + filename: id.loc.filename, + identifierName: undefined, + }; + } + + return node; +} + function createHookGuard( guard: ExternalFunction, context: ProgramContext, @@ -1848,7 +1874,7 @@ function codegenInstruction( ); } else { return createVariableDeclaration(instr.loc, 'const', [ - t.variableDeclarator( + createVariableDeclarator( convertIdentifier(instr.lvalue.identifier), expressionValue, ), @@ -2775,7 +2801,7 @@ function codegenArrayPattern( ): t.ArrayPattern { const hasHoles = !pattern.items.every(e => e.kind !== 'Hole'); if (hasHoles) { - const result = t.arrayPattern([]); + const result = createArrayPattern(pattern.loc, []); /* * Older versions of babel have a validation bug fixed by * https://github.com/babel/babel/pull/10917 @@ -2796,7 +2822,8 @@ function codegenArrayPattern( } return result; } else { - return t.arrayPattern( + return createArrayPattern( + pattern.loc, pattern.items.map(item => { if (item.kind === 'Hole') { return null; @@ -2816,7 +2843,8 @@ function codegenLValue( return codegenArrayPattern(cx, pattern); } case 'ObjectPattern': { - return t.objectPattern( + return createObjectPattern( + pattern.loc, pattern.properties.map(property => { if (property.kind === 'ObjectProperty') { const key = codegenObjectPropertyKey(cx, property.key); @@ -2935,7 +2963,7 @@ function convertIdentifier(identifier: Identifier): t.Identifier { suggestions: null, }, ); - return t.identifier(identifier.name.value); + return createIdentifier(identifier.loc, identifier.name.value); } function compareScopeDependency( diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md index a6199bb7147..1b8d1c5239a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md @@ -38,85 +38,7 @@ function Component({prop1, prop2}) { ## Error ``` -Found 13 errors: - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:5:8 - 3 | - 4 | function Component({prop1, prop2}) { -> 5 | const x = prop1 + prop2; - | ^^^^^^^^^^^^^^^^^ - 6 | const y = x * 2; - 7 | const arr = [x, y]; - 8 | const obj = {x, y}; - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:6:8 - 4 | function Component({prop1, prop2}) { - 5 | const x = prop1 + prop2; -> 6 | const y = x * 2; - | ^^^^^^^^^ - 7 | const arr = [x, y]; - 8 | const obj = {x, y}; - 9 | const [a, b] = arr; - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:7:8 - 5 | const x = prop1 + prop2; - 6 | const y = x * 2; -> 7 | const arr = [x, y]; - | ^^^^^^^^^^^^ - 8 | const obj = {x, y}; - 9 | const [a, b] = arr; - 10 | const {x: c, y: d} = obj; - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:8:8 - 6 | const y = x * 2; - 7 | const arr = [x, y]; -> 8 | const obj = {x, y}; - | ^^^^^^^^^^^^ - 9 | const [a, b] = arr; - 10 | const {x: c, y: d} = obj; - 11 | - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:9:8 - 7 | const arr = [x, y]; - 8 | const obj = {x, y}; -> 9 | const [a, b] = arr; - | ^^^^^^^^^^^^ - 10 | const {x: c, y: d} = obj; - 11 | - 12 | useEffect(() => { - -Todo: Important source location missing in generated code - -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:10:8 - 8 | const obj = {x, y}; - 9 | const [a, b] = arr; -> 10 | const {x: c, y: d} = obj; - | ^^^^^^^^^^^^^^^^^^ - 11 | - 12 | useEffect(() => { - 13 | if (a > 10) { +Found 6 errors: Todo: Important source location missing in generated code @@ -154,23 +76,6 @@ error.todo-missing-source-locations.ts:14:6 Todo: Important source location missing in generated code -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. - -error.todo-missing-source-locations.ts:18:8 - 16 | }, [a]); - 17 | -> 18 | const foo = useCallback(() => { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ -> 19 | return a + b; - | ^^^^^^^^^^^^^^^^^ -> 20 | }, [a, b]); - | ^^^^^^^^^^^^^ - 21 | - 22 | function bar() { - 23 | return (c + d) * 2; - -Todo: Important source location missing in generated code - Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. error.todo-missing-source-locations.ts:19:4 From cd4d9e944c5d93bc5125b365764d3039860db33d Mon Sep 17 00:00:00 2001 From: Nathan Marks Date: Thu, 13 Nov 2025 08:12:10 -0500 Subject: [PATCH 2/4] update failing snaps --- ...alias-capture-in-method-receiver-and-mutate.expect.md | 2 -- .../compiler/alias-capture-in-method-receiver.expect.md | 1 - .../compiler/aliased-nested-scope-fn-expr.expect.md | 4 ---- .../aliased-nested-scope-truncated-dep.expect.md | 3 --- ...gn-scopes-within-nested-valueblock-in-array.expect.md | 1 - ...ting-ref-in-callback-passed-to-jsx-indirect.expect.md | 1 - ...property-in-callback-passed-to-jsx-indirect.expect.md | 1 - .../compiler/allow-ref-type-cast-in-render.expect.md | 1 - .../fixtures/compiler/array-at-closure.expect.md | 1 - .../compiler/array-spread-mutable-iterator.expect.md | 1 - .../src/__tests__/fixtures/compiler/call.expect.md | 1 - .../compiler/capture-ref-for-later-mutation.expect.md | 1 - .../fixtures/compiler/capturing-func-mutate.expect.md | 1 - .../compiler/codegen-emit-make-read-only.expect.md | 1 - .../compiler/codegen-inline-iife-reassign.expect.md | 1 - .../compiler/codegen-inline-iife-storeprop.expect.md | 1 - .../fixtures/compiler/conditional-on-mutable.expect.md | 4 ---- .../__tests__/fixtures/compiler/constructor.expect.md | 1 - ...ntext-variable-reassigned-outside-of-lambda.expect.md | 1 - ...ixed-scope-and-local-variables-with-default.expect.md | 3 --- ...cturing-mixed-scope-declarations-and-locals.expect.md | 3 --- ...-dep-is-inner-declaration-of-previous-scope.expect.md | 1 - .../derived-state-conditionally-in-effect.expect.md | 1 - .../ref-conditional-in-effect-no-error.expect.md | 1 - ...ng-interleaved-allocating-nested-dependency.expect.md | 1 - .../compiler/fbt/fbt-param-with-newline.expect.md | 2 -- .../compiler/fbt/fbt-param-with-quotes.expect.md | 9 +-------- .../compiler/fbt/fbt-param-with-unicode.expect.md | 9 +-------- .../fixtures/compiler/fbt/fbt-to-string.expect.md | 9 +-------- .../compiler/flag-enable-emit-hook-guards.expect.md | 1 - .../fixtures/compiler/for-in-statement.expect.md | 1 - .../for-loop-with-value-block-initializer.expect.md | 1 - .../__tests__/fixtures/compiler/for-of-mutate.expect.md | 1 - ...-expression-maybe-mutates-hook-return-value.expect.md | 1 - .../function-expression-prototype-call.expect.md | 1 - .../global-jsx-tag-lowered-between-mutations.expect.md | 1 - .../compiler/global-types/set-constructor-arg.expect.md | 1 - .../global-types/set-copy-constructor-mutate.expect.md | 1 - .../__tests__/fixtures/compiler/hoist-destruct.expect.md | 1 - .../hoisting-computed-member-expression.expect.md | 3 --- .../hoisting-functionexpr-conditional-dep.expect.md | 1 - ...ting-let-declaration-without-initialization.expect.md | 2 -- .../compiler/hoisting-member-expression.expect.md | 2 -- .../compiler/hoisting-nested-const-declaration.expect.md | 3 --- .../compiler/hoisting-nested-let-declaration.expect.md | 3 --- .../fixtures/compiler/hoisting-object-method.expect.md | 1 - .../hoisting-reassigned-let-declaration.expect.md | 2 -- .../hoisting-reassigned-twice-let-declaration.expect.md | 2 -- .../fixtures/compiler/hoisting-recursive-call.expect.md | 1 - .../hoisting-repro-variable-used-in-assignment.expect.md | 1 - .../hoisting-setstate-captured-indirectly-jsx.expect.md | 1 - .../hoisting-simple-function-expression.expect.md | 2 -- .../fixtures/compiler/hooks-with-prefix.expect.md | 1 - .../fixtures/compiler/idx-no-outlining.expect.md | 1 - .../compiler/iife-return-modified-later-phi.expect.md | 1 - .../compiler/incompatible-destructuring-kinds.expect.md | 1 - .../compiler/infer-nested-object-method.expect.md | 1 - .../assume-invoked/conditional-call-chain.expect.md | 1 - .../assume-invoked/use-memo-returned.expect.md | 1 - ...o-value-not-promoted-to-outer-scope-dynamic.expect.md | 1 - ...mo-value-not-promoted-to-outer-scope-static.expect.md | 1 - .../invalid-setState-in-useEffect-transitive.expect.md | 1 - .../jsx-tag-evaluation-order-non-global.expect.md | 1 - .../lambda-array-access-member-expr-captured.expect.md | 2 -- .../lambda-array-access-member-expr-param.expect.md | 1 - .../compiler/lambda-capture-returned-alias.expect.md | 2 -- .../compiler/maybe-mutate-object-in-callback.expect.md | 1 - ...lls-to-hoisted-callback-from-other-callback.expect.md | 3 --- .../fixtures/compiler/mutable-lifetime-loops.expect.md | 5 ----- .../compiler/mutable-lifetime-with-aliasing.expect.md | 1 - .../mutate-outer-scope-within-value-block.expect.md | 1 - .../compiler/mutation-during-jsx-construction.expect.md | 1 - .../mutation-within-capture-and-mutablerange.expect.md | 1 - .../aliased-nested-scope-truncated-dep.expect.md | 3 --- .../basic-mutation-via-function-expression.expect.md | 1 - .../capture-backedge-phi-with-later-mutation.expect.md | 1 - .../capture-in-function-expression-indirect.expect.md | 1 - .../iife-return-modified-later-phi.expect.md | 1 - ...oxing-unboxing-function-call-indirections-2.expect.md | 1 - ...-boxing-unboxing-function-call-indirections.expect.md | 1 - .../object-expression-computed-member.expect.md | 1 - ...-function-expression-effects-stack-overflow.expect.md | 1 - ...pro-invalid-function-expression-effects-phi.expect.md | 2 -- .../repro-jsx-captures-value-mutated-later.expect.md | 3 --- .../useCallback-reordering-deplist-controlflow.expect.md | 2 -- ...ed-key-mutate-key-while-constructing-object.expect.md | 1 - .../compiler/object-expression-computed-member.expect.md | 1 - ...onal-call-with-independently-memoizable-arg.expect.md | 1 - .../capture-ref-for-later-mutation.expect.md | 1 - ...-type-inference-array-push-consecutive-phis.expect.md | 2 -- .../compiler/phi-type-inference-array-push.expect.md | 2 -- .../compiler/phi-type-inference-property-store.expect.md | 2 -- ...-nonescaping-useMemo-mult-returns-primitive.expect.md | 1 - .../prune-nonescaping-useMemo-mult-returns.expect.md | 1 - .../useCallback-in-other-reactive-block.expect.md | 1 - .../useCallback-reordering-deplist-controlflow.expect.md | 2 -- .../useMemo-in-other-reactive-block.expect.md | 2 -- .../useMemo-reordering-depslist-controlflow.expect.md | 1 - .../conditional-on-mutable.expect.md | 4 ---- .../iife-return-modified-later-phi.expect.md | 1 - .../infer-component-props-non-null.expect.md | 1 - ...-type-inference-array-push-consecutive-phis.expect.md | 2 -- .../phi-type-inference-array-push.expect.md | 2 -- .../phi-type-inference-property-store.expect.md | 2 -- .../infer-nested-function-uncond-access.expect.md | 1 - .../join-uncond-scopes-cond-deps.expect.md | 1 - .../ssa-leave-case.expect.md | 1 - .../propagate-scope-deps-hir-fork/switch.expect.md | 1 - .../prune-scopes-whose-deps-invalidate-jsx.expect.md | 1 - ...rune-scopes-whose-deps-may-invalidate-array.expect.md | 1 - ...dency-object-captured-with-reactive-mutated.expect.md | 1 - .../fixtures/compiler/reactive-scopes.expect.md | 1 - .../reactivity-analysis-interleaved-reactivity.expect.md | 2 -- .../compiler/reassign-in-while-loop-condition.expect.md | 1 - .../fixtures/compiler/reassignment-conditional.expect.md | 3 --- .../compiler/reassignment-separate-scopes.expect.md | 1 - .../__tests__/fixtures/compiler/reassignment.expect.md | 2 -- .../compiler/recursive-function-expression.expect.md | 1 - .../join-uncond-scopes-cond-deps.expect.md | 1 - .../ref-current-aliased-no-added-to-dep.expect.md | 1 - .../ref-current-aliased-not-added-to-dep-2.expect.md | 1 - .../ref-current-field-not-added-to-dep.expect.md | 1 - .../ref-current-field-write-not-added-to-dep.expect.md | 1 - .../compiler/ref-current-not-added-to-dep-2.expect.md | 1 - .../compiler/ref-current-not-added-to-dep.expect.md | 1 - .../ref-current-optional-field-no-added-to-dep.expect.md | 1 - .../ref-current-write-not-added-to-dep.expect.md | 1 - .../__tests__/fixtures/compiler/regexp-literal.expect.md | 1 - .../rename-source-variables-nested-function.expect.md | 1 - .../repro-aliased-capture-aliased-mutate.expect.md | 1 - .../compiler/repro-aliased-capture-mutate.expect.md | 2 -- ...false-positive-ref-validation-in-use-effect.expect.md | 1 - ...ntly-memoized-property-load-for-method-call.expect.md | 3 --- ...ro-instruction-part-of-already-closed-scope.expect.md | 1 - .../repro-missing-dependency-if-within-while.expect.md | 1 - ...repro-mutate-ref-in-function-passed-to-hook.expect.md | 1 - ...with-frozen-argument-in-function-expression.expect.md | 1 - ...call-on-frozen-value-in-function-expression.expect.md | 1 - ...rations-in-reactive-scope-with-early-return.expect.md | 1 - ...-temporary-reactive-scope-with-early-return.expect.md | 1 - .../compiler/repro-renaming-conflicting-decls.expect.md | 1 - .../repro-returned-inner-fn-mutates-context.expect.md | 1 - .../repro-returned-inner-fn-reassigns-context.expect.md | 1 - ...efined-expression-of-jsxexpressioncontainer.expect.md | 2 -- ...-fbt-call-merge-overlapping-reactive-scopes.expect.md | 1 - .../same-variable-as-dep-and-redeclare.expect.md | 1 - ...tructuring-assignment-to-scope-declarations.expect.md | 1 - ...ring-both-mixed-local-and-scope-declaration.expect.md | 2 -- .../__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md | 1 - .../__tests__/fixtures/compiler/ssa-call-jsx.expect.md | 1 - .../__tests__/fixtures/compiler/ssa-leave-case.expect.md | 1 - .../compiler/ssa-property-alias-mutate.expect.md | 1 - ...-dynamically-constructed-component-function.expect.md | 1 - .../src/__tests__/fixtures/compiler/switch.expect.md | 1 - ...tion-expression-captures-value-later-frozen.expect.md | 3 --- .../compiler/todo-global-property-load-cached.expect.md | 1 - .../fixtures/compiler/transitive-freeze-array.expect.md | 1 - .../transitive-freeze-function-expressions.expect.md | 1 - ...in-function-expression-returns-caught-value.expect.md | 1 - .../fixtures/compiler/type-test-polymorphic.expect.md | 1 - ...onState-dispatch-considered-as-non-reactive.expect.md | 1 - ...ntext-read-context-in-callback-if-condition.expect.md | 1 - ...Reducer-returned-dispatcher-is-non-reactive.expect.md | 1 - ...d-setState-in-effect-from-ref-function-call.expect.md | 1 - 164 files changed, 3 insertions(+), 246 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md index 0b03ac99789..eb2d451c564 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver-and-mutate.expect.md @@ -35,10 +35,8 @@ function Component() { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const a = makeObject_Primitives(); - const x = []; x.push(a); - mutate(x); t0 = [x, a]; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver.expect.md index 2b9efc0f4a6..b7b89dc1a1d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/alias-capture-in-method-receiver.expect.md @@ -33,7 +33,6 @@ function Component() { if ($[1] === Symbol.for("react.memo_cache_sentinel")) { const x = []; x.push(a); - t1 = [x, a]; $[1] = t1; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-fn-expr.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-fn-expr.expect.md index b30ee7e0d68..e91766e79c5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-fn-expr.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-fn-expr.expect.md @@ -85,14 +85,10 @@ function Component(t0) { let t1; if ($[0] !== prop) { const obj = shallowCopy(prop); - const aliasedObj = identity(obj); - const getId = () => obj.id; - mutate(aliasedObj); setPropertyByKey(aliasedObj, "id", prop.id + 1); - t1 = ; $[0] = prop; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-truncated-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-truncated-dep.expect.md index 12c7b4d5eab..a44c3a1a5de 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-truncated-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/aliased-nested-scope-truncated-dep.expect.md @@ -181,12 +181,9 @@ function Component(t0) { if ($[0] !== prop) { const obj = shallowCopy(prop); const aliasedObj = identity(obj); - const id = [obj.id]; - mutate(aliasedObj); setPropertyByKey(aliasedObj, "id", prop.id + 1); - t1 = ; $[0] = prop; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/align-scopes-within-nested-valueblock-in-array.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/align-scopes-within-nested-valueblock-in-array.expect.md index 97b3bb13d70..aff7a2e7b99 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/align-scopes-within-nested-valueblock-in-array.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/align-scopes-within-nested-valueblock-in-array.expect.md @@ -54,7 +54,6 @@ function Foo(t0) { let t1; if ($[0] !== cond1 || $[1] !== cond2) { const arr = makeArray({ a: 2 }, 2, []); - t1 = cond1 ? ( <>
{identity("foo")}
diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.expect.md index 70320c37627..b39077c9535 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-in-callback-passed-to-jsx-indirect.expect.md @@ -49,7 +49,6 @@ function Component() { ref.current = ""; } }; - t0 = () => { setRef(); }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.expect.md index 4c979728f68..37407b5cd0b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-mutating-ref-property-in-callback-passed-to-jsx-indirect.expect.md @@ -49,7 +49,6 @@ function Component() { ref.current.value = ""; } }; - t0 = () => { setRef(); }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-type-cast-in-render.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-type-cast-in-render.expect.md index 56e3039f63c..ee7a71e8f8a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-type-cast-in-render.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/allow-ref-type-cast-in-render.expect.md @@ -36,7 +36,6 @@ function useArrayOfRef() { const callback = (value) => { ref.current = value; }; - t0 = [callback]; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-closure.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-closure.expect.md index 810f1a3f5e4..cd782c3f791 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-closure.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-at-closure.expect.md @@ -35,7 +35,6 @@ function Component(props) { const arr = [...bar(props)]; return arr.at(x); }; - t1 = fn(); $[2] = props; $[3] = x; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-spread-mutable-iterator.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-spread-mutable-iterator.expect.md index 25499af1b02..7aa0702d470 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-spread-mutable-iterator.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/array-spread-mutable-iterator.expect.md @@ -61,7 +61,6 @@ function useBar(t0) { if ($[0] !== arg) { const s = new Set([1, 5, 4]); const mutableIterator = s.values(); - t1 = [arg, ...mutableIterator]; $[0] = arg; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call.expect.md index b0bd96c2bf2..4482eab8e6a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/call.expect.md @@ -28,7 +28,6 @@ function Component(props) { const a = []; const b = {}; foo(a, b); - foo(b); t0 =
; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-ref-for-later-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-ref-for-later-mutation.expect.md index 223823621d0..158d31faca2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-ref-for-later-mutation.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capture-ref-for-later-mutation.expect.md @@ -45,7 +45,6 @@ function useKeyCommand() { const nextPosition = direction === "left" ? addOne(position) : position; currentPosition.current = nextPosition; }; - const moveLeft = { handler: handleKey("left") }; const moveRight = { handler: handleKey("right") }; t0 = [moveLeft, moveRight]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md index fcde7d675c8..03c0db7e971 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md @@ -45,7 +45,6 @@ function Component(t0) { z.a = 2; mutate(y.b); }; - x(); t1 = [y, z]; $[0] = a; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md index ba9e39e691b..602e49672e2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-emit-make-read-only.expect.md @@ -29,7 +29,6 @@ function MyComponentName(props) { const x = {}; foo(x, props.a); foo(x, props.b); - y = []; y.push(x); $[0] = props.a; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-reassign.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-reassign.expect.md index b7288a854ff..0778152f341 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-reassign.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-reassign.expect.md @@ -34,7 +34,6 @@ function useTest() { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { let w = {}; - const t1 = (w = 42); const t2 = w; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-storeprop.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-storeprop.expect.md index 85a66bb204c..7310e0fcd26 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-storeprop.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/codegen-inline-iife-storeprop.expect.md @@ -34,7 +34,6 @@ function useTest() { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const w = {}; - const t1 = (w.x = 42); const t2 = w.x; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md index f855f2231d0..0bcaf60a8e6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md @@ -44,11 +44,9 @@ function ComponentA(props) { if (b) { a.push(props.p0); } - if (props.p1) { b.push(props.p2); } - t0 = ; $[0] = props.p0; $[1] = props.p1; @@ -69,11 +67,9 @@ function ComponentB(props) { if (mayMutate(b)) { a.push(props.p0); } - if (props.p1) { b.push(props.p2); } - t0 = ; $[0] = props.p0; $[1] = props.p1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constructor.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constructor.expect.md index 6a01460e009..bfa6c830712 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constructor.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/constructor.expect.md @@ -28,7 +28,6 @@ function Component(props) { const a = []; const b = {}; new Foo(a, b); - new Foo(b); t0 =
; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/context-variable-reassigned-outside-of-lambda.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/context-variable-reassigned-outside-of-lambda.expect.md index 2edb60a5a2b..08b92e940fc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/context-variable-reassigned-outside-of-lambda.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/context-variable-reassigned-outside-of-lambda.expect.md @@ -34,7 +34,6 @@ function Component(props) { const callback = () => { console.log(x); }; - x = {}; t0 = ; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md index 17dd0f83594..3a8f9e84cac 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-and-local-variables-with-default.expect.md @@ -75,7 +75,6 @@ function Component(props) { let t0; if ($[0] !== post) { const allUrls = []; - const { media: t1, comments: t2, urls: t3 } = post; const media = t1 === undefined ? null : t1; let t4; @@ -102,7 +101,6 @@ function Component(props) { if (!comments.length) { return; } - console.log(comments.length); }; $[6] = comments.length; @@ -111,7 +109,6 @@ function Component(props) { t6 = $[7]; } const onClick = t6; - allUrls.push(...urls); t0 = ; $[0] = post; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md index f69149aba41..fbb6e50871d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/destructuring-mixed-scope-declarations-and-locals.expect.md @@ -53,7 +53,6 @@ function Component(props) { let t0; if ($[0] !== post) { const allUrls = []; - const { media, comments, urls } = post; let t1; if ($[2] !== comments.length) { @@ -61,7 +60,6 @@ function Component(props) { if (!comments.length) { return; } - console.log(comments.length); }; $[2] = comments.length; @@ -70,7 +68,6 @@ function Component(props) { t1 = $[3]; } const onClick = t1; - allUrls.push(...urls); t0 = ; $[0] = post; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md index 58013c15608..ce5bfda6440 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/dont-merge-if-dep-is-inner-declaration-of-previous-scope.expect.md @@ -57,7 +57,6 @@ function Component(t0) { let y; if ($[0] !== a || $[1] !== b || $[2] !== c) { x = []; - if (a) { let t1; if ($[5] !== b) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-conditionally-in-effect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-conditionally-in-effect.expect.md index 756a219e645..a3623dc299c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-conditionally-in-effect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/derived-state-conditionally-in-effect.expect.md @@ -46,7 +46,6 @@ function Component(t0) { setLocalValue("disabled"); } }; - t2 = [value, enabled]; $[0] = enabled; $[1] = value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.expect.md index 9a843d1883c..7948a49b3a8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/effect-derived-computations/ref-conditional-in-effect-no-error.expect.md @@ -50,7 +50,6 @@ export default function Component(t0) { setLocal(test + test); } }; - t2 = [test]; $[0] = test; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md index cee338b14e5..8ba85e3ff16 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md @@ -44,7 +44,6 @@ function Component(props) { let t0; if ($[0] !== props.a) { const a = [props.a]; - t0 = [a]; $[0] = props.a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md index 28c2a8e03b5..f3d5e8ac6af 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md @@ -40,13 +40,11 @@ function Component(props) { [ fbt._param( "a really long description that got split into multiple lines", - props.name, ), ], { hk: "1euPUp" }, ); - t0 = element.toString(); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md index eb41b86fdfd..62366dc5141 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md @@ -32,16 +32,9 @@ function Component(props) { if ($[0] !== props.name) { const element = fbt._( 'Hello {"user" name}', - [ - fbt._param( - '"user" name', - - props.name, - ), - ], + [fbt._param('"user" name', props.name)], { hk: "S0vMe" }, ); - t0 = element.toString(); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md index 60d23497466..6c3a94509eb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-unicode.expect.md @@ -32,16 +32,9 @@ function Component(props) { if ($[0] !== props.name) { const element = fbt._( "Hello {user name ☺}", - [ - fbt._param( - "user name \u263A", - - props.name, - ), - ], + [fbt._param("user name \u263A", props.name)], { hk: "1En1lp" }, ); - t0 = element.toString(); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-to-string.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-to-string.expect.md index eca12d2404c..9ad917e6f78 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-to-string.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/fbt/fbt-to-string.expect.md @@ -32,16 +32,9 @@ function Component(props) { if ($[0] !== props.name) { const element = fbt._( "Hello {user name}", - [ - fbt._param( - "user name", - - props.name, - ), - ], + [fbt._param("user name", props.name)], { hk: "2zEDKF" }, ); - t0 = element.toString(); $[0] = props.name; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md index 301a46a45c3..714cd931ae8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/flag-enable-emit-hook-guards.expect.md @@ -78,7 +78,6 @@ function Component(t0) { setState(5); } }; - t3 = [state]; $[1] = state; $[2] = t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-in-statement.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-in-statement.expect.md index 09fdaa65ac3..00ce1f020e0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-in-statement.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-in-statement.expect.md @@ -33,7 +33,6 @@ function Component(props) { for (const key in props) { items.push(
{key}
); } - t0 =
{items}
; $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-loop-with-value-block-initializer.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-loop-with-value-block-initializer.expect.md index 6ef73de8b04..a68e2a23fb2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-loop-with-value-block-initializer.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-loop-with-value-block-initializer.expect.md @@ -73,7 +73,6 @@ function Component(props) { const item = props.items[i]; items.push(
{item.value}
); } - t0 =
{items}
; $[0] = props.items; $[1] = props.start; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md index dd1a045e790..ceb5b9289df 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/for-of-mutate.expect.md @@ -38,7 +38,6 @@ function Component(_props) {
{toJSON(mutateAndReturn(item))}
, ); } - t0 =
{results}
; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md index 894c1ecc1d1..c8d6224645b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-maybe-mutates-hook-return-value.expect.md @@ -29,7 +29,6 @@ function Component(props) { const onLoad = () => { log(id); }; - t0 = ; $[0] = id; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call.expect.md index 714e61eb890..73dbdc7f9d4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/function-expression-prototype-call.expect.md @@ -27,7 +27,6 @@ function Component(props) { const f = function () { return
{props.name}
; }; - t0 = f.call(); $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-jsx-tag-lowered-between-mutations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-jsx-tag-lowered-between-mutations.expect.md index e355f58da9a..dbd57bc2f70 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-jsx-tag-lowered-between-mutations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-jsx-tag-lowered-between-mutations.expect.md @@ -29,7 +29,6 @@ function Component(props) { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const maybeMutable = new MaybeMutable(); - t0 = {maybeMutate(maybeMutable)}; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-constructor-arg.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-constructor-arg.expect.md index e0d675a2c74..245d11243a9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-constructor-arg.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-constructor-arg.expect.md @@ -60,7 +60,6 @@ function useFoo(t0) { if ($[3] !== propArr[1] || $[4] !== propArr[2]) { s2 = new Set(MODULE_LOCAL.values()); s2.add(propArr[1]); - s3 = new Set(s2.values()); s3.add(propArr[2]); $[3] = propArr[1]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-copy-constructor-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-copy-constructor-mutate.expect.md index d5fcb7f73de..78bac9ae4f5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-copy-constructor-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/global-types/set-copy-constructor-mutate.expect.md @@ -41,7 +41,6 @@ function useFoo(t0) { if ($[0] !== propArr[0]) { s1 = new Set([1, 2, 3]); s1.add(makeArray(propArr[0])); - s2 = new Set(s1); mutate(s2); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoist-destruct.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoist-destruct.expect.md index 24711915e52..97a2615f43c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoist-destruct.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoist-destruct.expect.md @@ -37,7 +37,6 @@ function Foo() {
); }; - const [t1, t2] = [1, { x: 2 }]; const a = t1; const { x: t3, y: t4 } = t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-computed-member-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-computed-member-expression.expect.md index ca465debafc..db1168548bd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-computed-member-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-computed-member-expression.expect.md @@ -39,14 +39,11 @@ function hoisting() { const onClick = function onClick() { return bar.baz; }; - const onClick2 = function onClick2() { return bar[baz]; }; - const baz = "baz"; const bar = { baz: 1 }; - t0 = ( ); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-functionexpr-conditional-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-functionexpr-conditional-dep.expect.md index 96a1d3e5726..4c032f697f0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-functionexpr-conditional-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-functionexpr-conditional-dep.expect.md @@ -66,7 +66,6 @@ function Component(t0) { return null; } }; - t1 = ; $[0] = isObjNull; $[1] = obj; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-let-declaration-without-initialization.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-let-declaration-without-initialization.expect.md index 0e4b3b64e82..a67bd73fa82 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-let-declaration-without-initialization.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-let-declaration-without-initialization.expect.md @@ -36,12 +36,10 @@ function useHook(t0) { let t1; if ($[0] !== cond) { const getX = () => x; - let x; if (cond) { x = CONST_NUMBER1; } - t1 = ; $[0] = cond; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-member-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-member-expression.expect.md index 2a2a00bf3d6..441dab58814 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-member-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-member-expression.expect.md @@ -34,9 +34,7 @@ function hoisting() { const onClick = function onClick(x) { return x + bar.baz; }; - const bar = { baz: 1 }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration.expect.md index 301ca4e8a5f..2b661a58b42 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-const-declaration.expect.md @@ -36,13 +36,10 @@ function hoisting() { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const qux = () => { let result; - result = foo(); return result; }; - const foo = () => bar + baz; - const bar = 3; const baz = 2; t0 = qux(); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-let-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-let-declaration.expect.md index faf7a064d74..cd2a9d32538 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-let-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-nested-let-declaration.expect.md @@ -36,13 +36,10 @@ function hoisting() { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const qux = () => { let result; - result = foo(); return result; }; - let foo = () => bar + baz; - let bar = 3; const baz = 2; t0 = qux(); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-object-method.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-object-method.expect.md index df1797fc85b..bc7c402b941 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-object-method.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-object-method.expect.md @@ -36,7 +36,6 @@ function hoisting() { }, }; const bar = _temp; - t0 = x.foo(); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-let-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-let-declaration.expect.md index c4a969c8884..f393597719d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-let-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-let-declaration.expect.md @@ -36,13 +36,11 @@ function useHook(t0) { let t1; if ($[0] !== cond) { const getX = () => x; - let x = CONST_NUMBER0; if (cond) { x = x + CONST_NUMBER1; x; } - t1 = ; $[0] = cond; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-twice-let-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-twice-let-declaration.expect.md index cdeb9c60aab..7d6461e3a9f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-twice-let-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-reassigned-twice-let-declaration.expect.md @@ -37,14 +37,12 @@ function useHook(t0) { let t1; if ($[0] !== cond) { const getX = () => x; - let x = CONST_NUMBER0; if (cond) { x = x + CONST_NUMBER1; x; x = Math.min(x, 100); } - t1 = ; $[0] = cond; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md index ef486bc7fa2..61fbfc5efec 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-recursive-call.expect.md @@ -37,7 +37,6 @@ function Foo(t0) { return x * factorial(x - 1); } }; - t1 = factorial(value); $[0] = value; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-repro-variable-used-in-assignment.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-repro-variable-used-in-assignment.expect.md index 2389c7e9763..a4775bc45be 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-repro-variable-used-in-assignment.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-repro-variable-used-in-assignment.expect.md @@ -30,7 +30,6 @@ function get2() { const copy = x; return copy; }; - const x = 2; t0 = callbk(); $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.expect.md index c0c2bff9f7a..9397518d2d1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-setstate-captured-indirectly-jsx.expect.md @@ -49,7 +49,6 @@ function useFoo() { let t2; if ($[2] !== handleLogout) { const getComponent = () => handleLogout()} />; - t2 = getComponent(); $[2] = handleLogout; $[3] = t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-simple-function-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-simple-function-expression.expect.md index 86e65086dab..2df5c8ec44e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-simple-function-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hoisting-simple-function-expression.expect.md @@ -30,9 +30,7 @@ function hoisting() { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const foo = () => bar(); - const bar = _temp; - t0 = foo(); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md index c7fcfd1daae..1170f6a60a8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/hooks-with-prefix.expect.md @@ -61,7 +61,6 @@ function Component() { let t1; if ($[2] !== state) { const doubledArray = makeArray(state); - t1 = doubledArray.join(""); $[2] = state; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/idx-no-outlining.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/idx-no-outlining.expect.md index 880cdcdb210..aec4231c8dd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/idx-no-outlining.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/idx-no-outlining.expect.md @@ -29,7 +29,6 @@ function Component(props) { let t0; if ($[0] !== props) { var _ref; - t0 = (_ref = props) != null ? (_ref = _ref.group) != null diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/iife-return-modified-later-phi.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/iife-return-modified-later-phi.expect.md index a3b3b843a9d..22f967883b0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/iife-return-modified-later-phi.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/iife-return-modified-later-phi.expect.md @@ -30,7 +30,6 @@ function Component(props) { let items; if ($[0] !== props.a || $[1] !== props.cond) { let t0; - if (props.cond) { t0 = []; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md index 8afc59a80ba..cde1360bf04 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/incompatible-destructuring-kinds.expect.md @@ -34,7 +34,6 @@ function Component(t0) { let t1; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { a = "a"; - const [t2, t3] = [null, null]; t1 = t3; a = t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-nested-object-method.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-nested-object-method.expect.md index 963bbc7d3e8..7ac27ab8144 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-nested-object-method.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/infer-nested-object-method.expect.md @@ -40,7 +40,6 @@ function Test() { return _temp; }, }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/conditional-call-chain.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/conditional-call-chain.expect.md index 6114996b896..4622beeb0eb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/conditional-call-chain.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/conditional-call-chain.expect.md @@ -77,7 +77,6 @@ function Component(t0) { hasLogged.current = true; } }; - t3 = ; $[4] = logA; $[5] = logB; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/use-memo-returned.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/use-memo-returned.expect.md index 32d454712f3..bba86b3ce8c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/use-memo-returned.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/assume-invoked/use-memo-returned.expect.md @@ -47,7 +47,6 @@ import { useIdentity } from "shared-runtime"; function useMakeCallback(t0) { const $ = _c(2); const { obj, shouldSynchronizeState } = t0; - const [, setState] = useState(0); let t1; if ($[0] !== obj.value) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md index 735462657f9..211007ef561 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md @@ -33,7 +33,6 @@ function Component(props) { let t1; if ($[0] !== item) { const count = new MaybeMutable(item); - T1 = View; T0 = View; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md index b1e18f940da..812aa0ba770 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md @@ -25,7 +25,6 @@ function Component(props) { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const count = new MaybeMutable(); - t0 = ( diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/invalid-setState-in-useEffect-transitive.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/invalid-setState-in-useEffect-transitive.expect.md index 6e5762f3c88..a327d0b8bd6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/invalid-setState-in-useEffect-transitive.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/invalid-setState-in-useEffect-transitive.expect.md @@ -35,7 +35,6 @@ function Component() { const f = () => { setState(_temp); }; - t0 = () => { f(); }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md index d46ce53bb03..afebfba378d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md @@ -59,7 +59,6 @@ function Component(props) { if ($[0] !== props.alternateComponent || $[1] !== props.component) { const maybeMutable = new MaybeMutable(); Tag = props.component; - T0 = Tag; t0 = ((Tag = props.alternateComponent), maybeMutate(maybeMutable)); $[0] = props.alternateComponent; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-captured.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-captured.expect.md index f99857fca33..eac52a68b5e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-captured.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-captured.expect.md @@ -32,9 +32,7 @@ function Foo() { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const x = [{ value: 0 }, { value: 1 }, { value: 2 }]; - const foo = () => x[CONST_NUMBER0].value; - t0 = invoke(foo); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-param.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-param.expect.md index fcf52f52926..5c0e939d524 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-param.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-array-access-member-expr-param.expect.md @@ -32,7 +32,6 @@ function Foo() { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const x = [{ value: 0 }, { value: 1 }, { value: 2 }]; const foo = (param) => x[param].value; - t0 = invoke(foo, 1); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md index bac21217c75..ea9e981ba29 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md @@ -46,12 +46,10 @@ function CaptureNotMutate(props) { let aliasedElement; if ($[2] !== idx || $[3] !== props.el) { const element = bar(props.el); - const fn = function () { const arr = { element }; return arr[idx]; }; - aliasedElement = fn(); mutate(aliasedElement); $[2] = idx; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md index 6cfdb6ca1f9..a8069809b66 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.expect.md @@ -36,7 +36,6 @@ function Component(props) { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const object = {}; - t0 = () => { mutate(object); }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/multiple-calls-to-hoisted-callback-from-other-callback.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/multiple-calls-to-hoisted-callback-from-other-callback.expect.md index 57ca944af6b..ba9b6684c9d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/multiple-calls-to-hoisted-callback-from-other-callback.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/multiple-calls-to-hoisted-callback-from-other-callback.expect.md @@ -43,18 +43,15 @@ function Component(props) { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const a = () => b(); - const b = () => ( <>
onClick(true)}>a
onClick(false)}>b
); - const onClick = (value) => { setState(value); }; - t0 =
{a()}
; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-loops.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-loops.expect.md index 4b76d62482e..dacee742440 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-loops.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-loops.expect.md @@ -94,19 +94,14 @@ function testFunction(props) { break; } } - if (a) { } - if (b) { } - if (c) { } - if (d) { } - mutate(d, null); t0 = { a, b, c, d }; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.expect.md index 2dffce2ce27..8510bd2ecc8 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutable-lifetime-with-aliasing.expect.md @@ -74,7 +74,6 @@ function Component(props) { const b = [a]; const c = {}; const d = { c }; - x = {}; x.b = b; const y = mutate(x, d); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutate-outer-scope-within-value-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutate-outer-scope-within-value-block.expect.md index dcade9000aa..4633a1f8072 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutate-outer-scope-within-value-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutate-outer-scope-within-value-block.expect.md @@ -76,7 +76,6 @@ function useFoo(t0) { let t1; if ($[0] !== input) { const arr = shallowCopy(input); - const cond = identity(false); t1 = cond ? { val: CONST_TRUE } : mutate(arr); $[0] = input; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-during-jsx-construction.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-during-jsx-construction.expect.md index b02b76eac0e..b60832af667 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-during-jsx-construction.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-during-jsx-construction.expect.md @@ -32,7 +32,6 @@ function Component(props) { let element; if ($[0] !== props.value) { const key = {}; - element =
{props.value}
; mutate(key); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-within-capture-and-mutablerange.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-within-capture-and-mutablerange.expect.md index ef416015574..ee091e29983 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-within-capture-and-mutablerange.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/mutation-within-capture-and-mutablerange.expect.md @@ -58,7 +58,6 @@ function useFoo(t0) { const x = { a }; const y = [b]; mutate(x); - z = [mutate(y)]; mutate(y); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.expect.md index 8024676c65a..64b08ebd462 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/aliased-nested-scope-truncated-dep.expect.md @@ -182,12 +182,9 @@ function Component(t0) { if ($[0] !== prop) { const obj = shallowCopy(prop); const aliasedObj = identity(obj); - const id = [obj.id]; - mutate(aliasedObj); setPropertyByKey(aliasedObj, "id", prop.id + 1); - t1 = ; $[0] = prop; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/basic-mutation-via-function-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/basic-mutation-via-function-expression.expect.md index 8b767931a89..72f0e7fb28e 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/basic-mutation-via-function-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/basic-mutation-via-function-expression.expect.md @@ -31,7 +31,6 @@ function Component(t0) { y.x = x; mutate(y); }; - f(); t1 =
{x}
; $[0] = a; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.expect.md index a77dad5fe77..99e9a66924a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-backedge-phi-with-later-mutation.expect.md @@ -53,7 +53,6 @@ function Component(t0) { let z; if ($[0] !== prop1 || $[1] !== prop2) { let x = [{ value: prop1 }]; - while (x.length < 2) { arrayPush(x, { value: prop2 }); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-in-function-expression-indirect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-in-function-expression-indirect.expect.md index 326cd9f7e0d..34c41ff54cf 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-in-function-expression-indirect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/capture-in-function-expression-indirect.expect.md @@ -48,7 +48,6 @@ function Component(t0) { const b = { x }; a.y.x = b; }; - f0(); mutate(y); t1 = ; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/iife-return-modified-later-phi.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/iife-return-modified-later-phi.expect.md index a3b3b843a9d..22f967883b0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/iife-return-modified-later-phi.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/iife-return-modified-later-phi.expect.md @@ -30,7 +30,6 @@ function Component(props) { let items; if ($[0] !== props.a || $[1] !== props.cond) { let t0; - if (props.cond) { t0 = []; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections-2.expect.md index 013da083261..b42bfb001ee 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections-2.expect.md @@ -41,7 +41,6 @@ function Component(t0) { const y = [x]; return y[0]; }; - const x0 = f(); const z = [x0]; const x1 = z[0]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections.expect.md index f8ceba27158..4dcb9110ab0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/mutate-through-boxing-unboxing-function-call-indirections.expect.md @@ -42,7 +42,6 @@ function Component(t0) { const x0 = y[0]; return [x0]; }; - const z = f(); const x1 = z[0]; x1.key = "value"; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/object-expression-computed-member.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/object-expression-computed-member.expect.md index b899212b5ba..713a3112fe2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/object-expression-computed-member.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/object-expression-computed-member.expect.md @@ -32,7 +32,6 @@ function Component(props) { let context; if ($[0] !== props.value) { const key = { a: "key" }; - const t0 = key.a; const t1 = identity([props.value]); let t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-function-expression-effects-stack-overflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-function-expression-effects-stack-overflow.expect.md index 9d168c9e5c1..fe47e6b0a02 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-function-expression-effects-stack-overflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-function-expression-effects-stack-overflow.expect.md @@ -45,7 +45,6 @@ function Component() { .build({}) .build({}); }; - t1 = ; $[1] = t1; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-invalid-function-expression-effects-phi.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-invalid-function-expression-effects-phi.expect.md index 73cf419be14..6043495bc19 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-invalid-function-expression-effects-phi.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-invalid-function-expression-effects-phi.expect.md @@ -38,10 +38,8 @@ function Component(t0) { while (z == null) { z = x; } - z.y = y; }; - f(); mutate(x); t1 =
{x}
; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-jsx-captures-value-mutated-later.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-jsx-captures-value-mutated-later.expect.md index 109219e03ad..ef8a2dc1757 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-jsx-captures-value-mutated-later.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/repro-jsx-captures-value-mutated-later.expect.md @@ -33,11 +33,8 @@ function Example() { let t0; if ($[0] !== data) { const { a, b } = identity(data); - const el = ; - identity(a.at(0)); - t0 = ; $[0] = data; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/useCallback-reordering-deplist-controlflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/useCallback-reordering-deplist-controlflow.expect.md index 6c45eb8bfaf..5d2691efdc2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/useCallback-reordering-deplist-controlflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/new-mutability/useCallback-reordering-deplist-controlflow.expect.md @@ -56,9 +56,7 @@ function Foo(t0) { let t2; if ($[2] !== arr2 || $[3] !== foo || $[4] !== x) { let y = []; - getVal1 = _temp; - t2 = () => [y]; foo ? (y = x.concat(arr2)) : y; $[2] = arr2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-key-mutate-key-while-constructing-object.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-key-mutate-key-while-constructing-object.expect.md index 4c4b45967e2..77d3653e0c1 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-key-mutate-key-while-constructing-object.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-key-mutate-key-while-constructing-object.expect.md @@ -30,7 +30,6 @@ function Component(props) { let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const key = {}; - t0 = mutateAndReturn(key); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-member.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-member.expect.md index 8d1615f65c6..49be82b146b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-member.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/object-expression-computed-member.expect.md @@ -31,7 +31,6 @@ function Component(props) { let context; if ($[0] !== props.value) { const key = { a: "key" }; - const t0 = key.a; const t1 = identity([props.value]); let t2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md index 2f93ccd2758..b313cc20762 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md @@ -27,7 +27,6 @@ function Component(props) { let t0; if ($[0] !== props) { const x = makeOptionalFunction(props); - t0 = x?.(
{props.text} diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.expect.md index b5babb37cdf..7e79b2d0437 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.expect.md @@ -46,7 +46,6 @@ function useKeyCommand() { const nextPosition = direction === "left" ? addOne(position) : position; currentPosition.current = nextPosition; }; - const moveLeft = { handler: handleKey("left") }; const moveRight = { handler: handleKey("right") }; t0 = [moveLeft, moveRight]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push-consecutive-phis.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push-consecutive-phis.expect.md index 16edbf2e236..2bfb21bc673 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push-consecutive-phis.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push-consecutive-phis.expect.md @@ -75,9 +75,7 @@ function Component(props) { } else { y = []; } - y.push(x); - t1 = [x, y]; $[1] = props.cond; $[2] = props.cond2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md index 58e2c8f869a..9fc02ca3b90 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-array-push.expect.md @@ -53,9 +53,7 @@ function Component(props) { } else { y = []; } - y.push(x); - t1 = [x, y]; $[1] = props.cond; $[2] = props.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md index 9223c612001..f0a4ad368ff 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/phi-type-inference-property-store.expect.md @@ -49,9 +49,7 @@ function Component(props) { } else { y = { a: props.a }; } - y.x = x; - t1 = [x, y]; $[1] = props.a; $[2] = props.cond; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns-primitive.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns-primitive.expect.md index 27fdecd79fa..8850f869d07 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns-primitive.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns-primitive.expect.md @@ -34,7 +34,6 @@ import { identity } from "shared-runtime"; function useFoo(cond) { let t0; - if (cond) { t0 = 2; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns.expect.md index cddc2dd86b9..af959b9865b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/prune-nonescaping-useMemo-mult-returns.expect.md @@ -34,7 +34,6 @@ import { identity } from "shared-runtime"; function useFoo(cond) { let t0; - if (cond) { t0 = identity(10); } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md index 3da133e9295..350fdcfd43a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-in-other-reactive-block.expect.md @@ -52,7 +52,6 @@ function useFoo(minWidth, otherProp) { t1 = $[6]; } const style = t1; - arrayPush(x, otherProp); t0 = [style, x]; $[0] = minWidth; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md index db5ff86ed23..2daa1d187c2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useCallback-reordering-deplist-controlflow.expect.md @@ -56,9 +56,7 @@ function Foo(t0) { let t2; if ($[2] !== arr2 || $[3] !== foo || $[4] !== x) { let y = []; - getVal1 = _temp; - t2 = () => [y]; foo ? (y = x.concat(arr2)) : y; $[2] = arr2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md index a3f36517fff..742b82098ff 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-in-other-reactive-block.expect.md @@ -42,7 +42,6 @@ function useFoo(minWidth, otherProp) { let t0; if ($[0] !== minWidth || $[1] !== otherProp || $[2] !== width) { const x = []; - const t1 = Math.max(minWidth, width); let t2; if ($[4] !== t1) { @@ -53,7 +52,6 @@ function useFoo(minWidth, otherProp) { t2 = $[5]; } const style = t2; - arrayPush(x, otherProp); t0 = [style, x]; $[0] = minWidth; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md index d208ce4fb74..ebeef5ce823 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/preserve-memo-validation/useMemo-reordering-depslist-controlflow.expect.md @@ -47,7 +47,6 @@ function Foo(t0) { let val1; if ($[0] !== arr1 || $[1] !== arr2 || $[2] !== foo) { const x = [arr1]; - let y = []; let t2; if ($[5] === Symbol.for("react.memo_cache_sentinel")) { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/conditional-on-mutable.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/conditional-on-mutable.expect.md index 7e0d9d2e64e..7c2392453ca 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/conditional-on-mutable.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/conditional-on-mutable.expect.md @@ -45,11 +45,9 @@ function ComponentA(props) { if (b) { a.push(props.p0); } - if (props.p1) { b.push(props.p2); } - t0 = ; $[0] = props.p0; $[1] = props.p1; @@ -70,11 +68,9 @@ function ComponentB(props) { if (mayMutate(b)) { a.push(props.p0); } - if (props.p1) { b.push(props.p2); } - t0 = ; $[0] = props.p0; $[1] = props.p1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/iife-return-modified-later-phi.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/iife-return-modified-later-phi.expect.md index 6d88e411c0d..2a3da8b195a 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/iife-return-modified-later-phi.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/iife-return-modified-later-phi.expect.md @@ -31,7 +31,6 @@ function Component(props) { let items; if ($[0] !== props.a || $[1] !== props.cond) { let t0; - if (props.cond) { t0 = []; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/infer-component-props-non-null.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/infer-component-props-non-null.expect.md index 8079511850a..2c3b7930a73 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/infer-component-props-non-null.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/infer-component-props-non-null.expect.md @@ -47,7 +47,6 @@ function Foo(props) { } arr.push(t1); } - t0 = ; $[0] = props.cond; $[1] = props.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push-consecutive-phis.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push-consecutive-phis.expect.md index 4ae80006678..662f6c33f6c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push-consecutive-phis.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push-consecutive-phis.expect.md @@ -76,9 +76,7 @@ function Component(props) { } else { y = []; } - y.push(x); - t1 = [x, y]; $[1] = props.cond; $[2] = props.cond2; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push.expect.md index 0b756a648ec..a9a07e97244 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-array-push.expect.md @@ -54,9 +54,7 @@ function Component(props) { } else { y = []; } - y.push(x); - t1 = [x, y]; $[1] = props.cond; $[2] = props.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-property-store.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-property-store.expect.md index 6c7a91ba33b..fb2d28b0306 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-property-store.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/phi-type-inference-property-store.expect.md @@ -49,9 +49,7 @@ function Component(props) { } else { y = { a: props.a }; } - y.x = x; - t1 = [x, y]; $[1] = props.a; $[2] = props.cond; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-nested-function-uncond-access.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-nested-function-uncond-access.expect.md index 7ffc258b3d6..77f5ae4db3c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-nested-function-uncond-access.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/infer-nested-function-uncond-access.expect.md @@ -36,7 +36,6 @@ function useFoo(t0) { let t1; if ($[0] !== a.b.c) { const fn = () => () => ({ value: a.b.c }); - t1 = ; $[0] = a.b.c; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md index af49da4b648..53dae3e6eeb 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md @@ -71,7 +71,6 @@ function useJoinCondDepsInUncondScopes(props) { if (CONST_TRUE) { setProperty(x, props.a.b); } - setProperty(y, props.a.b); t0 = [x, y]; $[0] = props.a.b; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md index cc6713b2950..2b3d6598d91 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/ssa-leave-case.expect.md @@ -49,7 +49,6 @@ function Component(props) { x.push(props.p1); y = x; } - t0 = ( {x} diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md index c86cba7cc88..77661de5f07 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/propagate-scope-deps-hir-fork/switch.expect.md @@ -34,7 +34,6 @@ function Component(props) { let y; if ($[0] !== props.p0 || $[1] !== props.p2 || $[2] !== props.p3) { const x = []; - switch (props.p0) { case true: { x.push(props.p2); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-jsx.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-jsx.expect.md index 840b79a06b5..34c1400ec15 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-jsx.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-invalidate-jsx.expect.md @@ -45,7 +45,6 @@ function Component(props) { let t1; if ($[2] !== x) { const y =
{x}
; - t1 =
{y}
; $[2] = x; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-may-invalidate-array.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-may-invalidate-array.expect.md index 953cbef5a7e..7db6242783c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-may-invalidate-array.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/prune-scopes-whose-deps-may-invalidate-array.expect.md @@ -42,7 +42,6 @@ function Component(props) { let t0; if ($[0] !== x) { const y = [x]; - t0 = [y]; $[0] = x; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-dependency-object-captured-with-reactive-mutated.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-dependency-object-captured-with-reactive-mutated.expect.md index d058210fe11..9ced7db26af 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-dependency-object-captured-with-reactive-mutated.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-dependency-object-captured-with-reactive-mutated.expect.md @@ -34,7 +34,6 @@ function Component(props) { const y = props.y; const z = [x, y]; mutate(z); - t0 = [x]; $[0] = props.y; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-scopes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-scopes.expect.md index 89beacbd5cf..2481270f048 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactive-scopes.expect.md @@ -35,7 +35,6 @@ function f(a, b) { x.push(b); } } - t0 =
{x}
; $[0] = a.length; $[1] = b; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md index 28263b6dbaf..43d96c41970 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md @@ -42,9 +42,7 @@ function Component(props) { const b = []; b.push(props.b); a.a = null; - const c = [a]; - t0 = [c, a]; $[0] = props.b; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassign-in-while-loop-condition.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassign-in-while-loop-condition.expect.md index fe19099b161..0b0fc73df6f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassign-in-while-loop-condition.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassign-in-while-loop-condition.expect.md @@ -39,7 +39,6 @@ function Component() { while ((item = items.pop())) { sum = sum + item; } - t0 = [items, sum]; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md index 4baca5ad6d4..82d59c358f2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md @@ -29,7 +29,6 @@ function Component(props) { let x = []; x.push(props.p0); const y = x; - if (props.p1) { let t1; if ($[4] === Symbol.for("react.memo_cache_sentinel")) { @@ -40,9 +39,7 @@ function Component(props) { } x = t1; } - y.push(props.p2); - t0 = ; $[0] = props.p0; $[1] = props.p1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md index 422f4cf5475..3c1baee994c 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md @@ -49,7 +49,6 @@ function foo(a, b, c) { if (a) { x.push(a); } - t0 =
{x}
; $[0] = a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment.expect.md index 3804326553c..de0f4d7449d 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reassignment.expect.md @@ -36,9 +36,7 @@ function Component(props) { t1 = $[3]; } x = t1; - y.push(props.p1); - t0 = ; $[0] = props.p0; $[1] = props.p1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/recursive-function-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/recursive-function-expression.expect.md index 1e7295da57f..9217d137201 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/recursive-function-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/recursive-function-expression.expect.md @@ -62,7 +62,6 @@ function Component() { } return callback(x - 1); } - t0 = callback(10); $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md index 37d347cd9a0..d4b473c2006 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/reduce-reactive-deps/join-uncond-scopes-cond-deps.expect.md @@ -69,7 +69,6 @@ function useJoinCondDepsInUncondScopes(props) { if (CONST_TRUE) { setProperty(x, props.a.b); } - setProperty(y, props.a.b); t0 = [x, y]; $[0] = props.a.b; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-no-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-no-added-to-dep.expect.md index 0c8583d402c..b726a723cb0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-no-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-no-added-to-dep.expect.md @@ -28,7 +28,6 @@ function VideoTab() { const x = () => { console.log(t); }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md index 63268de4271..dd72a91d087 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-aliased-not-added-to-dep-2.expect.md @@ -25,7 +25,6 @@ function Foo(t0) { let t1; if ($[0] !== a) { const x = { a, val }; - t1 = ; $[0] = a; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-not-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-not-added-to-dep.expect.md index 2d64bbd5ad5..b7f1bd6c336 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-not-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-not-added-to-dep.expect.md @@ -26,7 +26,6 @@ function VideoTab() { const x = () => { console.log(ref.current.x); }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-write-not-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-write-not-added-to-dep.expect.md index fab497b4aaa..179e9037de4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-write-not-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-field-write-not-added-to-dep.expect.md @@ -41,7 +41,6 @@ function Component() { const inputChanged = (e) => { ref.current.text.value = e.target.value; }; - t1 = ; $[1] = t1; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md index 76a1b00776e..3d50eafb503 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep-2.expect.md @@ -23,7 +23,6 @@ function Foo(t0) { let t1; if ($[0] !== a) { const x = { a, val: ref.current }; - t1 = ; $[0] = a; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep.expect.md index 567b6329a7c..4497a823d36 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-not-added-to-dep.expect.md @@ -25,7 +25,6 @@ function VideoTab() { const x = () => { console.log(ref.current); }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-optional-field-no-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-optional-field-no-added-to-dep.expect.md index 85bb7b65c5a..a55709b2826 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-optional-field-no-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-optional-field-no-added-to-dep.expect.md @@ -25,7 +25,6 @@ function VideoTab() { const x = () => { ref.current?.x; }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-write-not-added-to-dep.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-write-not-added-to-dep.expect.md index f2feb9ef52a..6c6aae35263 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-write-not-added-to-dep.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ref-current-write-not-added-to-dep.expect.md @@ -25,7 +25,6 @@ function VideoTab() { const x = () => { ref.current = 1; }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/regexp-literal.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/regexp-literal.expect.md index 6ea6bdcabfa..80b90980bcf 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/regexp-literal.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/regexp-literal.expect.md @@ -26,7 +26,6 @@ function Component(props) { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const pattern = /foo/g; value = makeValue(); - t0 = pattern.test(value); $[0] = t0; $[1] = value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rename-source-variables-nested-function.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rename-source-variables-nested-function.expect.md index f9471d99501..e8d1d04b061 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rename-source-variables-nested-function.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/rename-source-variables-nested-function.expect.md @@ -57,7 +57,6 @@ function useFoo(props) { }; return b; }; - t1 = a()()(); $0[0] = props.value; $0[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-aliased-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-aliased-mutate.expect.md index 5a866044bde..d306b152dd0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-aliased-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-aliased-mutate.expect.md @@ -73,7 +73,6 @@ function useFoo(t0) { if ($[0] !== a || $[1] !== b) { const x = []; const y = { value: a }; - arrayPush(x, y); const y_alias = y; const cb = () => y_alias.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-mutate.expect.md index 1427ec8eb50..c3b5d6d9256 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-aliased-capture-mutate.expect.md @@ -54,14 +54,12 @@ function useFoo(t0) { if ($[0] !== a) { const arr = []; const obj = { value: a }; - setPropertyByKey(obj, "arr", arr); const obj_alias = obj; const cb = () => obj_alias.arr.length; for (let i = 0; i < a; i++) { arr.push(i); } - t1 = ; $[0] = a; $[1] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-false-positive-ref-validation-in-use-effect.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-false-positive-ref-validation-in-use-effect.expect.md index fd7f195a54f..cb51d86d0b2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-false-positive-ref-validation-in-use-effect.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-false-positive-ref-validation-in-use-effect.expect.md @@ -68,7 +68,6 @@ function Component() { update(); } }; - t2 = [update]; $[2] = update; $[3] = t1; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md index 0089d20af2f..ea711a5baf4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-independently-memoized-property-load-for-method-call.expect.md @@ -61,11 +61,8 @@ function Component(t0) { let timestampLabel; if ($[0] !== highlightedItem || $[1] !== label || $[2] !== serverTime) { const highlight = new Highlight(highlightedItem); - const time = serverTime.get(); - timestampLabel = time / 1000 || label; - t1 = highlight.render(); $[0] = highlightedItem; $[1] = label; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-instruction-part-of-already-closed-scope.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-instruction-part-of-already-closed-scope.expect.md index 2d657abf327..f141eaa64f4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-instruction-part-of-already-closed-scope.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-instruction-part-of-already-closed-scope.expect.md @@ -46,7 +46,6 @@ function Component(t0) { const a = identity(data, index); const b = identity(data, index); const c = identity(data, index); - const t4 = identity(b); if ($[6] !== t4) { t2 = ; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-dependency-if-within-while.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-dependency-if-within-while.expect.md index d61a48b441a..b45977b6953 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-dependency-if-within-while.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-missing-dependency-if-within-while.expect.md @@ -51,7 +51,6 @@ export default function Component(props) { i++; } } - t0 = <>{items}; $[0] = b; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-ref-in-function-passed-to-hook.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-ref-in-function-passed-to-hook.expect.md index 03bca61ad1e..83aa4107748 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-ref-in-function-passed-to-hook.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-ref-in-function-passed-to-hook.expect.md @@ -89,7 +89,6 @@ function Example() { observer.disconnect(); }; }; - t3 = []; $[2] = t2; $[3] = t3; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-function-call-with-frozen-argument-in-function-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-function-call-with-frozen-argument-in-function-expression.expect.md index ef65f6026e5..20eab399ba0 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-function-call-with-frozen-argument-in-function-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-function-call-with-frozen-argument-in-function-expression.expect.md @@ -39,7 +39,6 @@ function Example(props) { obj.property = props.value; return obj; }; - t0 = f(); $[0] = object; $[1] = props.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-method-call-on-frozen-value-in-function-expression.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-method-call-on-frozen-value-in-function-expression.expect.md index 4df503bcd22..e5456ed8582 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-method-call-on-frozen-value-in-function-expression.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-mutate-result-of-method-call-on-frozen-value-in-function-expression.expect.md @@ -39,7 +39,6 @@ function Example(props) { obj.property = props.value; return obj; }; - t0 = f(); $[0] = object; $[1] = props.value; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md index 6cf8820e984..063a9df073f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-declarations-in-reactive-scope-with-early-return.expect.md @@ -62,7 +62,6 @@ function Component() { t1 = t2; break bb0; } - t0 = filteredItems.map(_temp2); } $[0] = items; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md index 34d4ded6169..925470cc6a3 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-no-value-for-temporary-reactive-scope-with-early-return.expect.md @@ -50,7 +50,6 @@ function Component(props) { t1 = null; break bb0; } - t0 = (
{fbt._( diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-renaming-conflicting-decls.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-renaming-conflicting-decls.expect.md index 68dc127bc1e..8a56a464747 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-renaming-conflicting-decls.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-renaming-conflicting-decls.expect.md @@ -57,7 +57,6 @@ function Component(props) { t1 = null; break bb0; } - t0 = identity(propsString); } $[0] = props; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.expect.md index 0da18e5f656..5ba1dbd7804 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-mutates-context.expect.md @@ -63,7 +63,6 @@ function Foo(t0) { obj.value = newValue; obj.a = a; }; - const updater = updaterFactory(); updater(b); t1 = ; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-reassigns-context.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-reassigns-context.expect.md index da6b57defe0..690c21f0efc 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-reassigns-context.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-returned-inner-fn-reassigns-context.expect.md @@ -61,7 +61,6 @@ function Foo(t0) { const fnFactory = () => () => { myVar = _temp; }; - let myVar = _temp2; useIdentity(); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-undefined-expression-of-jsxexpressioncontainer.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-undefined-expression-of-jsxexpressioncontainer.expect.md index c5a34bc4cad..5a67449fff4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-undefined-expression-of-jsxexpressioncontainer.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-undefined-expression-of-jsxexpressioncontainer.expect.md @@ -53,9 +53,7 @@ function Component(props) { let t0; if ($[0] !== buttons) { const [, ...nonPrimaryButtons] = buttons; - const renderedNonPrimaryButtons = nonPrimaryButtons.map(_temp); - t0 = {renderedNonPrimaryButtons}; $[0] = buttons; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md index fe7857a355e..ee2c82048a9 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-unmerged-fbt-call-merge-overlapping-reactive-scopes.expect.md @@ -44,7 +44,6 @@ function Component(props) { [fbt._plural(props.value.length, "number")], { hk: "4mUen7" }, ); - t0 = props.cond ? ( {x}
; $[0] = props.a; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md index 4bdc7c7d92c..4595caec0d7 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-assignment-to-scope-declarations.expect.md @@ -50,7 +50,6 @@ function Component(statusName) { const { status, text: t2 } = foo(statusName); text = t2; const { bg, color } = getStyles(status); - t1 = identity(bg); t0 = identity(color); $[0] = statusName; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md index 2bbfc31a11a..0f279891d33 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/sequential-destructuring-both-mixed-local-and-scope-declaration.expect.md @@ -52,10 +52,8 @@ function Component(statusName) { if ($[0] !== statusName) { const { status, text: t1 } = foo(statusName); text = t1; - const { color, font: t2 } = getStyles(status); font = t2; - t0 = identity(color); $[0] = statusName; $[1] = font; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md index 530153679a9..fa78e6d7b03 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md @@ -33,7 +33,6 @@ function Component(props) { foo(a, b); if (foo()) { } - foo(a, b); t0 =
; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md index 44e1e3ae76d..c8fa82b4469 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md @@ -28,7 +28,6 @@ function Component(props) { const a = []; const b = {}; foo(a, b); - foo(a, b); t0 =
; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md index dd61d1fee12..1f83da465ae 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md @@ -48,7 +48,6 @@ function Component(props) { x.push(props.p1); y = x; } - t0 = ( {x} diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md index ae0daf1213d..b9f5516739b 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md @@ -25,7 +25,6 @@ function foo() { if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const a = {}; const x = a; - y = {}; y.x = x; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/static-components/invalid-dynamically-constructed-component-function.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/static-components/invalid-dynamically-constructed-component-function.expect.md index 2939a27a881..374c28ffd19 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/static-components/invalid-dynamically-constructed-component-function.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/static-components/invalid-dynamically-constructed-component-function.expect.md @@ -23,7 +23,6 @@ function Example(props) { const Component = function Component() { return
; }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md index 7d6fc359147..cf76c252787 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/switch.expect.md @@ -33,7 +33,6 @@ function Component(props) { let y; if ($[0] !== props.p0 || $[1] !== props.p2 || $[2] !== props.p3) { const x = []; - switch (props.p0) { case true: { x.push(props.p2); diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-function-expression-captures-value-later-frozen.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-function-expression-captures-value-later-frozen.expect.md index cc89c1967be..446beadb3ff 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-function-expression-captures-value-later-frozen.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-function-expression-captures-value-later-frozen.expect.md @@ -28,14 +28,11 @@ function Component(props) { let t0; if ($[0] !== props.cond) { const x = {}; - const onChange = (e) => { maybeMutate(x, e.target.value); }; - if (props.cond) { } - onChange(); t0 = ; $[0] = props.cond; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-global-property-load-cached.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-global-property-load-cached.expect.md index cf2ad80e7ac..058f5ab0a98 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-global-property-load-cached.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/todo-global-property-load-cached.expect.md @@ -45,7 +45,6 @@ function Component(t0) { let t1; if ($[0] !== num) { const arr = makeArray(num); - T0 = SharedRuntime.Stringify; t1 = arr.push(num); $[0] = num; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-array.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-array.expect.md index 0d1ff8c1a9a..1cd97874c37 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-array.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-array.expect.md @@ -36,7 +36,6 @@ function Component(props) { const y = {}; const items = [x, y]; items.pop(); - mutate(y); t0 = [x, y, items]; $[0] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-function-expressions.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-function-expressions.expect.md index aacadb10887..107833dad98 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-function-expressions.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transitive-freeze-function-expressions.expect.md @@ -59,7 +59,6 @@ function Component(props) { if (isLoadingNext) { return; } - loadMoreWithTiming(); }; t2 = [isLoadingNext, loadMoreWithTiming]; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-within-function-expression-returns-caught-value.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-within-function-expression-returns-caught-value.expect.md index 1b45e08393b..e8f6af8d582 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-within-function-expression-returns-caught-value.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-within-function-expression-returns-caught-value.expect.md @@ -40,7 +40,6 @@ function Component(props) { return e; } }; - t0 = callback(); $[0] = props; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md index d100dadffe9..f49cc73b293 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md @@ -29,7 +29,6 @@ function component() { let x; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { const o = {}; - x = {}; x.t = p; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useActionState-dispatch-considered-as-non-reactive.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useActionState-dispatch-considered-as-non-reactive.expect.md index 4b6b94ce431..b362e307cf2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useActionState-dispatch-considered-as-non-reactive.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useActionState-dispatch-considered-as-non-reactive.expect.md @@ -35,7 +35,6 @@ function Component() { const onSubmitAction = () => { dispatchAction(); }; - t0 = ; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useContext-read-context-in-callback-if-condition.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useContext-read-context-in-callback-if-condition.expect.md index 611606ea38d..84f25ec2577 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useContext-read-context-in-callback-if-condition.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useContext-read-context-in-callback-if-condition.expect.md @@ -50,7 +50,6 @@ function Component(props) { return null; } }; - t0 = getValue(); $[0] = foo.current; $[1] = t0; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md index a500af2fc8f..392ff267a26 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useReducer-returned-dispatcher-is-non-reactive.expect.md @@ -36,7 +36,6 @@ function f() { const onClick = () => { dispatch(); }; - t0 =
; $[0] = t0; } else { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.expect.md index 8a46686fcde..85796abb964 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/valid-setState-in-effect-from-ref-function-call.expect.md @@ -50,7 +50,6 @@ function Component() { } return 100; }; - setWidth(getBoundingRect(ref)); }; t1 = []; From 81d1434f648088b40f4b4496df02fef7fddb2fa3 Mon Sep 17 00:00:00 2001 From: Nathan Marks Date: Fri, 14 Nov 2025 09:45:27 -0500 Subject: [PATCH 3/4] add more to spec --- .../src/Validation/ValidateSourceLocations.ts | 125 +++++-- ...or.todo-missing-source-locations.expect.md | 314 +++++++++++++++--- .../error.todo-missing-source-locations.js | 10 +- 3 files changed, 376 insertions(+), 73 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts index d1890237093..5e0d5022e55 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/Validation/ValidateSourceLocations.ts @@ -27,7 +27,11 @@ import {Result} from '../Utils/Result'; /** * Some common node types that are important for coverage tracking. - * Based on istanbul-lib-instrument + * Based on istanbul-lib-instrument + some other common nodes we expect to be present in the generated AST. + * + * Note: For VariableDeclaration, VariableDeclarator, and Identifier, we enforce stricter validation + * that requires both the source location AND node type to match in the generated AST. This ensures + * that variable declarations maintain their structural integrity through compilation. */ const IMPORTANT_INSTRUMENTED_TYPES = new Set([ 'ArrowFunctionExpression', @@ -54,6 +58,14 @@ const IMPORTANT_INSTRUMENTED_TYPES = new Set([ 'LabeledStatement', 'ConditionalExpression', 'LogicalExpression', + + /** + * Note: these aren't important for coverage tracking, + * but we still want to track them to ensure we aren't regressing them when + * we fix the source location tracking for other nodes. + */ + 'VariableDeclaration', + 'Identifier', ]); /** @@ -115,9 +127,10 @@ export function validateSourceLocations( const errors = new CompilerError(); // Step 1: Collect important locations from the original source + // Note: Multiple node types can share the same location (e.g. VariableDeclarator and Identifier) const importantOriginalLocations = new Map< string, - {loc: t.SourceLocation; nodeType: string} + {loc: t.SourceLocation; nodeTypes: Set} >(); func.traverse({ @@ -137,20 +150,31 @@ export function validateSourceLocations( // Collect the location if it exists if (node.loc) { const key = locationKey(node.loc); - importantOriginalLocations.set(key, { - loc: node.loc, - nodeType: node.type, - }); + const existing = importantOriginalLocations.get(key); + if (existing) { + existing.nodeTypes.add(node.type); + } else { + importantOriginalLocations.set(key, { + loc: node.loc, + nodeTypes: new Set([node.type]), + }); + } } }, }); - // Step 2: Collect all locations from the generated AST - const generatedLocations = new Set(); + // Step 2: Collect all locations from the generated AST with their node types + const generatedLocations = new Map>(); function collectGeneratedLocations(node: t.Node): void { if (node.loc) { - generatedLocations.add(locationKey(node.loc)); + const key = locationKey(node.loc); + const nodeTypes = generatedLocations.get(key); + if (nodeTypes) { + nodeTypes.add(node.type); + } else { + generatedLocations.set(key, new Set([node.type])); + } } // Use Babel's VISITOR_KEYS to traverse only actual node properties @@ -184,21 +208,74 @@ export function validateSourceLocations( } // Step 3: Validate that all important locations are preserved - for (const [key, {loc, nodeType}] of importantOriginalLocations) { - if (!generatedLocations.has(key)) { - errors.pushDiagnostic( - CompilerDiagnostic.create({ - category: ErrorCategory.Todo, - reason: 'Important source location missing in generated code', - description: - `Source location for ${nodeType} is missing in the generated output. This can cause coverage instrumentation ` + - `to fail to track this code properly, resulting in inaccurate coverage reports.`, - }).withDetails({ - kind: 'error', - loc, - message: null, - }), - ); + // For certain node types, also validate that the node type matches + const strictNodeTypes = new Set([ + 'VariableDeclaration', + 'VariableDeclarator', + 'Identifier', + ]); + + const reportMissingLocation = (loc: t.SourceLocation, nodeType: string) => { + errors.pushDiagnostic( + CompilerDiagnostic.create({ + category: ErrorCategory.Todo, + reason: 'Important source location missing in generated code', + description: + `Source location for ${nodeType} is missing in the generated output. This can cause coverage instrumentation ` + + `to fail to track this code properly, resulting in inaccurate coverage reports.`, + }).withDetails({ + kind: 'error', + loc, + message: null, + }), + ); + }; + + const reportWrongNodeType = ( + loc: t.SourceLocation, + expectedType: string, + actualTypes: Set, + ) => { + errors.pushDiagnostic( + CompilerDiagnostic.create({ + category: ErrorCategory.Todo, + reason: 'Important source location has wrong node type in generated code', + description: + `Source location for ${expectedType} exists in the generated output but with wrong node type(s): ${Array.from(actualTypes).join(', ')}. ` + + `This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.`, + }).withDetails({ + kind: 'error', + loc, + message: null, + }), + ); + }; + + for (const [key, {loc, nodeTypes}] of importantOriginalLocations) { + const generatedNodeTypes = generatedLocations.get(key); + + if (!generatedNodeTypes) { + // Location is completely missing + reportMissingLocation(loc, Array.from(nodeTypes).join(', ')); + } else { + // Location exists, check each node type + for (const nodeType of nodeTypes) { + if (strictNodeTypes.has(nodeType) && !generatedNodeTypes.has(nodeType)) { + // For strict node types, the specific node type must be present + // Check if any generated node type is also an important original node type + const hasValidNodeType = Array.from(generatedNodeTypes).some(genType => + nodeTypes.has(genType) + ); + + if (hasValidNodeType) { + // At least one generated node type is valid (also in original), so this is just missing + reportMissingLocation(loc, nodeType); + } else { + // None of the generated node types are in original - this is wrong node type + reportWrongNodeType(loc, nodeType, generatedNodeTypes); + } + } + } } } diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md index 1b8d1c5239a..41669bdb958 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md @@ -12,12 +12,20 @@ function Component({prop1, prop2}) { const obj = {x, y}; const [a, b] = arr; const {x: c, y: d} = obj; + let sound; + + if (y > 10) { + sound = 'woof'; + } else { + sound = 'meow'; + } useEffect(() => { if (a > 10) { console.log(a); + console.log(sound); } - }, [a]); + }, [a, sound]); const foo = useCallback(() => { return a + b; @@ -38,92 +46,302 @@ function Component({prop1, prop2}) { ## Error ``` -Found 6 errors: +Found 22 errors: Todo: Important source location missing in generated code -Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:4:9 + 2 | import {useEffect, useCallback} from 'react'; + 3 | +> 4 | function Component({prop1, prop2}) { + | ^^^^^^^^^ + 5 | const x = prop1 + prop2; + 6 | const y = x * 2; + 7 | const arr = [x, y]; + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:10:9 + 8 | const obj = {x, y}; + 9 | const [a, b] = arr; +> 10 | const {x: c, y: d} = obj; + | ^ + 11 | let sound; + 12 | + 13 | if (y > 10) { + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:10:15 + 8 | const obj = {x, y}; + 9 | const [a, b] = arr; +> 10 | const {x: c, y: d} = obj; + | ^ + 11 | let sound; + 12 | + 13 | if (y > 10) { + +Todo: Important source location missing in generated code + +Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:11:2 + 9 | const [a, b] = arr; + 10 | const {x: c, y: d} = obj; +> 11 | let sound; + | ^^^^^^^^^^ + 12 | + 13 | if (y > 10) { + 14 | sound = 'woof'; + +Todo: Important source location missing in generated code + +Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:12:2 +error.todo-missing-source-locations.ts:11:6 + 9 | const [a, b] = arr; 10 | const {x: c, y: d} = obj; - 11 | -> 12 | useEffect(() => { +> 11 | let sound; + | ^^^^^ + 12 | + 13 | if (y > 10) { + 14 | sound = 'woof'; + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:14:4 + 12 | + 13 | if (y > 10) { +> 14 | sound = 'woof'; + | ^^^^^^^^^^^^^^^ + 15 | } else { + 16 | sound = 'meow'; + 17 | } + +Todo: Important source location has wrong node type in generated code + +Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:14:4 + 12 | + 13 | if (y > 10) { +> 14 | sound = 'woof'; + | ^^^^^ + 15 | } else { + 16 | sound = 'meow'; + 17 | } + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:16:4 + 14 | sound = 'woof'; + 15 | } else { +> 16 | sound = 'meow'; + | ^^^^^^^^^^^^^^^ + 17 | } + 18 | + 19 | useEffect(() => { + +Todo: Important source location has wrong node type in generated code + +Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:16:4 + 14 | sound = 'woof'; + 15 | } else { +> 16 | sound = 'meow'; + | ^^^^^ + 17 | } + 18 | + 19 | useEffect(() => { + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:19:2 + 17 | } + 18 | +> 19 | useEffect(() => { | ^^^^^^^^^^^^^^^^^ -> 13 | if (a > 10) { +> 20 | if (a > 10) { + | ^^^^^^^^^^^^^^^^^ +> 21 | console.log(a); | ^^^^^^^^^^^^^^^^^ -> 14 | console.log(a); +> 22 | console.log(sound); | ^^^^^^^^^^^^^^^^^ -> 15 | } +> 23 | } | ^^^^^^^^^^^^^^^^^ -> 16 | }, [a]); - | ^^^^^^^^^^^ - 17 | - 18 | const foo = useCallback(() => { - 19 | return a + b; +> 24 | }, [a, sound]); + | ^^^^^^^^^^^^^^^^^^ + 25 | + 26 | const foo = useCallback(() => { + 27 | return a + b; Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:14:6 - 12 | useEffect(() => { - 13 | if (a > 10) { -> 14 | console.log(a); +error.todo-missing-source-locations.ts:21:6 + 19 | useEffect(() => { + 20 | if (a > 10) { +> 21 | console.log(a); | ^^^^^^^^^^^^^^^ - 15 | } - 16 | }, [a]); - 17 | + 22 | console.log(sound); + 23 | } + 24 | }, [a, sound]); + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:21:14 + 19 | useEffect(() => { + 20 | if (a > 10) { +> 21 | console.log(a); + | ^^^ + 22 | console.log(sound); + 23 | } + 24 | }, [a, sound]); + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:22:6 + 20 | if (a > 10) { + 21 | console.log(a); +> 22 | console.log(sound); + | ^^^^^^^^^^^^^^^^^^^ + 23 | } + 24 | }, [a, sound]); + 25 | + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:22:14 + 20 | if (a > 10) { + 21 | console.log(a); +> 22 | console.log(sound); + | ^^^ + 23 | } + 24 | }, [a, sound]); + 25 | + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:26:14 + 24 | }, [a, sound]); + 25 | +> 26 | const foo = useCallback(() => { + | ^^^^^^^^^^^ + 27 | return a + b; + 28 | }, [a, b]); + 29 | Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:19:4 - 17 | - 18 | const foo = useCallback(() => { -> 19 | return a + b; +error.todo-missing-source-locations.ts:27:4 + 25 | + 26 | const foo = useCallback(() => { +> 27 | return a + b; | ^^^^^^^^^^^^^ - 20 | }, [a, b]); - 21 | - 22 | function bar() { + 28 | }, [a, b]); + 29 | + 30 | function bar() { + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:28:6 + 26 | const foo = useCallback(() => { + 27 | return a + b; +> 28 | }, [a, b]); + | ^ + 29 | + 30 | function bar() { + 31 | return (c + d) * 2; + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:28:9 + 26 | const foo = useCallback(() => { + 27 | return a + b; +> 28 | }, [a, b]); + | ^ + 29 | + 30 | function bar() { + 31 | return (c + d) * 2; Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:23:4 - 21 | - 22 | function bar() { -> 23 | return (c + d) * 2; +error.todo-missing-source-locations.ts:31:4 + 29 | + 30 | function bar() { +> 31 | return (c + d) * 2; | ^^^^^^^^^^^^^^^^^^^ - 24 | } - 25 | - 26 | console.log('Hello, world!'); + 32 | } + 33 | + 34 | console.log('Hello, world!'); Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:26:2 - 24 | } - 25 | -> 26 | console.log('Hello, world!'); +error.todo-missing-source-locations.ts:34:2 + 32 | } + 33 | +> 34 | console.log('Hello, world!'); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 27 | - 28 | return [y, foo, bar]; - 29 | } + 35 | + 36 | return [y, foo, bar]; + 37 | } + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:34:10 + 32 | } + 33 | +> 34 | console.log('Hello, world!'); + | ^^^ + 35 | + 36 | return [y, foo, bar]; + 37 | } Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:28:2 - 26 | console.log('Hello, world!'); - 27 | -> 28 | return [y, foo, bar]; +error.todo-missing-source-locations.ts:36:2 + 34 | console.log('Hello, world!'); + 35 | +> 36 | return [y, foo, bar]; | ^^^^^^^^^^^^^^^^^^^^^ - 29 | } - 30 | + 37 | } + 38 | ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js index 0277aa78735..e0cfe5b3fb5 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js @@ -8,12 +8,20 @@ function Component({prop1, prop2}) { const obj = {x, y}; const [a, b] = arr; const {x: c, y: d} = obj; + let sound; + + if (y > 10) { + sound = 'woof'; + } else { + sound = 'meow'; + } useEffect(() => { if (a > 10) { console.log(a); + console.log(sound); } - }, [a]); + }, [a, sound]); const foo = useCallback(() => { return a + b; From 3aa150695cab35d989601ce0ea73e02c77fc6ca0 Mon Sep 17 00:00:00 2001 From: Nathan Marks Date: Mon, 17 Nov 2025 08:38:26 -0500 Subject: [PATCH 4/4] handle null init in createVariableDeclarator for source locations --- .../ReactiveScopes/CodegenReactiveFunction.ts | 10 +- ...or.todo-missing-source-locations.expect.md | 367 ++++++++++-------- .../error.todo-missing-source-locations.js | 8 +- 3 files changed, 221 insertions(+), 164 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts index 0afd0b5d764..bdd43680399 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/CodegenReactiveFunction.ts @@ -699,7 +699,9 @@ function codegenReactiveScope( outputComments.push(name.name); if (!cx.hasDeclared(identifier)) { statements.push( - t.variableDeclaration('let', [t.variableDeclarator(name)]), + t.variableDeclaration('let', [ + createVariableDeclarator(name, null), + ]), ); } cacheLoads.push({name, index, value: wrapCacheDep(cx, name)}); @@ -1754,11 +1756,13 @@ function createVariableDeclarator( * The variable declarator location is not preserved in HIR, however, we can use the * start location of the id and the end location of the init to recreate the * exact original variable declarator location. + * + * Or if init is null, we likely have a declaration without an initializer, so we can use the id.loc.end as the end location. */ - if (id.loc && init?.loc) { + if (id.loc && (init === null || init?.loc)) { node.loc = { start: id.loc.start, - end: init.loc.end, + end: init?.loc?.end ?? id.loc.end, filename: id.loc.filename, identifierName: undefined, }; diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md index 41669bdb958..85a17df091f 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.expect.md @@ -10,6 +10,11 @@ function Component({prop1, prop2}) { const y = x * 2; const arr = [x, y]; const obj = {x, y}; + let destA, destB; + if (y > 5) { + [destA, destB] = arr; + } + const [a, b] = arr; const {x: c, y: d} = obj; let sound; @@ -24,8 +29,9 @@ function Component({prop1, prop2}) { if (a > 10) { console.log(a); console.log(sound); + console.log(destA, destB); } - }, [a, sound]); + }, [a, sound, destA, destB]); const foo = useCallback(() => { return a + b; @@ -46,7 +52,7 @@ function Component({prop1, prop2}) { ## Error ``` -Found 22 errors: +Found 25 errors: Todo: Important source location missing in generated code @@ -63,285 +69,326 @@ error.todo-missing-source-locations.ts:4:9 Todo: Important source location missing in generated code -Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. +Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:10:9 +error.todo-missing-source-locations.ts:9:2 + 7 | const arr = [x, y]; 8 | const obj = {x, y}; - 9 | const [a, b] = arr; -> 10 | const {x: c, y: d} = obj; - | ^ - 11 | let sound; - 12 | - 13 | if (y > 10) { +> 9 | let destA, destB; + | ^^^^^^^^^^^^^^^^^ + 10 | if (y > 5) { + 11 | [destA, destB] = arr; + 12 | } + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:11:4 + 9 | let destA, destB; + 10 | if (y > 5) { +> 11 | [destA, destB] = arr; + | ^^^^^^^^^^^^^^^^^^^^^ + 12 | } + 13 | + 14 | const [a, b] = arr; Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:10:15 - 8 | const obj = {x, y}; - 9 | const [a, b] = arr; -> 10 | const {x: c, y: d} = obj; - | ^ - 11 | let sound; - 12 | - 13 | if (y > 10) { +error.todo-missing-source-locations.ts:15:9 + 13 | + 14 | const [a, b] = arr; +> 15 | const {x: c, y: d} = obj; + | ^ + 16 | let sound; + 17 | + 18 | if (y > 10) { Todo: Important source location missing in generated code -Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:11:2 - 9 | const [a, b] = arr; - 10 | const {x: c, y: d} = obj; -> 11 | let sound; - | ^^^^^^^^^^ - 12 | - 13 | if (y > 10) { - 14 | sound = 'woof'; +error.todo-missing-source-locations.ts:15:15 + 13 | + 14 | const [a, b] = arr; +> 15 | const {x: c, y: d} = obj; + | ^ + 16 | let sound; + 17 | + 18 | if (y > 10) { Todo: Important source location missing in generated code -Source location for VariableDeclarator is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. +Source location for VariableDeclaration is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:11:6 - 9 | const [a, b] = arr; - 10 | const {x: c, y: d} = obj; -> 11 | let sound; - | ^^^^^ - 12 | - 13 | if (y > 10) { - 14 | sound = 'woof'; +error.todo-missing-source-locations.ts:16:2 + 14 | const [a, b] = arr; + 15 | const {x: c, y: d} = obj; +> 16 | let sound; + | ^^^^^^^^^^ + 17 | + 18 | if (y > 10) { + 19 | sound = 'woof'; Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:14:4 - 12 | - 13 | if (y > 10) { -> 14 | sound = 'woof'; +error.todo-missing-source-locations.ts:19:4 + 17 | + 18 | if (y > 10) { +> 19 | sound = 'woof'; | ^^^^^^^^^^^^^^^ - 15 | } else { - 16 | sound = 'meow'; - 17 | } + 20 | } else { + 21 | sound = 'meow'; + 22 | } Todo: Important source location has wrong node type in generated code Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:14:4 - 12 | - 13 | if (y > 10) { -> 14 | sound = 'woof'; +error.todo-missing-source-locations.ts:19:4 + 17 | + 18 | if (y > 10) { +> 19 | sound = 'woof'; | ^^^^^ - 15 | } else { - 16 | sound = 'meow'; - 17 | } + 20 | } else { + 21 | sound = 'meow'; + 22 | } Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:16:4 - 14 | sound = 'woof'; - 15 | } else { -> 16 | sound = 'meow'; +error.todo-missing-source-locations.ts:21:4 + 19 | sound = 'woof'; + 20 | } else { +> 21 | sound = 'meow'; | ^^^^^^^^^^^^^^^ - 17 | } - 18 | - 19 | useEffect(() => { + 22 | } + 23 | + 24 | useEffect(() => { Todo: Important source location has wrong node type in generated code Source location for Identifier exists in the generated output but with wrong node type(s): ExpressionStatement. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:16:4 - 14 | sound = 'woof'; - 15 | } else { -> 16 | sound = 'meow'; +error.todo-missing-source-locations.ts:21:4 + 19 | sound = 'woof'; + 20 | } else { +> 21 | sound = 'meow'; | ^^^^^ - 17 | } - 18 | - 19 | useEffect(() => { + 22 | } + 23 | + 24 | useEffect(() => { Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:19:2 - 17 | } - 18 | -> 19 | useEffect(() => { +error.todo-missing-source-locations.ts:24:2 + 22 | } + 23 | +> 24 | useEffect(() => { | ^^^^^^^^^^^^^^^^^ -> 20 | if (a > 10) { +> 25 | if (a > 10) { + | ^^^^^^^^^^^^^^^^^ +> 26 | console.log(a); | ^^^^^^^^^^^^^^^^^ -> 21 | console.log(a); +> 27 | console.log(sound); | ^^^^^^^^^^^^^^^^^ -> 22 | console.log(sound); +> 28 | console.log(destA, destB); | ^^^^^^^^^^^^^^^^^ -> 23 | } +> 29 | } | ^^^^^^^^^^^^^^^^^ -> 24 | }, [a, sound]); - | ^^^^^^^^^^^^^^^^^^ - 25 | - 26 | const foo = useCallback(() => { - 27 | return a + b; +> 30 | }, [a, sound, destA, destB]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + 31 | + 32 | const foo = useCallback(() => { + 33 | return a + b; Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:21:6 - 19 | useEffect(() => { - 20 | if (a > 10) { -> 21 | console.log(a); +error.todo-missing-source-locations.ts:26:6 + 24 | useEffect(() => { + 25 | if (a > 10) { +> 26 | console.log(a); | ^^^^^^^^^^^^^^^ - 22 | console.log(sound); - 23 | } - 24 | }, [a, sound]); + 27 | console.log(sound); + 28 | console.log(destA, destB); + 29 | } Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:21:14 - 19 | useEffect(() => { - 20 | if (a > 10) { -> 21 | console.log(a); +error.todo-missing-source-locations.ts:26:14 + 24 | useEffect(() => { + 25 | if (a > 10) { +> 26 | console.log(a); | ^^^ - 22 | console.log(sound); - 23 | } - 24 | }, [a, sound]); + 27 | console.log(sound); + 28 | console.log(destA, destB); + 29 | } Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:22:6 - 20 | if (a > 10) { - 21 | console.log(a); -> 22 | console.log(sound); +error.todo-missing-source-locations.ts:27:6 + 25 | if (a > 10) { + 26 | console.log(a); +> 27 | console.log(sound); | ^^^^^^^^^^^^^^^^^^^ - 23 | } - 24 | }, [a, sound]); - 25 | + 28 | console.log(destA, destB); + 29 | } + 30 | }, [a, sound, destA, destB]); Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:22:14 - 20 | if (a > 10) { - 21 | console.log(a); -> 22 | console.log(sound); +error.todo-missing-source-locations.ts:27:14 + 25 | if (a > 10) { + 26 | console.log(a); +> 27 | console.log(sound); | ^^^ - 23 | } - 24 | }, [a, sound]); - 25 | + 28 | console.log(destA, destB); + 29 | } + 30 | }, [a, sound, destA, destB]); + +Todo: Important source location missing in generated code + +Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:28:6 + 26 | console.log(a); + 27 | console.log(sound); +> 28 | console.log(destA, destB); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + 29 | } + 30 | }, [a, sound, destA, destB]); + 31 | Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:26:14 - 24 | }, [a, sound]); - 25 | -> 26 | const foo = useCallback(() => { +error.todo-missing-source-locations.ts:28:14 + 26 | console.log(a); + 27 | console.log(sound); +> 28 | console.log(destA, destB); + | ^^^ + 29 | } + 30 | }, [a, sound, destA, destB]); + 31 | + +Todo: Important source location missing in generated code + +Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. + +error.todo-missing-source-locations.ts:32:14 + 30 | }, [a, sound, destA, destB]); + 31 | +> 32 | const foo = useCallback(() => { | ^^^^^^^^^^^ - 27 | return a + b; - 28 | }, [a, b]); - 29 | + 33 | return a + b; + 34 | }, [a, b]); + 35 | Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:27:4 - 25 | - 26 | const foo = useCallback(() => { -> 27 | return a + b; +error.todo-missing-source-locations.ts:33:4 + 31 | + 32 | const foo = useCallback(() => { +> 33 | return a + b; | ^^^^^^^^^^^^^ - 28 | }, [a, b]); - 29 | - 30 | function bar() { + 34 | }, [a, b]); + 35 | + 36 | function bar() { Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:28:6 - 26 | const foo = useCallback(() => { - 27 | return a + b; -> 28 | }, [a, b]); +error.todo-missing-source-locations.ts:34:6 + 32 | const foo = useCallback(() => { + 33 | return a + b; +> 34 | }, [a, b]); | ^ - 29 | - 30 | function bar() { - 31 | return (c + d) * 2; + 35 | + 36 | function bar() { + 37 | return (c + d) * 2; Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:28:9 - 26 | const foo = useCallback(() => { - 27 | return a + b; -> 28 | }, [a, b]); +error.todo-missing-source-locations.ts:34:9 + 32 | const foo = useCallback(() => { + 33 | return a + b; +> 34 | }, [a, b]); | ^ - 29 | - 30 | function bar() { - 31 | return (c + d) * 2; + 35 | + 36 | function bar() { + 37 | return (c + d) * 2; Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:31:4 - 29 | - 30 | function bar() { -> 31 | return (c + d) * 2; +error.todo-missing-source-locations.ts:37:4 + 35 | + 36 | function bar() { +> 37 | return (c + d) * 2; | ^^^^^^^^^^^^^^^^^^^ - 32 | } - 33 | - 34 | console.log('Hello, world!'); + 38 | } + 39 | + 40 | console.log('Hello, world!'); Todo: Important source location missing in generated code Source location for ExpressionStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:34:2 - 32 | } - 33 | -> 34 | console.log('Hello, world!'); +error.todo-missing-source-locations.ts:40:2 + 38 | } + 39 | +> 40 | console.log('Hello, world!'); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - 35 | - 36 | return [y, foo, bar]; - 37 | } + 41 | + 42 | return [y, foo, bar]; + 43 | } Todo: Important source location missing in generated code Source location for Identifier is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:34:10 - 32 | } - 33 | -> 34 | console.log('Hello, world!'); +error.todo-missing-source-locations.ts:40:10 + 38 | } + 39 | +> 40 | console.log('Hello, world!'); | ^^^ - 35 | - 36 | return [y, foo, bar]; - 37 | } + 41 | + 42 | return [y, foo, bar]; + 43 | } Todo: Important source location missing in generated code Source location for ReturnStatement is missing in the generated output. This can cause coverage instrumentation to fail to track this code properly, resulting in inaccurate coverage reports.. -error.todo-missing-source-locations.ts:36:2 - 34 | console.log('Hello, world!'); - 35 | -> 36 | return [y, foo, bar]; +error.todo-missing-source-locations.ts:42:2 + 40 | console.log('Hello, world!'); + 41 | +> 42 | return [y, foo, bar]; | ^^^^^^^^^^^^^^^^^^^^^ - 37 | } - 38 | + 43 | } + 44 | ``` \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js index e0cfe5b3fb5..2fb562e63f2 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-missing-source-locations.js @@ -6,6 +6,11 @@ function Component({prop1, prop2}) { const y = x * 2; const arr = [x, y]; const obj = {x, y}; + let destA, destB; + if (y > 5) { + [destA, destB] = arr; + } + const [a, b] = arr; const {x: c, y: d} = obj; let sound; @@ -20,8 +25,9 @@ function Component({prop1, prop2}) { if (a > 10) { console.log(a); console.log(sound); + console.log(destA, destB); } - }, [a, sound]); + }, [a, sound, destA, destB]); const foo = useCallback(() => { return a + b;