mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
Keep the compiler's kind and code methods direct (#1317)
This commit is contained in:
@@ -429,11 +429,14 @@ export function resolveInferredReturn(
|
||||
if (ice.length > 0) lowerer.diags.push(...ice);
|
||||
lowerer.runtimeFences.push(...captured.filter((d) => d.code !== "SC9001"));
|
||||
const first = captured.find((d) => d.code !== "SC9001");
|
||||
// Property writes, not literal element writes: the class method
|
||||
// census reads `x["kind"] = …` as a possible write to every method
|
||||
// named `kind`, which would make those methods dynamic in native builds.
|
||||
const mutable = e.stmt as unknown as Record<string, unknown>;
|
||||
delete mutable["value"];
|
||||
mutable["kind"] = "runtimeFence";
|
||||
mutable["code"] = first?.code ?? "SC1090";
|
||||
mutable["message"] = first
|
||||
delete mutable.value;
|
||||
mutable.kind = "runtimeFence";
|
||||
mutable.code = first?.code ?? "SC1090";
|
||||
mutable.message = first
|
||||
? `${first.message} [${first.code}]`
|
||||
: "this return value has no lowering onto the instance's settled return type [SC1090]";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user