Skip to content

Commit

Permalink
Fix #6468: Don't trust hasStackUsageOutput/hasOptOutput (#6471)
Browse files Browse the repository at this point in the history
  • Loading branch information
OfekShilon committed May 12, 2024
1 parent 5e2a46a commit 8559ea5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion static/panes/opt-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export class Opt extends MonacoPane<monaco.editor.IStandaloneCodeEditor, OptStat
}

this.editor.setValue(unwrap(result.source));
if (result.hasOptOutput) {
if (result.optOutput) {
// result.hasOptOutput might be true for failed compilations
this.optRemarks = result.optOutput;
this.showOptRemarks();
}
Expand Down
6 changes: 4 additions & 2 deletions static/panes/stack-usage-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ export class StackUsage extends MonacoPane<monaco.editor.IStandaloneCodeEditor,
override onCompileResult(id: number, compiler: CompilerInfo, result: CompilationResult) {
if (this.compilerInfo.compilerId !== id || !this.isCompilerSupported) return;
this.editor.setValue(unwrap(result.source));
if (result.hasStackUsageOutput) {
this.showStackUsageResults(unwrap(result.stackUsageOutput));
if (result.stackUsageOutput) {
// result.hasStackUsageOutput might be true for failed compilations
this.showStackUsageResults(result.stackUsageOutput);
}

// TODO: This is inelegant again. Previously took advantage of fourth argument for the compileResult event.
const lang = compiler.lang === 'c++' ? 'cpp' : compiler.lang;
const model = this.editor.getModel();
Expand Down

0 comments on commit 8559ea5

Please sign in to comment.