mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
Keep the process.versions scan flag on the lowerer (#1579)
This commit is contained in:
@@ -304,19 +304,13 @@ export function isOptionalProcessVersionsRead(lowerer: Lowerer, node: ts.Node):
|
||||
);
|
||||
}
|
||||
|
||||
const mentionsVersions = new WeakMap<Lowerer, boolean>();
|
||||
|
||||
/** Whether any implementation source spells `versions`. Programs that
|
||||
* never do skip the per-read checker queries above entirely. */
|
||||
function programMentionsVersions(lowerer: Lowerer): boolean {
|
||||
let known = mentionsVersions.get(lowerer);
|
||||
if (known === undefined) {
|
||||
known = lowerer.program
|
||||
.getImplementationSourceFiles()
|
||||
.some((sf) => !sf.isDeclarationFile && sf.text.includes("versions"));
|
||||
mentionsVersions.set(lowerer, known);
|
||||
}
|
||||
return known;
|
||||
lowerer.mentionsProcessVersions ??= lowerer.program
|
||||
.getImplementationSourceFiles()
|
||||
.some((sf) => !sf.isDeclarationFile && sf.text.includes("versions"));
|
||||
return lowerer.mentionsProcessVersions;
|
||||
}
|
||||
|
||||
export function lowerProcessStreamProperty(
|
||||
|
||||
@@ -1846,6 +1846,9 @@ export class Lowerer {
|
||||
* NaN, which lower to plain doubles (see nan-coded-reads.ts). Settled by
|
||||
* analyzeRuntimeOptionalArrayReads before any body lowers. */
|
||||
nanCodedReads: NanCodedReads | null = null;
|
||||
/** Whether any implementation source spells `versions`
|
||||
* (programMentionsVersions in builtins/process.ts). */
|
||||
mentionsProcessVersions: boolean | undefined = undefined;
|
||||
private stringIndexBoundsCache: StringIndexBounds | null = null;
|
||||
/** Proofs that a string element read names an existing code unit. The
|
||||
* indexed-read analysis and expression lowering share one instance, so a
|
||||
|
||||
Reference in New Issue
Block a user