MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / fromJsonData

Method fromJsonData

lib/clientstate.ts:231–272  ·  view source on GitHub ↗
(jsondata: any)

Source from the content-addressed store, hash-verified

229 }
230
231 fromJsonData(jsondata: any) {
232 this.id = jsondata.id;
233 this.cmakeArgs = jsondata.cmakeArgs;
234 this.customOutputFilename = jsondata.customOutputFilename;
235 this.isCMakeProject = jsondata.isCMakeProject;
236 this.compilerLanguageId = jsondata.compilerLanguageId;
237
238 let requiresFix = jsondata.newFileId === undefined;
239 for (const file of jsondata.files) {
240 const newFile = new MultifileFile(file);
241 this.files.push(newFile);
242 if (this.newFileId <= newFile.id) {
243 requiresFix = true;
244 }
245 }
246
247 if (requiresFix) {
248 this.newFileId = 1;
249 for (const file of this.files) {
250 if (file.id > this.newFileId) {
251 this.newFileId = file.id + 1;
252 }
253 }
254 } else {
255 this.newFileId = jsondata.newFileId;
256 }
257
258 if (jsondata.compilers !== undefined) {
259 for (const compilerdata of jsondata.compilers) {
260 const compiler = new ClientStateCompiler(compilerdata);
261 if (compiler.id) {
262 this.compilers.push(compiler);
263 }
264 }
265 }
266
267 if (jsondata.executors !== undefined) {
268 for (const executor of jsondata.executors) {
269 this.executors.push(new ClientStateExecutor(executor));
270 }
271 }
272 }
273
274 findOrCreateCompiler(id: number) {
275 let foundCompiler;

Callers 1

constructorMethod · 0.95

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected