holdsOnlySaved

tcmts.cli.main.holdsOnlySaved · #72wuxtwi · term · runs anywhere

Whether every definition in a scratch file is saved as it is (and nothing else is in it: a watch expression, code that doesn't check).

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { classify } from "#codebase/tcmts/cli/main";

export function holdsOnlySaved(cb: Codebase, file: string): boolean {
  cb.refreshShim();
  const a = cb.analyze(file, cb.scratchSalts());
  if (a.errors.length || a.diagnostics.length || a.watches.length || !a.defs.length) return false;
  return classify(cb, a.defs, a.namespace ?? "").every((r) => r.status === "identical");
}

uses

used by