Reorder similar cases in InferReferenceEffects
Moves the CallExpression case next to MethodCall to make it easier to compare
Joe Savona committed
May 18, 2023 at 15:52 UTC
c0a5d869026b6dd5300c8b0a9c2c47907d67f3b9
1 file changed
+13
-13
compiler/forget/src/Inference/InferReferenceEffects.ts
+13
-13
@@ -632,19 +632,6 @@ function inferBlock(
632
effectKind = Effect.Mutate;
633
break;
634
}
635
- case "CallExpression": {
636
- valueKind = ValueKind.Mutable;
637
- effectKind = Effect.Mutate;
638
- const hook =
639
- instrValue.callee.identifier.type.kind === "Hook"
640
- ? instrValue.callee.identifier.type.definition
641
- : null;
642
- if (hook !== null) {
643
- effectKind = hook.effectKind;
644
- valueKind = hook.valueKind;
645
- }
646
- break;
647
- }
635
case "ObjectExpression": {
636
valueKind = hasContextRefOperand(state, instrValue)
637
? ValueKind.Context
@@ -719,6 +706,19 @@ function inferBlock(
706
instr.lvalue.effect = Effect.Store;
707
continue;
708
}
709
+ case "CallExpression": {
710
+ valueKind = ValueKind.Mutable;
711
+ effectKind = Effect.Mutate;
712
+ const hook =
713
+ instrValue.callee.identifier.type.kind === "Hook"
714
+ ? instrValue.callee.identifier.type.definition
715
+ : null;
716
+ if (hook !== null) {
717
+ effectKind = hook.effectKind;
718
+ valueKind = hook.valueKind;
719
+ }
720
+ break;
721
+ }
722
case "MethodCall": {
723
invariant(
724
state.isDefined(instrValue.receiver),