diff options
author | bptato <nincsnevem662@gmail.com> | 2025-03-12 18:20:21 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2025-03-12 18:20:21 +0100 |
commit | 84b12b22dfc218f7f353ab51d1a3235ce6d8596b (patch) | |
tree | 39b4fe4c97ead5bf3dada23701a7bd83003abc77 /src/config/config.nim | |
parent | 9424b6910b3944731857d9b014ac37aec392b9d5 (diff) | |
download | chawan-84b12b22dfc218f7f353ab51d1a3235ce6d8596b.tar.gz |
Re-add JSValueConst
This time, I've also ported over the consistency check to prevent some ownership bugs. Unfortunately, the check is very limited, and it is still possible to double-free or leak JSValues. I think it would be possible to make coverage 100%, but only with ARC...
Diffstat (limited to 'src/config/config.nim')
-rw-r--r-- | src/config/config.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config/config.nim b/src/config/config.nim index 0dbc6877..094c9a30 100644 --- a/src/config/config.nim +++ b/src/config/config.nim @@ -216,7 +216,8 @@ jsDestructor(Config) converter toStr*(p: ChaPathResolved): string {.inline.} = return string(p) -proc fromJS(ctx: JSContext; val: JSValue; res: var ChaPathResolved): Opt[void] = +proc fromJS(ctx: JSContext; val: JSValueConst; res: var ChaPathResolved): + Opt[void] = return ctx.fromJS(val, string(res)) proc `[]=`(a: var ActionMap; b: string; c: sink string) = |