[be] Fix missing break and update no-fallthrough eslint rule

- Fixes a missing break in InferTypes - I disabled no-fallthrough previously 
because it would erroneously report that certain cases with non-builtin throws 
(eg `invariant`) would fall through. This brings the rule back but allows 
disabling it with a `// break omitted` comment, since it's still helpful in 
catching some actual missing breaks.
This commit is contained in:
Lauren Tan
2023-03-30 15:50:07 -04:00
parent e43f91edc3
commit 89ea2d5f7c
@@ -12,6 +12,7 @@ import {
} from "../HIR/HIR";
import { BuiltInArrayId, BuiltInObjectId } from "../HIR/ObjectShape";
import { eachInstructionLValue, eachInstructionOperand } from "../HIR/visitors";
import { assertExhaustive } from "../Utils/utils";
function isPrimitiveBinaryOp(op: t.BinaryExpression["operator"]): boolean {
switch (op) {
@@ -182,7 +183,29 @@ function* generateInstructionTypes(
});
yield equation(left, returnType);
break;
}
case "DeclareLocal":
case "Destructure":
case "NewExpression":
case "TypeCastExpression":
case "JsxExpression":
case "JsxFragment":
case "RegExpLiteral":
case "PropertyStore":
case "PropertyDelete":
case "ComputedStore":
case "ComputedLoad":
case "ComputedDelete":
case "FunctionExpression":
case "TaggedTemplateExpression":
case "TemplateLiteral":
case "Await":
case "UnsupportedNode":
break;
default:
assertExhaustive(value, `Unhandled instruction value kind: ${value}`);
}
}