make tests green again

This commit is contained in:
Andreas Rumpf 2017-09-26 23:07:37 +02:00
commit 414e7eff04
2 changed files with 12 additions and 12 deletions

View file

@ -300,7 +300,7 @@ macro `.()`*[K: string | cstring, V: proc](obj: JsAssoc[K, V],
result = quote do: result = quote do:
(`dotOp`(`obj`, `field`))() (`dotOp`(`obj`, `field`))()
for elem in args: for elem in args:
result[0].add elem result.add elem
# Iterators: # Iterators:
@ -471,7 +471,7 @@ macro bindMethod*(procedure: typed): auto =
# construct the `this` parameter: # construct the `this` parameter:
thisQuote = quote do: thisQuote = quote do:
var `this` {. nodecl, importc .} : `thisType` 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 # construct the procedure call inside the method
if args.len > 2: if args.len > 2:
for idx in 2..args.len-1: for idx in 2..args.len-1:
@ -483,6 +483,6 @@ macro bindMethod*(procedure: typed): auto =
params, params,
rawProc[4], rawProc[4],
rawProc[5], rawProc[5],
newTree(nnkStmtList, thisQuote[0], call) newTree(nnkStmtList, thisQuote, call)
) )
result = body result = body

View file

@ -55,7 +55,7 @@ static:
stmtList = quote do: stmtList = quote do:
discard discard
checkNode(stmtList, "create with quote") checkNode(newTree(nnkStmtList, stmtList), "create with quote")
static: static:
@ -64,10 +64,10 @@ static:
for i in 0 ..< 10: for i in 0 ..< 10:
discard discard
let innerBody = loop[0][2] let innerBody = loop[2]
innerBody.add newCall(ident"echo", newLit("Hello World")) innerBody.add newCall(ident"echo", newLit("Hello World"))
assertEq loop[0][2].lispRepr, innerBody.lispRepr assertEq loop[2].lispRepr, innerBody.lispRepr
echo "OK" echo "OK"