From ca5d69d2486e38ec9300a8589cca522af62d3be9 Mon Sep 17 00:00:00 2001 From: benStre Date: Wed, 17 Jan 2024 23:57:41 +0100 Subject: [PATCH 1/4] disable function constructor if namespace is std --- types/function-utils.ts | 4 ++-- types/type.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/function-utils.ts b/types/function-utils.ts index 6e61a8f7..ab888f49 100644 --- a/types/function-utils.ts +++ b/types/function-utils.ts @@ -204,8 +204,8 @@ export function createFunctionWithDependencyInjections(source: string, dependenc } export class ExtensibleFunction { - constructor(f:globalThis.Function) { - return Object.setPrototypeOf(f, new.target.prototype); + constructor(f?:globalThis.Function) { + if (f) return Object.setPrototypeOf(f, new.target.prototype); } } diff --git a/types/type.ts b/types/type.ts index da123753..0824b195 100644 --- a/types/type.ts +++ b/types/type.ts @@ -367,7 +367,7 @@ export class Type extends ExtensibleFunction { // never call the constructor directly!! should be private constructor(namespace?:string, name?:string, variation?:string, parameters?:any[]) { - super((val:any) => this.cast(val)) + super(namespace && namespace != "std" ? (val:any) => this.cast(val) : undefined) if (name) this.name = name; if (namespace) this.namespace = namespace; if (variation) this.variation = variation; From 9fae0d6a457bf958d7d021589fc88b16cbb4eaa5 Mon Sep 17 00:00:00 2001 From: benStre Date: Thu, 18 Jan 2024 00:40:08 +0100 Subject: [PATCH 2/4] add debug message for potentially undefined header --- runtime/runtime.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/runtime.ts b/runtime/runtime.ts index 9fc00b39..fda166ec 100644 --- a/runtime/runtime.ts +++ b/runtime/runtime.ts @@ -1806,6 +1806,10 @@ export class Runtime { * @param header DXB header of incoming message */ private static updateEndpointOnlineState(header: dxb_header) { + if (!header) { + logger.error("updateEndpointOnlineState: no header provided"); + return; + } if (header.sender) { // received signed GOODBYE message -> endpoint is offline if (header.type == ProtocolDataType.GOODBYE) { From 33afb677e793427cb103a50a23ec71543a97d154 Mon Sep 17 00:00:00 2001 From: benStre Date: Thu, 18 Jan 2024 14:06:44 +0100 Subject: [PATCH 3/4] fix storagemap order --- types/type.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/type.ts b/types/type.ts index 0824b195..72ea2c0f 100644 --- a/types/type.ts +++ b/types/type.ts @@ -1081,15 +1081,15 @@ Type.std.Assertion.setJSInterface({ }) -Type.std.StorageMap.setJSInterface({ - class: StorageMap, +Type.std.StorageWeakMap.setJSInterface({ + class: StorageWeakMap, is_normal_object: true, proxify_children: true, visible_children: new Set(), }) -Type.std.StorageWeakMap.setJSInterface({ - class: StorageWeakMap, +Type.std.StorageMap.setJSInterface({ + class: StorageMap, is_normal_object: true, proxify_children: true, visible_children: new Set(), From 3787f4e937183e74591efd407a6b7176d66141a9 Mon Sep 17 00:00:00 2001 From: benStre Date: Thu, 18 Jan 2024 14:07:07 +0100 Subject: [PATCH 4/4] rename pointer error message --- runtime/pointers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/pointers.ts b/runtime/pointers.ts index 35017b0c..f8ab7b3d 100644 --- a/runtime/pointers.ts +++ b/runtime/pointers.ts @@ -1497,7 +1497,7 @@ export class Pointer extends Ref { // else if (!allow_failure) displayFatalError('pointer-not-found'); pointer.delete(); - throw new PointerError("Pointer $"+id_string+" has no assigned value", SCOPE); + throw new PointerError("Pointer $"+id_string+" does not exist", SCOPE); } }