about summary refs log tree commit diff stats
path: root/src/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-25 12:35:11 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-25 12:48:30 +0200
commit3f0a183d48a44cbbe642842fb60b69cca9e83390 (patch)
tree0aad7dfeaa3a9265e030b2ed2739de4e042a69a2 /src/js
parentb6e5390ec286747ce6789f9cfec54dec8dc18fa3 (diff)
downloadchawan-3f0a183d48a44cbbe642842fb60b69cca9e83390.tar.gz
reduce new() usage
Diffstat (limited to 'src/js')
-rw-r--r--src/js/javascript.nim2
-rw-r--r--src/js/typeptr.nim3
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 =