mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Retain original structure of labeled blocks
Handles some edge-cases where we previously flattened away some of the structure of a labeled block, instead ensuring that we retain the original shape. See the output. ## Test Plan Tested on the internal app we're focused on (w useMemo inlining enabled), it works fine.
This commit is contained in:
1 parent
7831ac2189
commit
3603ee00a6
5 files changed
+27
-15
No files matched your search
@@ -573,15 +573,18 @@ class Driver {
|
||||
case "optional":
|
||||
case "ternary":
|
||||
case "logical": {
|
||||
const fallthroughId = terminal.fallthrough;
|
||||
invariant(
|
||||
!this.cx.isScheduled(fallthroughId),
|
||||
"Logical terminal fallthrough cannot have been scheduled"
|
||||
);
|
||||
const scheduleId = this.cx.schedule(fallthroughId, "if");
|
||||
scheduleIds.push(scheduleId);
|
||||
const fallthroughId =
|
||||
terminal.fallthrough !== null &&
|
||||
!this.cx.isScheduled(terminal.fallthrough)
|
||||
? terminal.fallthrough
|
||||
: null;
|
||||
if (fallthroughId !== null) {
|
||||
const scheduleId = this.cx.schedule(fallthroughId, "if");
|
||||
scheduleIds.push(scheduleId);
|
||||
}
|
||||
|
||||
const { place, value } = this.visitValueBlockTerminal(terminal);
|
||||
this.cx.unscheduleAll(scheduleIds);
|
||||
blockValue.push({
|
||||
kind: "instruction",
|
||||
instruction: {
|
||||
@@ -592,8 +595,9 @@ class Driver {
|
||||
},
|
||||
});
|
||||
|
||||
this.cx.unschedule(scheduleId);
|
||||
this.visitBlock(this.cx.ir.blocks.get(fallthroughId)!, blockValue);
|
||||
if (fallthroughId !== null) {
|
||||
this.visitBlock(this.cx.ir.blocks.get(fallthroughId)!, blockValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "goto": {
|
||||
|
||||
Reference in new issue
Block a user