diff options
author | bptato <nincsnevem662@gmail.com> | 2023-10-25 12:35:11 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-10-25 12:48:30 +0200 |
commit | 3f0a183d48a44cbbe642842fb60b69cca9e83390 (patch) | |
tree | 0aad7dfeaa3a9265e030b2ed2739de4e042a69a2 /src/js | |
parent | b6e5390ec286747ce6789f9cfec54dec8dc18fa3 (diff) | |
download | chawan-3f0a183d48a44cbbe642842fb60b69cca9e83390.tar.gz |
reduce new() usage
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/javascript.nim | 2 | ||||
-rw-r--r-- | src/js/typeptr.nim | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index e682098a..12c504a2 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -108,7 +108,7 @@ var runtimes {.threadVar.}: seq[JSRuntime] proc newJSRuntime*(): JSRuntime = let rt = JS_NewRuntime() - let opaque = new(JSRuntimeOpaque) + let opaque = JSRuntimeOpaque() GC_ref(opaque) JS_SetRuntimeOpaque(rt, cast[pointer](opaque)) # Must be added after opaque is set, or there is a chance of diff --git a/src/js/typeptr.nim b/src/js/typeptr.nim index 0d5c4deb..55fd89c7 100644 --- a/src/js/typeptr.nim +++ b/src/js/typeptr.nim @@ -10,8 +10,7 @@ proc getTypePtr*[T](x: T): pointer = return getTypeInfo(x) func getTypePtr*(t: typedesc[ref object]): pointer = - var x: t - new(x) + var x = t() return getTypePtr(x) func getTypePtr*(t: type): pointer = |