diff --git a/creator-assembler b/creator-assembler index 548330384..75c620cbc 160000 --- a/creator-assembler +++ b/creator-assembler @@ -1 +1 @@ -Subproject commit 548330384563285aef3179396dfde11aa113b29a +Subproject commit 75c620cbc7c1661310365118d8a8bf8432e22b33 diff --git a/docs/schema/architecture.json b/docs/schema/architecture.json index 196bdf8fb..192fc5bdb 100644 --- a/docs/schema/architecture.json +++ b/docs/schema/architecture.json @@ -1186,8 +1186,7 @@ "global_clear", "global_disable", "global_enable", - "handlers", - "is_global_enabled" + "handlers" ], "properties": { "check": { @@ -1235,8 +1234,8 @@ "type": ["string", "null"] }, "is_global_enabled": { - "description": "JS code to check whether interrupts are globally is enabled. Must return a boolean", - "type": "string" + "description": "JS code to check whether interrupts are globally is enabled. Must return a boolean. If not specified, always returns `true`", + "type": ["string", "null"] } } }, diff --git a/src/core/core.d.ts b/src/core/core.d.ts index eae11ff27..f9ae46492 100644 --- a/src/core/core.d.ts +++ b/src/core/core.d.ts @@ -114,7 +114,7 @@ type ArchitectureInterrupts = { global_disable: string; check: string; is_enabled?: string; - is_global_enabled: string; + is_global_enabled?: string; clear?: string; global_clear: string; create: string; diff --git a/src/core/executor/InterruptManager.mts b/src/core/executor/InterruptManager.mts index 5cd7303f5..85b22f2e3 100644 --- a/src/core/executor/InterruptManager.mts +++ b/src/core/executor/InterruptManager.mts @@ -180,14 +180,19 @@ class ArchitectureInterruptHandler extends InterruptHandler { public globalClear = this.#makeInjectedFunction(this.#config.global_clear); - public isGlobalEnabled = this.#makeInjectedFunction( - this.#config.is_global_enabled, - ); - - public isEnabled = this.#makeInjectedFunction( - "type", - this.#config.is_enabled ?? this.#config.is_global_enabled, - ); + public isGlobalEnabled = + // eslint-disable-next-line eqeqeq + this.#config.is_global_enabled == null // covers for undefined + ? (..._args: unknown[]) => { + return true; + } + : this.#makeInjectedFunction(this.#config.is_global_enabled); + + public isEnabled = + // eslint-disable-next-line eqeqeq + this.#config.is_enabled == null // covers for undefined + ? this.isGlobalEnabled + : this.#makeInjectedFunction("type", this.#config.is_enabled); public check = this.#makeInjectedFunction(this.#config.check); @@ -290,7 +295,7 @@ export class InterruptManager { /** Checks if a type of interrupt is globally enabled */ public isGlobalEnabled(): boolean { this.handler.isGlobalEnabled(this.status); - return this.status.globalEnabled ; + return this.status.globalEnabled; } /** Clears a specific interrupt type */