@samitouri / QOS-React / commits / 58100e3d60

Use CompilerError invariant

The CompilerError module's `invariant` is wired up to our bailout system so in compiler passes should be preferred to the raw `invariant` module. We should probably add an internal eslint rule to suggest using CompilerError if the file is in one of the compiler pass directories.

Lauren Tan committed Oct 14, 2022 at 12:10 UTC 58100e3d60124cfc41268c27f8b68ff00cc00685
2 files changed +5 -5
compiler/forget/src/BackEnd/LIRGen.ts
+1 -1
@@ -7,9 +7,9 @@
7
8 import { NodePath } from "@babel/traverse";
9 import * as t from "@babel/types";
10 -import invariant from "invariant";
10 import { setEmpty, setEq, setIntersect, setSubset } from "../Common/utils";
11 import type { CompilerContext } from "../CompilerContext";
12 +import { invariant } from "../CompilerError";
13 import * as IR from "../IR";
14 import * as LIR from "../LIR";
15 import { PassKind, PassName } from "../Pass";
compiler/forget/src/BackEnd/SanityCheck.ts
+4 -4
@@ -7,14 +7,14 @@
7
8 import type { NodePath } from "@babel/traverse";
9 import * as t from "@babel/types";
10 +import { assertExhaustive } from "../Common/utils";
11 import type { CompilerContext } from "../CompilerContext";
12 +import { invariant } from "../CompilerError";
13 import { OutputKind } from "../CompilerOutputs";
12 -import * as LIR from "../LIR";
14 import * as IR from "../IR";
14 -import { PassKind, PassName } from "../Pass";
15 -import { assertExhaustive } from "../Common/utils";
16 -import invariant from "invariant";
15 +import * as LIR from "../LIR";
16 import { isReactiveBlock, isRenderBlock } from "../LIR";
17 +import { PassKind, PassName } from "../Pass";
18
19 /**
20 * An optional debug step when the output {@link OutputKind.IR} is enabled.