Skip to content

Commit

Permalink
Don't trust hasStackUsageOutput/hasOptOutput - they can be true f…
Browse files Browse the repository at this point in the history
…or compilations that failed and really have no `stackUsageOutput`/`optOutput`
  • Loading branch information
OfekShilon committed May 11, 2024
1 parent 0741ec2 commit 3ccb801
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 3ccb801

Please sign in to comment.