summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/js/jsffi.nim6
-rw-r--r--tests/vm/tnimnode.nim18
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/js/jsffi.nim b/lib/js/jsffi.nim
index 0d359d9e6..13eb1e759 100644
--- a/lib/js/jsffi.nim
+++ b/lib/js/jsffi.nim
@@ -300,7 +300,7 @@ macro `.()`*[K: string | cstring, V: proc](obj: JsAssoc[K, V],
   result = quote do:
     (`dotOp`(`obj`, `field`))()
   for elem in args:
-    result[0].add elem
+    result.add elem
 
 # Iterators:
 
@@ -471,7 +471,7 @@ macro bindMethod*(procedure: typed): auto =
     # construct the `this` parameter:
     thisQuote = quote do:
       var `this` {. nodecl, importc .} : `thisType`
-    call = newNimNode(nnkCall).add(rawProc[0], thisQuote[0][0][0][0])
+    call = newNimNode(nnkCall).add(rawProc[0], thisQuote[0][0][0])
   # construct the procedure call inside the method
   if args.len > 2:
     for idx in 2..args.len-1:
@@ -483,6 +483,6 @@ macro bindMethod*(procedure: typed): auto =
       params,
       rawProc[4],
       rawProc[5],
-      newTree(nnkStmtList, thisQuote[0], call)
+      newTree(nnkStmtList, thisQuote, call)
   )
   result = body
diff --git a/tests/vm/tnimnode.nim b/tests/vm/tnimnode.nim
index e5a41e3c2..60e3189b0 100644
--- a/tests/vm/tnimnode.nim
+++ b/tests/vm/tnimnode.nim
@@ -15,9 +15,9 @@ static:
 
 proc checkNode(arg: NimNode; name: string): void {. compileTime .} =
   echo "checking ", name
-  
+
   assertEq arg.lispRepr , "StmtList(DiscardStmt(Empty()))"
-  
+
   node = arg
   nodeArray = [arg]
   nodeSeq[0] = arg
@@ -38,9 +38,9 @@ proc checkNode(arg: NimNode; name: string): void {. compileTime .} =
 static:
   # the root node that is used to generate the Ast
   var stmtList: NimNode
-  
+
   stmtList = newStmtList(nnkDiscardStmt.newTree(newEmptyNode()))
-  
+
   checkNode(stmtList, "direct construction")
 
 
@@ -50,12 +50,12 @@ macro foo(stmtList: untyped): untyped =
 foo:
   discard
 
-  
+
 static:
   stmtList = quote do:
     discard
 
-  checkNode(stmtList, "create with quote")
+  checkNode(newTree(nnkStmtList, stmtList), "create with quote")
 
 
 static:
@@ -64,13 +64,13 @@ static:
     for i in 0 ..< 10:
       discard
 
-  let innerBody = loop[0][2]
+  let innerBody = loop[2]
   innerBody.add newCall(ident"echo", newLit("Hello World"))
 
-  assertEq loop[0][2].lispRepr, innerBody.lispRepr
+  assertEq loop[2].lispRepr, innerBody.lispRepr
 
   echo "OK"
-  
+
 
 static:
   echo "testing creation of comment node"