aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static/compiler-picker.ts15
-rw-r--r--static/event-hub.ts8
-rw-r--r--static/hub.ts6
-rw-r--r--static/multifile-service.ts5
-rw-r--r--static/panes/ast-view.ts3
-rw-r--r--static/panes/cfg-view.ts3
-rw-r--r--static/panes/gnatdebug-view.ts3
-rw-r--r--static/panes/gnatdebugtree-view.ts3
-rw-r--r--static/panes/ir-view.ts3
-rw-r--r--static/panes/opt-view.ts3
-rw-r--r--static/panes/pane.ts6
-rw-r--r--static/panes/pp-view.ts3
-rw-r--r--static/panes/rusthir-view.ts3
-rw-r--r--static/panes/rustmacroexp-view.ts3
-rw-r--r--static/panes/rustmir-view.ts3
-rw-r--r--static/panes/tree.ts8
16 files changed, 51 insertions, 27 deletions
diff --git a/static/compiler-picker.ts b/static/compiler-picker.ts
index e43710782..ff8607c49 100644
--- a/static/compiler-picker.ts
+++ b/static/compiler-picker.ts
@@ -22,11 +22,12 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-import _ from 'underscore';
import TomSelect from 'tom-select';
import { ga } from './analytics';
import * as local from './local';
+import { EventHub } from './event-hub';
+import { Hub } from './hub';
type Favourites = {
[compilerId: string]: boolean
@@ -38,7 +39,7 @@ export class CompilerPicker {
static nextSelectorId = 1;
domRoot: JQuery;
domNode: HTMLSelectElement;
- eventHub: any /* ReturnType<typeof hub.createEventHub> */;
+ eventHub: EventHub;
id: number;
compilerService: any;
onCompilerChange: (x: string) => any;
@@ -46,8 +47,14 @@ export class CompilerPicker {
lastLangId: string;
lastCompilerId: string;
compilerIsVisible: (any) => any; // TODO => bool probably
- constructor(domRoot: JQuery, hub: any /* Hub */, langId: string, compilerId: string,
- onCompilerChange: (x: string) => any, compilerIsVisible?: (x: any) => any) {
+ constructor(
+ domRoot: JQuery,
+ hub: Hub,
+ langId: string,
+ compilerId: string,
+ onCompilerChange: (x: string) => any,
+ compilerIsVisible?: (x: any) => any
+ ) {
this.eventHub = hub.createEventHub();
this.id = CompilerPicker.nextSelectorId++;
const compilerPicker = domRoot.find('.compiler-picker')[0];
diff --git a/static/event-hub.ts b/static/event-hub.ts
index 1aab7240e..0878dbfbe 100644
--- a/static/event-hub.ts
+++ b/static/event-hub.ts
@@ -25,6 +25,8 @@
import GoldenLayout from 'golden-layout';
import Sentry from '@sentry/browser';
+import { Hub } from './hub';
+
export type EventHubCallback<T extends unknown[]> = (...args: T) => void;
export interface DependencyProxies<T1 extends unknown[], T2 extends unknown[] = T1> {
@@ -35,7 +37,7 @@ export interface DependencyProxies<T1 extends unknown[], T2 extends unknown[] =
export interface Event<T extends unknown[], C = any> {
evt: string;
fn: EventHubCallback<T>;
- ctx: C;
+ ctx?: C;
}
/**
@@ -43,7 +45,7 @@ export interface Event<T extends unknown[], C = any> {
* deferred execution based on the parent Hub.
*/
export class EventHub {
- private readonly hub: any; /* typeof Hub */
+ private readonly hub: Hub;
private readonly layoutEventHub: GoldenLayout.EventEmitter;
private subscriptions: Event<any>[] = [];
@@ -68,7 +70,7 @@ export class EventHub {
}
/** Attach a listener to the layout event hub. */
- public on<T extends unknown[], C = any>(event: string, callback: EventHubCallback<T>, context: C): void {
+ public on<T extends unknown[], C = any>(event: string, callback: EventHubCallback<T>, context?: C): void {
this.layoutEventHub.on(event, callback, context);
this.subscriptions.push({ evt: event, fn: callback, ctx: context });
}
diff --git a/static/hub.ts b/static/hub.ts
index 86dffeab2..fdc6de0b5 100644
--- a/static/hub.ts
+++ b/static/hub.ts
@@ -64,7 +64,7 @@ export class Hub {
public readonly compilerService: any; // typeof CompilerService
public deferred = true;
- public deferredEmissions: string[][] = [];
+ public deferredEmissions: unknown[][] = [];
public lastOpenedLangId: string | null;
public subdomainLangId: string | undefined;
@@ -149,8 +149,8 @@ export class Hub {
public undefer(): void {
this.deferred = false;
const eventHub = this.layout.eventHub;
- const compilerEmissions: string[][] = [];
- const nonCompilerEmissions: string[][] = [];
+ const compilerEmissions: unknown[][] = [];
+ const nonCompilerEmissions: unknown[][] = [];
for (const [eventName, ...args] of this.deferredEmissions) {
if (eventName === 'compiler') {
diff --git a/static/multifile-service.ts b/static/multifile-service.ts
index 91a273b7f..77ae9bab7 100644
--- a/static/multifile-service.ts
+++ b/static/multifile-service.ts
@@ -25,6 +25,7 @@
import _ from 'underscore';
import path from 'path';
import JSZip from 'jszip';
+import { Hub } from './hub';
const options = require('./options').options;
const languages = options.languages;
@@ -55,7 +56,7 @@ export class MultifileService {
private files: Array<MultifileFile>;
private compilerLanguageId: string;
private isCMakeProject: boolean;
- private hub: any;
+ private hub: Hub;
private newFileId: number;
private alertSystem: any;
private validExtraFilenameExtensions: string[];
@@ -64,7 +65,7 @@ export class MultifileService {
private readonly cmakeMainSourceFilename: string;
private readonly maxFilesize: number;
- constructor(hub, alertSystem, state: MultifileServiceState) {
+ constructor(hub: Hub, alertSystem, state: MultifileServiceState) {
this.hub = hub;
this.alertSystem = alertSystem;
diff --git a/static/panes/ast-view.ts b/static/panes/ast-view.ts
index dab9efdd5..ff2a11d8e 100644
--- a/static/panes/ast-view.ts
+++ b/static/panes/ast-view.ts
@@ -33,6 +33,7 @@ import * as colour from '../colour';
import * as monacoConfig from '../monaco-config';
import { ga } from '../analytics';
+import { Hub } from '../hub';
type DecorationEntry = {
linkedCode: any[];
@@ -58,7 +59,7 @@ export class Ast extends MonacoPane<monaco.editor.IStandaloneCodeEditor, AstStat
astCode: AstCodeEntry[] = [];
linkedFadeTimeoutId?: NodeJS.Timeout = undefined;
- constructor(hub: any, container: Container, state: AstState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: AstState & MonacoPaneState) {
super(hub, container, state);
if (state && state.astOutput) {
diff --git a/static/panes/cfg-view.ts b/static/panes/cfg-view.ts
index fe492c956..bbfb16801 100644
--- a/static/panes/cfg-view.ts
+++ b/static/panes/cfg-view.ts
@@ -30,6 +30,7 @@ import TomSelect from 'tom-select';
import { Container } from 'golden-layout';
import { CfgState } from './cfg-view.interfaces';
import { PaneRenaming } from '../widgets/pane-renaming';
+import { Hub } from '../hub';
interface NodeInfo {
edges: string[],
@@ -70,7 +71,7 @@ export class Cfg {
paneName: string;
paneRenaming: PaneRenaming;
- constructor(hub: any, container: Container, state: CfgState) {
+ constructor(hub: Hub, container: Container, state: CfgState) {
this.container = container;
this.eventHub = hub.createEventHub();
this.domRoot = container.getElement();
diff --git a/static/panes/gnatdebug-view.ts b/static/panes/gnatdebug-view.ts
index 499a4d8c2..b9a5fb081 100644
--- a/static/panes/gnatdebug-view.ts
+++ b/static/panes/gnatdebug-view.ts
@@ -32,9 +32,10 @@ import { MonacoPaneState } from './pane.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
export class GnatDebug extends MonacoPane<monaco.editor.IStandaloneCodeEditor, GnatDebugState> {
- constructor(hub: any, container: Container, state: GnatDebugState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: GnatDebugState & MonacoPaneState) {
super(hub, container, state);
if (state && state.gnatDebugOutput) {
this.showGnatDebugResults(state.gnatDebugOutput);
diff --git a/static/panes/gnatdebugtree-view.ts b/static/panes/gnatdebugtree-view.ts
index f25455b10..ee6c79064 100644
--- a/static/panes/gnatdebugtree-view.ts
+++ b/static/panes/gnatdebugtree-view.ts
@@ -32,9 +32,10 @@ import { MonacoPaneState } from './pane.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
export class GnatDebugTree extends MonacoPane<monaco.editor.IStandaloneCodeEditor, GnatDebugTreeState> {
- constructor(hub: any, container: Container, state: GnatDebugTreeState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: GnatDebugTreeState & MonacoPaneState) {
super(hub, container, state);
if (state && state.gnatDebugTreeOutput) {
this.showGnatDebugTreeResults(state.gnatDebugTreeOutput);
diff --git a/static/panes/ir-view.ts b/static/panes/ir-view.ts
index 11f32b881..e26ff209b 100644
--- a/static/panes/ir-view.ts
+++ b/static/panes/ir-view.ts
@@ -35,6 +35,7 @@ import { extendConfig } from '../monaco-config';
import { applyColours } from '../colour';
import { PaneRenaming } from '../widgets/pane-renaming';
+import { Hub } from '../hub';
export class Ir extends MonacoPane<monaco.editor.IStandaloneCodeEditor, IrState> {
linkedFadeTimeoutId = -1;
@@ -43,7 +44,7 @@ export class Ir extends MonacoPane<monaco.editor.IStandaloneCodeEditor, IrState>
decorations: any = {};
previousDecorations: string[] = [];
- constructor(hub: any, container: Container, state: IrState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: IrState & MonacoPaneState) {
super(hub, container, state);
if (state && state.irOutput) {
this.showIrResults(state.irOutput);
diff --git a/static/panes/opt-view.ts b/static/panes/opt-view.ts
index 66cad98cf..73a479188 100644
--- a/static/panes/opt-view.ts
+++ b/static/panes/opt-view.ts
@@ -32,6 +32,7 @@ import { MonacoPaneState } from './pane.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
type SourceLocation = {
File: string;
@@ -55,7 +56,7 @@ export class Opt extends MonacoPane<monaco.editor.IStandaloneCodeEditor, OptStat
// Note: bool | undef here instead of just bool because of an issue with field initialization order
isCompilerSupported?: boolean;
- constructor(hub: any, container: Container, state: OptState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: OptState & MonacoPaneState) {
super(hub, container, state);
if (state && state.optOutput) {
this.showOptResults(state.optOutput);
diff --git a/static/panes/pane.ts b/static/panes/pane.ts
index 2af5c5fa2..c217e2c3f 100644
--- a/static/panes/pane.ts
+++ b/static/panes/pane.ts
@@ -33,6 +33,8 @@ import { SiteSettings } from '../settings';
import * as utils from '../utils';
import { PaneRenaming } from '../widgets/pane-renaming';
+import { EventHub } from '../event-hub';
+import { Hub } from '../hub';
class PaneCompilerState {
@@ -53,7 +55,7 @@ export abstract class Pane<S> {
domRoot: JQuery;
topBar: JQuery;
hideable: JQuery;
- eventHub: any /* typeof hub.createEventHub() */;
+ eventHub: EventHub;
isAwaitingInitialResults = false;
settings: SiteSettings | Record<string, never> = {};
paneName: string;
@@ -65,7 +67,7 @@ export abstract class Pane<S> {
*
* Overridable for implementors
*/
- protected constructor(hub: any /* Hub */, container: Container, state: S & PaneState) {
+ protected constructor(hub: Hub, container: Container, state: S & PaneState) {
this.container = container;
this.eventHub = hub.createEventHub();
this.domRoot = container.getElement();
diff --git a/static/panes/pp-view.ts b/static/panes/pp-view.ts
index 9c29fc4c8..c54abdae2 100644
--- a/static/panes/pp-view.ts
+++ b/static/panes/pp-view.ts
@@ -34,11 +34,12 @@ import * as monacoConfig from '../monaco-config';
import { PPViewState } from './pp-view.interfaces';
import { Container } from 'golden-layout';
import { MonacoPaneState } from './pane.interfaces';
+import { Hub } from '../hub';
export class PP extends MonacoPane<monaco.editor.IStandaloneCodeEditor, PPViewState> {
options: any;
- constructor(hub: any, container: Container, state: PPViewState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: PPViewState & MonacoPaneState) {
super(hub, container, state);
this.eventHub.emit('ppViewOpened', this.compilerInfo.compilerId);
this.eventHub.emit('requestSettings');
diff --git a/static/panes/rusthir-view.ts b/static/panes/rusthir-view.ts
index 453c2e8b5..f486388d6 100644
--- a/static/panes/rusthir-view.ts
+++ b/static/panes/rusthir-view.ts
@@ -32,9 +32,10 @@ import { RustHirState } from './rusthir-view.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
export class RustHir extends MonacoPane<monaco.editor.IStandaloneCodeEditor, RustHirState> {
- constructor(hub: any, container: Container, state: RustHirState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: RustHirState & MonacoPaneState) {
super(hub, container, state);
if (state && state.rustHirOutput) {
this.showRustHirResults(state.rustHirOutput);
diff --git a/static/panes/rustmacroexp-view.ts b/static/panes/rustmacroexp-view.ts
index 007f91e4a..2c1495240 100644
--- a/static/panes/rustmacroexp-view.ts
+++ b/static/panes/rustmacroexp-view.ts
@@ -32,9 +32,10 @@ import { RustMacroExpState } from './rustmacroexp-view.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
export class RustMacroExp extends MonacoPane<monaco.editor.IStandaloneCodeEditor, RustMacroExpState> {
- constructor(hub: any, container: Container, state: RustMacroExpState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: RustMacroExpState & MonacoPaneState) {
super(hub, container, state);
if (state && state.rustMacroExpOutput) {
this.showRustMacroExpResults(state.rustMacroExpOutput);
diff --git a/static/panes/rustmir-view.ts b/static/panes/rustmir-view.ts
index 417bbbcce..c8a3c5b2e 100644
--- a/static/panes/rustmir-view.ts
+++ b/static/panes/rustmir-view.ts
@@ -32,9 +32,10 @@ import { RustMirState } from './rustmir-view.interfaces';
import { ga } from '../analytics';
import { extendConfig } from '../monaco-config';
+import { Hub } from '../hub';
export class RustMir extends MonacoPane<monaco.editor.IStandaloneCodeEditor, RustMirState> {
- constructor(hub: any, container: Container, state: RustMirState & MonacoPaneState) {
+ constructor(hub: Hub, container: Container, state: RustMirState & MonacoPaneState) {
super(hub, container, state);
if (state && state.rustMirOutput) {
this.showRustMirResults(state.rustMirOutput);
diff --git a/static/panes/tree.ts b/static/panes/tree.ts
index bc5a0debb..1476ebbf7 100644
--- a/static/panes/tree.ts
+++ b/static/panes/tree.ts
@@ -27,6 +27,8 @@ import {LineColouring} from '../line-colouring';
import * as utils from '../utils';
import { Settings } from '../settings';
import { PaneRenaming } from '../widgets/pane-renaming';
+import { Hub } from '../hub';
+import { EventHub } from '../event-hub';
const _ = require('underscore');
const $ = require('jquery');
@@ -49,8 +51,8 @@ export class Tree {
public readonly id: number;
private container: any;
private domRoot: any;
- private readonly hub: any;
- private eventHub: any;
+ private readonly hub: Hub;
+ private eventHub: EventHub;
private readonly settings: any;
private httpRoot: any;
private readonly alertSystem: any;
@@ -76,7 +78,7 @@ export class Tree {
private paneRenaming: PaneRenaming;
// TODO(supergrecko): swap argument order of state and container
- constructor(hub, state: TreeState, container) {
+ constructor(hub: Hub, state: TreeState, container) {
this.id = state.id || hub.nextTreeId();
this.container = container;
this.domRoot = container.getElement();