Skip to content

Commit 3f6d0e4

Browse files
committed
Update on "[compiler] Fix mode for generating scopes for reassignments"
We have an experimental mode where we generate scopes for simple phi values, even if they aren't subsequently mutated. This mode was incorrectly generating scope ranges, leaving the start at 0 which is invalid. The fix is to allow non-zero identifier ranges to overwrite the scope start (rather than taking the min) if the scope start is still zero. [ghstack-poisoned]
1 parent d88f26a commit 3f6d0e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/InferReactiveScopeVariables.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ export function inferReactiveScopeVariables(fn: HIRFunction): void {
114114
};
115115
scopes.set(groupIdentifier, scope);
116116
} else {
117-
if (identifier.mutableRange.start !== 0 && scope.range.start !== 0) {
117+
if (scope.range.start === 0) {
118+
scope.range.start = identifier.mutableRange.start;
119+
} else if (identifier.mutableRange.start !== 0) {
118120
scope.range.start = makeInstructionId(
119121
Math.min(scope.range.start, identifier.mutableRange.start)
120122
);
121-
} else if (identifier.mutableRange.start !== 0) {
122-
scope.range.start = identifier.mutableRange.start;
123123
}
124124
scope.range.end = makeInstructionId(
125125
Math.max(scope.range.end, identifier.mutableRange.end)

0 commit comments

Comments
 (0)