MCPcopy Create free account
hub / github.com/Snapchat/Valdi / loadProgramIfNeeded

Method loadProgramIfNeeded

compiler/companion/src/project/Project.ts:128–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 }
127
128 loadProgramIfNeeded(): ts.Program {
129 if (!this.currentProgram || this.programDirty) {
130 this.updatingProgram = true;
131
132 const oldProgram = this.currentProgram;
133
134 this.listener?.onProgramWillChange();
135
136 this.currentProgram = ts.createProgram(
137 this.sourceFileManager.getScriptFileNames(),
138 this.compilerOptions,
139 new CompilerHost(this.fileManager, this.sourceFileManager),
140 oldProgram,
141 );
142
143 this.updatingProgram = false;
144 this.programDirty = false;
145
146 this.listener?.onProgramChanged();
147 }
148
149 return this.currentProgram;
150 }
151
152 private setProgramDirty(): void {
153 if (!this.updatingProgram) {

Callers 2

programMethod · 0.95
Project.spec.tsFile · 0.80

Calls 3

getScriptFileNamesMethod · 0.80
onProgramWillChangeMethod · 0.65
onProgramChangedMethod · 0.65

Tested by

no test coverage detected