Skip to content

Commit d94d411

Browse files
committed
comment update
1 parent 39cbfcc commit d94d411

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/twr-ts/twrcondummy.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import {IWasmModuleAsync} from "./twrmodasync.js";
33
import {IWasmModule} from "./twrmod.js"
44
import {twrLibrary, TLibImports, twrLibraryInstanceRegistry} from "./twrlibrary.js";
55

6-
// This class exists so the twrlibbuiltin can cause all functions (like twrConCls) to resolve at link time
6+
// This class exists so the twrlibbuiltin can cause all functions (like twrConCls) to resolve at runtime link time
77
// twr.a links to all of these, even if the relevant console is not loaded by the app at runtime
8-
// TODO!! remove this hack
8+
// These functions should never be called, because twrLibrary routes a call (like io_cls(id)) to the correct console instance based on id
9+
// see TODO comments in twrLibrary.ts for possible better fixes
910

1011
export default class twrConsoleDummy extends twrLibrary implements IConsoleStreamIn, IConsoleStreamOut, IConsoleAddressable, IConsoleCanvas {
1112
id:number;

source/twr-ts/twrlibrary.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ import {twrEventQueueReceive} from "./twreventqueue.js"
1212
// add test cases for twr_timer_single_shot, twr_timer_repeat, and twr_timer_cancel
1313
// resolve fact that libraries with interfaces are passed in the "io" option. Eg Allow "libs" or other synonym.
1414
// current implementation has no libs: (akin to io:).
15-
// remove twrcondummy hack. Search for TODO, there are multiple places needing fixing. Possible solutions:
16-
// (a) merge imports,
15+
// consider if twrcondummy should be removed. Search for TODO, there are multiple places needing fixing. Possible solutions:
16+
// (a) have interfaceName also list every function in the interface.
17+
// create placholder "internal error" functions when a console/library does not implement an interface function.
1718
// (b) require each function in interface in list each import correctly (either add isUnused or add dummy functions with exception)
19+
// (c) merge imports (this won't work because a complete set of functions might not be loaded by api user)
20+
// also search for "TODO!! This is here to make twrcondummy.ts"
1821
// changed conterm example to use debug -- either change back, or change index description
1922
// deal with twrConGetIDFromNameImpl. Note that twr_register_callback and twrConGetIDFromNameImpl are added in two different places. Unify?
2023
// change callingMod:IWasmModule|IWasmModuleAsync to IWasmBase ?
@@ -262,7 +265,7 @@ export class twrLibraryInstanceRegistry {
262265
if (!CompareImports(twrLibraryInstanceRegistry.libInterfaceInstances[i].imports, libInstance.imports))
263266
throw new Error(`interface definitions (imports) ${libInstance.interfaceName} are not compatible between class ${libInstance.libSourcePath} and ${alreadyRegisteredLibInstance.libSourcePath}`);
264267

265-
// total HACK. TODO!! FIX THIS This is here to make condummy work correctly
268+
// TODO!! This is here to make twrcondummy.ts work correctly (a console without a complete interface might be loaded before twrcondummy.ts)
266269
if (Object.keys(libInstance.imports).length > Object.keys(alreadyRegisteredLibInstance.imports).length)
267270
twrLibraryInstanceRegistry.libInterfaceInstances[interfaceID]=libInstance;
268271
}

0 commit comments

Comments
 (0)