File tree Expand file tree Collapse file tree 4 files changed +31
-8
lines changed
compiler/packages/babel-plugin-react-compiler/src Expand file tree Collapse file tree 4 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -369,7 +369,8 @@ export type Terminal =
369
369
| SequenceTerminal
370
370
| MaybeThrowTerminal
371
371
| TryTerminal
372
- | ReactiveScopeTerminal ;
372
+ | ReactiveScopeTerminal
373
+ | PrunedScopeTerminal ;
373
374
374
375
export type TerminalWithFallthrough = Terminal & { fallthrough : BlockId } ;
375
376
@@ -603,6 +604,15 @@ export type ReactiveScopeTerminal = {
603
604
loc : SourceLocation ;
604
605
} ;
605
606
607
+ export type PrunedScopeTerminal = {
608
+ kind : "pruned-scope" ;
609
+ fallthrough : BlockId ;
610
+ block : BlockId ;
611
+ scope : ReactiveScope ;
612
+ id : InstructionId ;
613
+ loc : SourceLocation ;
614
+ } ;
615
+
606
616
/*
607
617
* Instructions generally represent expressions but with all nesting flattened away,
608
618
* such that all operands to each instruction are either primitive values OR are
Original file line number Diff line number Diff line change @@ -127,7 +127,8 @@ export function printMixedHIR(
127
127
case "do-while" :
128
128
case "for-in" :
129
129
case "for-of" :
130
- case "scope" : {
130
+ case "scope" :
131
+ case "pruned-scope" : {
131
132
const terminal = printTerminal ( value ) ;
132
133
if ( Array . isArray ( terminal ) ) {
133
134
return terminal . join ( "; " ) ;
@@ -280,6 +281,12 @@ export function printTerminal(terminal: Terminal): Array<string> | string {
280
281
} fallthrough=bb${ terminal . fallthrough } `;
281
282
break ;
282
283
}
284
+ case "pruned-scope" : {
285
+ value = `<pruned> Scope ${ printReactiveScopeSummary ( terminal . scope ) } block=bb${
286
+ terminal . block
287
+ } fallthrough=bb${ terminal . fallthrough } `;
288
+ break ;
289
+ }
283
290
case "try" : {
284
291
value = `Try block=bb${ terminal . block } handler=bb${ terminal . handler } ${
285
292
terminal . handlerBinding !== null
Original file line number Diff line number Diff line change @@ -851,7 +851,8 @@ export function mapTerminalSuccessors(
851
851
loc : terminal . loc ,
852
852
} ;
853
853
}
854
- case "scope" : {
854
+ case "scope" :
855
+ case "pruned-scope" : {
855
856
const block = fn ( terminal . block ) ;
856
857
const fallthrough = fn ( terminal . fallthrough ) ;
857
858
return {
@@ -904,7 +905,8 @@ export function terminalHasFallthrough<
904
905
case "switch" :
905
906
case "ternary" :
906
907
case "while" :
907
- case "scope" : {
908
+ case "scope" :
909
+ case "pruned-scope" : {
908
910
const _ : BlockId = terminal . fallthrough ;
909
911
return true ;
910
912
}
@@ -1006,7 +1008,8 @@ export function* eachTerminalSuccessor(terminal: Terminal): Iterable<BlockId> {
1006
1008
yield terminal . block ;
1007
1009
break ;
1008
1010
}
1009
- case "scope" : {
1011
+ case "scope" :
1012
+ case "pruned-scope" : {
1010
1013
yield terminal . block ;
1011
1014
break ;
1012
1015
}
@@ -1072,7 +1075,8 @@ export function mapTerminalOperands(
1072
1075
case "goto" :
1073
1076
case "unreachable" :
1074
1077
case "unsupported" :
1075
- case "scope" : {
1078
+ case "scope" :
1079
+ case "pruned-scope" : {
1076
1080
// no-op
1077
1081
break ;
1078
1082
}
@@ -1130,7 +1134,8 @@ export function* eachTerminalOperand(terminal: Terminal): Iterable<Place> {
1130
1134
case "goto" :
1131
1135
case "unreachable" :
1132
1136
case "unsupported" :
1133
- case "scope" : {
1137
+ case "scope" :
1138
+ case "pruned-scope" : {
1134
1139
// no-op
1135
1140
break ;
1136
1141
}
Original file line number Diff line number Diff line change @@ -806,6 +806,7 @@ class Driver {
806
806
}
807
807
break ;
808
808
}
809
+ case "pruned-scope" :
809
810
case "scope" : {
810
811
const fallthroughId = ! this . cx . isScheduled ( terminal . fallthrough )
811
812
? terminal . fallthrough
@@ -828,7 +829,7 @@ class Driver {
828
829
829
830
this . cx . unscheduleAll ( scheduleIds ) ;
830
831
blockValue . push ( {
831
- kind : "scope" ,
832
+ kind : terminal . kind ,
832
833
instructions : block ,
833
834
scope : terminal . scope ,
834
835
} ) ;
You can’t perform that action at this time.
0 commit comments