Skip to content

Commit 3ba4bd7

Browse files
committed
[compiler][rewrite] PropagateScopeDeps hir rewrite
ghstack-source-id: e0710f2 Pull Request resolved: #30894
1 parent 69d2017 commit 3ba4bd7

File tree

63 files changed

+2493
-266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2493
-266
lines changed

compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Pipeline.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
lower,
2222
mergeConsecutiveBlocks,
2323
mergeOverlappingReactiveScopesHIR,
24+
printFunction,
2425
pruneUnusedLabelsHIR,
2526
} from '../HIR';
2627
import {
@@ -101,6 +102,7 @@ import {propagatePhiTypes} from '../TypeInference/PropagatePhiTypes';
101102
import {lowerContextAccess} from '../Optimization/LowerContextAccess';
102103
import {validateNoSetStateInPassiveEffects} from '../Validation/ValidateNoSetStateInPassiveEffects';
103104
import {validateNoJSXInTryStatement} from '../Validation/ValidateNoJSXInTryStatement';
105+
import {propagateScopeDependenciesHIR} from '../HIR/PropagateScopeDependenciesHIR';
104106

105107
export type CompilerPipelineValue =
106108
| {kind: 'ast'; name: string; value: CodegenFunction}
@@ -341,6 +343,14 @@ function* runWithEnvironment(
341343
});
342344
assertTerminalSuccessorsExist(hir);
343345
assertTerminalPredsExist(hir);
346+
if (env.config.enablePropagateDepsInHIR) {
347+
propagateScopeDependenciesHIR(hir);
348+
yield log({
349+
kind: 'hir',
350+
name: 'PropagateScopeDependenciesHIR',
351+
value: hir,
352+
});
353+
}
344354

345355
const reactiveFunction = buildReactiveFunction(hir);
346356
yield log({
@@ -359,12 +369,14 @@ function* runWithEnvironment(
359369
});
360370
assertScopeInstructionsWithinScopes(reactiveFunction);
361371

362-
propagateScopeDependencies(reactiveFunction);
363-
yield log({
364-
kind: 'reactive',
365-
name: 'PropagateScopeDependencies',
366-
value: reactiveFunction,
367-
});
372+
if (!env.config.enablePropagateDepsInHIR) {
373+
propagateScopeDependencies(reactiveFunction);
374+
yield log({
375+
kind: 'reactive',
376+
name: 'PropagateScopeDependencies',
377+
value: reactiveFunction,
378+
});
379+
}
368380

369381
pruneNonEscapingScopes(reactiveFunction);
370382
yield log({

0 commit comments

Comments
 (0)