Skip to content

Commit

Permalink
automatically fix old gccdump states (#4641)
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Jan 25, 2023
1 parent c803074 commit db69a5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 9 additions & 0 deletions static/panes/gccdump-view.ts
Expand Up @@ -120,6 +120,15 @@ export class GccDump extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Gcc
this.eventHub.emit('gccDumpUIInit', this.compilerInfo.compilerId);
}

override initializeCompilerInfo(state: Record<string, any>) {
super.initializeCompilerInfo(state);

if (!state.id && state._compilerid) this.compilerInfo.compilerId = state._compilerid;
if (!state.editorid && state._editorid) this.compilerInfo.editorId = state._editorid;
if (!state.compilerName && state._compilerName) this.compilerInfo.compilerName = state._compilerName;
if (!state.treeid && state._treeid) state.treeId = state._treeid;
}

override getInitialHTML(): string {
return $('#gccdump').html();
}
Expand Down
16 changes: 10 additions & 6 deletions static/panes/pane.ts
Expand Up @@ -70,12 +70,7 @@ export abstract class Pane<S> {

this.hideable = this.domRoot.find('.hideable');

this.compilerInfo = {
compilerId: state.id,
compilerName: state.compilerName,
editorId: state.editorid,
treeId: state.treeid,
};
this.initializeCompilerInfo(state);
this.topBar = this.domRoot.find('.top-bar');

this.paneRenaming = new PaneRenaming(this, state);
Expand All @@ -92,6 +87,15 @@ export abstract class Pane<S> {
this.registerOpeningAnalyticsEvent();
}

protected initializeCompilerInfo(state: Record<string, any>) {
this.compilerInfo = {
compilerId: state.id,
compilerName: state.compilerName,
editorId: state.editorid,
treeId: state.treeid,
};
}

/**
* Get the initial HTML layout for the pane's default content. A typical
* implementation looks like this:
Expand Down

0 comments on commit db69a5e

Please sign in to comment.