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

Method refreshDiffOptions

static/panes/diff.ts:459–510  ·  view source on GitHub ↗
(id: number | string, compiler: CompilerInfo, result: CompilationResult)

Source from the content-addressed store, hash-verified

457 }
458
459 refreshDiffOptions(id: number | string, compiler: CompilerInfo, result: CompilationResult) {
460 const lhsextraoptions: DiffOption[] = [];
461 const rhsextraoptions: DiffOption[] = [];
462
463 if (result.devices) {
464 for (const devicename in result.devices) {
465 lhsextraoptions.push({
466 id: encodeSelectizeValue({difftype: DiffType.DeviceView, extraoption: devicename}),
467 name: devicename,
468 });
469 rhsextraoptions.push({
470 id: encodeSelectizeValue({difftype: DiffType.DeviceView, extraoption: devicename}),
471 name: devicename,
472 });
473 }
474 }
475
476 for (const options of [lhsextraoptions, rhsextraoptions]) {
477 if (compiler.supportsAstView) {
478 options.push({id: DiffType.AstOutput.toString(), name: 'AST'});
479 }
480 if (compiler.supportsIrView) {
481 options.push({id: DiffType.IrOutput.toString(), name: 'LLVM IR'});
482 }
483 if (compiler.supportsRustMirView) {
484 options.push({id: DiffType.RustMirOutput.toString(), name: 'Rust MIR'});
485 }
486 if (compiler.supportsRustMacroExpView) {
487 options.push({id: DiffType.RustMacroExpOutput.toString(), name: 'Rust Macro Expansion'});
488 }
489 if (compiler.supportsRustHirView) {
490 options.push({id: DiffType.RustHirOutput.toString(), name: 'Rust HIR'});
491 }
492 if (compiler.supportsClojureMacroExpView) {
493 options.push({id: DiffType.ClojureMacroExpOutput.toString(), name: 'Clojure Macro Expansion'});
494 }
495 if (compiler.supportsYulView) {
496 options.push({id: DiffType.YulOutput.toString(), name: 'Yul (Solidity IR)'});
497 }
498 if (compiler.supportsLeanCView) {
499 options.push({id: DiffType.LeanCOutput.toString(), name: 'Lean C Output'});
500 }
501 }
502
503 const lhsoptions = this.getDiffableOptions(this.selectize.lhs, lhsextraoptions);
504 this.selectize.lhsdifftype.clearOptions();
505 this.selectize.lhsdifftype.addOptions(lhsoptions);
506
507 const rhsoptions = this.getDiffableOptions(this.selectize.rhs, rhsextraoptions);
508 this.selectize.rhsdifftype.clearOptions();
509 this.selectize.rhsdifftype.addOptions(rhsoptions);
510 }
511
512 override onCompiler(
513 id: number | string,

Callers 1

onCompileResultMethod · 0.95

Calls 4

getDiffableOptionsMethod · 0.95
encodeSelectizeValueFunction · 0.85
pushMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected