From d997e613794edde081f9fa3264e69fd0ffb94db7 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Thu, 19 May 2022 10:39:26 +0200 Subject: [PATCH] Address some tsc issues --- static/events.ts | 6 ++++-- static/panes/ast-view.ts | 9 ++++++++- static/panes/flags-view.ts | 2 +- static/panes/gccdump-view.interfaces.ts | 6 ++++++ static/panes/ir-view.ts | 11 +++++++++-- static/panes/pp-view.interfaces.ts | 5 +++++ static/panes/tool-input-view.ts | 2 +- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/static/events.ts b/static/events.ts index 02ff5a097..643d8b1e0 100644 --- a/static/events.ts +++ b/static/events.ts @@ -26,6 +26,8 @@ import {Language} from '../types/languages.interfaces'; import {CompilerFilters} from '../types/features/filters.interfaces'; import {SiteSettings} from './settings'; import {Theme} from './themes'; +import {PPOptions} from './panes/pp-view.interfaces'; +import {GccSelectedPass} from './panes/gccdump-view.interfaces'; // This list comes from executing // grep -rPo "eventHub\.(on|emit)\('.*'," static/ | cut -d "'" -f2 | sort | uniq @@ -76,7 +78,7 @@ export type Events = { flagsViewOpened: (compilerId: number) => void; gccDumpFiltersChanged: (compilerId: number, filters: CompilerFilters, recompile: boolean) => void; // TODO: pass type - gccDumpPassSelected: (compilerId: number, pass: string, recompile: boolean) => void; + gccDumpPassSelected: (compilerId: number, pass: GccSelectedPass, recompile: boolean) => void; gccDumpUIInit: (compilerId: number) => void; gccDumpViewClosed: (compilerId: number) => void; gccDumpViewOpened: (compilerId: number) => void; @@ -112,7 +114,7 @@ export type Events = { ) => void; ppViewClosed: (compilerId: number) => void; ppViewOpened: (compilerId: number) => void; - ppViewOptionsUpdated: (compilerId: number, options: string, recompile: boolean) => void; + ppViewOptionsUpdated: (compilerId: number, options: PPOptions, recompile: boolean) => void; requestCompilation: (editorId: number, treeId: boolean | number) => void; requestMotd: () => void; requestSettings: () => void; diff --git a/static/panes/ast-view.ts b/static/panes/ast-view.ts index b9f006af8..03b9440f9 100644 --- a/static/panes/ast-view.ts +++ b/static/panes/ast-view.ts @@ -145,7 +145,14 @@ export class Ast extends MonacoPane this.maybeEmitChange(false), this); this.editor.getModel()?.onDidChangeContent(() => { this.debouncedEmitChange(false); diff --git a/static/panes/gccdump-view.interfaces.ts b/static/panes/gccdump-view.interfaces.ts index 840386bed..9afcb7b39 100644 --- a/static/panes/gccdump-view.interfaces.ts +++ b/static/panes/gccdump-view.interfaces.ts @@ -46,3 +46,9 @@ export interface GccDumpState extends GccDumpFilters { _editorid?: number; _treeid?: number; } + +export type GccSelectedPass = { + filename_suffix: string; + name: string; + command_prefix: string; +}; diff --git a/static/panes/ir-view.ts b/static/panes/ir-view.ts index 62e47894d..67fcf762e 100644 --- a/static/panes/ir-view.ts +++ b/static/panes/ir-view.ts @@ -91,7 +91,14 @@ export class Ir extends MonacoPane const desiredLine = position.lineNumber - 1; const source = this.irCode[desiredLine].source; if (source !== null && source.file !== null) { - this.eventHub.emit('editorLinkLine', this.compilerInfo.editorId, source.line, -1, -1, true); + this.eventHub.emit( + 'editorLinkLine', + this.compilerInfo.editorId as number, + source.line, + -1, + -1, + true + ); } } }, @@ -188,7 +195,7 @@ export class Ir extends MonacoPane this.eventHub.emit( 'editorLinkLine', - this.compilerInfo.editorId, + this.compilerInfo.editorId as number, sourceLine, sourceColumnBegin, sourceColumnEnd, diff --git a/static/panes/pp-view.interfaces.ts b/static/panes/pp-view.interfaces.ts index ed94eef03..10bcba83f 100644 --- a/static/panes/pp-view.interfaces.ts +++ b/static/panes/pp-view.interfaces.ts @@ -25,3 +25,8 @@ export interface PPViewState { ppOutput: any; } + +export type PPOptions = { + 'filter-headers': boolean; + 'clang-format': boolean; +}; diff --git a/static/panes/tool-input-view.ts b/static/panes/tool-input-view.ts index dbf0b9d9a..914ec5470 100644 --- a/static/panes/tool-input-view.ts +++ b/static/panes/tool-input-view.ts @@ -89,7 +89,7 @@ export class ToolInputView extends MonacoPane this.maybeEmitChange(false), this); this.editor.getModel()?.onDidChangeContent(() => { this.debouncedEmitChange();