aboutsummaryrefslogtreecommitdiffstats
path: root/src/html/catom.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-10-27 21:49:13 +0100
committerbptato <nincsnevem662@gmail.com>2024-10-27 21:49:13 +0100
commitf7e0e02b89709b8d6592b3d570d8916a07ae2b79 (patch)
tree6f2de3d777b5d9a4d536a567d77dd667a04adf77 /src/html/catom.nim
parenta3aec669d0efb3ef94fee8b6a5f8283ba2d8b383 (diff)
downloadchawan-f7e0e02b89709b8d6592b3d570d8916a07ae2b79.tar.gz
Clean up forward declarations a bit
Diffstat (limited to 'src/html/catom.nim')
-rw-r--r--src/html/catom.nim13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim
index 93fbafcb..c0263d95 100644
--- a/src/html/catom.nim
+++ b/src/html/catom.nim
@@ -198,29 +198,30 @@ func toStaticAtom*(factory: CAtomFactory; atom: CAtom): StaticAtom =
return StaticAtom(i)
return atUnknown
-var getFactory*: proc(ctx: JSContext): CAtomFactory {.nimcall, noSideEffect,
+# Forward declaration hack
+var getFactoryImpl*: proc(ctx: JSContext): CAtomFactory {.nimcall, noSideEffect,
raises: [].}
proc toAtom*(ctx: JSContext; atom: StaticAtom): CAtom =
- return ctx.getFactory().toAtom(atom)
+ return ctx.getFactoryImpl().toAtom(atom)
proc toStaticAtom*(ctx: JSContext; atom: CAtom): StaticAtom =
- return ctx.getFactory().toStaticAtom(atom)
+ return ctx.getFactoryImpl().toStaticAtom(atom)
proc fromJS*(ctx: JSContext; val: JSValue; res: var CAtom): Opt[void] =
var s: string
?ctx.fromJS(val, s)
- res = ctx.getFactory().toAtom(s)
+ res = ctx.getFactoryImpl().toAtom(s)
return ok()
proc fromJS*(ctx: JSContext; val: JSAtom; res: var CAtom): Opt[void] =
var s: string
?ctx.fromJS(val, s)
- res = ctx.getFactory().toAtom(s)
+ res = ctx.getFactoryImpl().toAtom(s)
return ok()
proc toJS*(ctx: JSContext; atom: CAtom): JSValue =
- return ctx.toJS(ctx.getFactory().toStr(atom))
+ return ctx.toJS(ctx.getFactoryImpl().toStr(atom))
proc toJS*(ctx: JSContext; atom: StaticAtom): JSValue =
return ctx.toJS($atom)