Skip to content

Commit 853aadc

Browse files
committed
[compiler][rewrite] PropagateScopeDeps hir rewrite
ghstack-source-id: aa31210 Pull Request resolved: #30894
1 parent bd788b4 commit 853aadc

File tree

65 files changed

+2626
-306
lines changed

Some content is hidden

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

65 files changed

+2626
-306
lines changed

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ import {propagatePhiTypes} from '../TypeInference/PropagatePhiTypes';
101101
import {lowerContextAccess} from '../Optimization/LowerContextAccess';
102102
import {validateNoSetStateInPassiveEffects} from '../Validation/ValidateNoSetStateInPassiveEffects';
103103
import {validateNoJSXInTryStatement} from '../Validation/ValidateNoJSXInTryStatement';
104+
import {propagateScopeDependenciesHIR} from '../HIR/PropagateScopeDependenciesHIR';
104105

105106
export type CompilerPipelineValue =
106107
| {kind: 'ast'; name: string; value: CodegenFunction}
@@ -341,6 +342,14 @@ function* runWithEnvironment(
341342
});
342343
assertTerminalSuccessorsExist(hir);
343344
assertTerminalPredsExist(hir);
345+
if (env.config.enablePropagateDepsInHIR) {
346+
propagateScopeDependenciesHIR(hir);
347+
yield log({
348+
kind: 'hir',
349+
name: 'PropagateScopeDependenciesHIR',
350+
value: hir,
351+
});
352+
}
344353

345354
const reactiveFunction = buildReactiveFunction(hir);
346355
yield log({
@@ -359,12 +368,14 @@ function* runWithEnvironment(
359368
});
360369
assertScopeInstructionsWithinScopes(reactiveFunction);
361370

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

369380
pruneNonEscapingScopes(reactiveFunction);
370381
yield log({

0 commit comments

Comments
 (0)