summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
authordef <dennis@felsin9.de>2015-03-17 17:50:32 +0100
committerdef <dennis@felsin9.de>2015-03-17 17:50:32 +0100
commitfd4e6299057b0ce59a89553e7c32a9ea62da14db (patch)
tree45bb61ec52b415ffd07caae7c5b7fc10a0d99577 /tests/macros
parent8e651fa0d456786df15445e10e14b9d4e96c21ff (diff)
downloadNim-fd4e6299057b0ce59a89553e7c32a9ea62da14db.tar.gz
Rename PNimrodNode to NimNode
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tbugs.nim6
-rw-r--r--tests/macros/tdumpast.nim8
-rw-r--r--tests/macros/tdumpast2.nim14
-rw-r--r--tests/macros/tgensym.nim12
-rw-r--r--tests/macros/tgentemplates.nim4
-rw-r--r--tests/macros/tmacro1.nim6
-rw-r--r--tests/macros/tmacro3.nim4
-rw-r--r--tests/macros/tmacro4.nim2
-rw-r--r--tests/macros/tmacro5.nim8
-rw-r--r--tests/macros/tmacros1.nim4
-rw-r--r--tests/macros/tnimnode_for_runtime.nim2
-rw-r--r--tests/macros/tstringinterp.nim12
-rw-r--r--tests/macros/tvarnimnode.nim2
13 files changed, 42 insertions, 42 deletions
diff --git a/tests/macros/tbugs.nim b/tests/macros/tbugs.nim
index 3db851dd1..1ecb0d4cc 100644
--- a/tests/macros/tbugs.nim
+++ b/tests/macros/tbugs.nim
@@ -46,13 +46,13 @@ echotest()
 
 # bug #1103
 
-type 
+type
     Td = tuple
         a:string
         b:int
 
 proc get_data(d: Td) : string {.compileTime.} =
-    result = d.a # Works if a literal string is used here. 
+    result = d.a # Works if a literal string is used here.
     # Bugs if line A or B is active. Works with C
     result &= "aa"          # A
     #result.add("aa")       # B
@@ -69,7 +69,7 @@ m(s)
 
 # bug #933
 
-proc nilcheck(): PNimrodNode {.compileTime.} =
+proc nilcheck(): NimNode {.compileTime.} =
   echo(result == nil) # true
   echo(result.isNil) # true
   echo(repr(result)) # nil
diff --git a/tests/macros/tdumpast.nim b/tests/macros/tdumpast.nim
index 160e4e194..e3388591a 100644
--- a/tests/macros/tdumpast.nim
+++ b/tests/macros/tdumpast.nim
@@ -1,4 +1,4 @@
-# Dump the contents of a PNimrodNode
+# Dump the contents of a NimNode
 
 import macros
 
@@ -7,7 +7,7 @@ template plus(a, b: expr): expr {.dirty} =
 
 macro call(e: expr): expr =
   result = newCall("foo", newStrLitNode("bar"))
-  
+
 macro dumpAST(n: stmt): stmt {.immediate.} =
   # dump AST as a side-effect and return the inner node
   let n = callsite()
@@ -24,10 +24,10 @@ macro dumpAST(n: stmt): stmt {.immediate.} =
   echo e.lispRepr
 
   result = n[1]
-  
+
 dumpAST:
   proc add(x, y: int): int =
     return x + y
-  
+
   proc sub(x, y: int): int = return x - y
 
diff --git a/tests/macros/tdumpast2.nim b/tests/macros/tdumpast2.nim
index 2a7024a01..6b694fa77 100644
--- a/tests/macros/tdumpast2.nim
+++ b/tests/macros/tdumpast2.nim
@@ -1,13 +1,13 @@
-# Dump the contents of a PNimrodNode
+# Dump the contents of a NimNode
 
 import macros
 
-proc dumpit(n: PNimrodNode): string {.compileTime.} = 
+proc dumpit(n: NimNode): string {.compileTime.} =
   if n == nil: return "nil"
   result = $n.kind
   add(result, "(")
   case n.kind
-  of nnkEmpty: discard # same as nil node in this representation 
+  of nnkEmpty: discard # same as nil node in this representation
   of nnkNilLit:                  add(result, "nil")
   of nnkCharLit..nnkInt64Lit:    add(result, $n.intVal)
   of nnkFloatLit..nnkFloat64Lit: add(result, $n.floatVal)
@@ -20,17 +20,17 @@ proc dumpit(n: PNimrodNode): string {.compileTime.} =
       add(result, ", ")
       add(result, dumpit(n[j]))
   add(result, ")")
-  
-macro dumpAST(n: stmt): stmt {.immediate.} = 
+
+macro dumpAST(n: stmt): stmt {.immediate.} =
   # dump AST as a side-effect and return the inner node
   let n = callsite()
   echo dumpit(n)
   result = n[1]
-  
+
 dumpAST:
   proc add(x, y: int): int =
     return x + y
-  
+
   proc sub(x, y: int): int = return x - y
 
 
diff --git a/tests/macros/tgensym.nim b/tests/macros/tgensym.nim
index 3f4140ff4..b3aef0a2c 100644
--- a/tests/macros/tgensym.nim
+++ b/tests/macros/tgensym.nim
@@ -2,7 +2,7 @@ import rawsockets, asyncdispatch, macros
 var p = newDispatcher()
 var sock = newAsyncRawSocket()
 
-proc convertReturns(node, retFutureSym: PNimrodNode): PNimrodNode {.compileTime.} =
+proc convertReturns(node, retFutureSym: NimNode): NimNode {.compileTime.} =
   case node.kind
   of nnkReturnStmt:
     result = newCall(newIdentNode("complete"), retFutureSym, node[0])
@@ -19,19 +19,19 @@ macro async2(prc: stmt): stmt {.immediate.} =
   # -> var retFuture = newFuture[T]()
   var retFutureSym = newIdentNode("retFuture") #genSym(nskVar, "retFuture")
   outerProcBody.add(
-    newVarStmt(retFutureSym, 
+    newVarStmt(retFutureSym,
       newCall(
         newNimNode(nnkBracketExpr).add(
           newIdentNode("newFuture"),
           prc[3][0][1])))) # Get type from return type of this proc.
 
-  # -> iterator nameIter(): PFutureBase {.closure.} = <proc_body>
+  # -> iterator nameIter(): FutureBase {.closure.} = <proc_body>
   # Changing this line to: newIdentNode($prc[0].ident & "Iter") # will make it work.
   var iteratorNameSym = genSym(nskIterator, $prc[0].ident & "Iter")
   #var iteratorNameSym = newIdentNode($prc[0].ident & "Iter")
   var procBody = prc[6].convertReturns(retFutureSym)
 
-  var closureIterator = newProc(iteratorNameSym, [newIdentNode("PFutureBase")],
+  var closureIterator = newProc(iteratorNameSym, [newIdentNode("FutureBase")],
                                 procBody, nnkIteratorDef)
   closureIterator[4] = newNimNode(nnkPragma).add(newIdentNode("closure"))
   outerProcBody.add(closureIterator)
@@ -55,8 +55,8 @@ macro async2(prc: stmt): stmt {.immediate.} =
 
   result[6] = outerProcBody
 
-proc readStuff(): PFuture[string] {.async2.} =
-  var fut = connect(sock, "irc.freenode.org", TPort(6667))
+proc readStuff(): Future[string] {.async2.} =
+  var fut = connect(sock, "irc.freenode.org", Port(6667))
   yield fut
   var fut2 = recv(sock, 50)
   yield fut2
diff --git a/tests/macros/tgentemplates.nim b/tests/macros/tgentemplates.nim
index a7727c597..764b94bc7 100644
--- a/tests/macros/tgentemplates.nim
+++ b/tests/macros/tgentemplates.nim
@@ -2,7 +2,7 @@
 
 import parseutils, macros
 
-proc parse_until_symbol(node: PNimrodNode, value: string, index: var int): bool {.compiletime.} =
+proc parse_until_symbol(node: NimNode, value: string, index: var int): bool {.compiletime.} =
     var splitValue: string
     var read = value.parseUntil(splitValue, '$', index)
 
@@ -15,7 +15,7 @@ proc parse_until_symbol(node: PNimrodNode, value: string, index: var int): bool
     if splitValue.len > 0:
         node.insert node.len, newCall("add", ident("result"), newStrLitNode(splitValue))
 
-proc parse_template(node: PNimrodNode, value: string) {.compiletime.} =
+proc parse_template(node: NimNode, value: string) {.compiletime.} =
     var index = 0
     while index < value.len and
         parse_until_symbol(node, value, index): discard
diff --git a/tests/macros/tmacro1.nim b/tests/macros/tmacro1.nim
index 3a67c2611..2dd5c31df 100644
--- a/tests/macros/tmacro1.nim
+++ b/tests/macros/tmacro1.nim
@@ -3,17 +3,17 @@ import  macros
 from uri import `/`
 
 macro test*(a: stmt): stmt {.immediate.} =
-  var nodes: tuple[a, b: int]  
+  var nodes: tuple[a, b: int]
   nodes.a = 4
   nodes[1] = 45
-  
+
   type
     TTypeEx = object
       x, y: int
       case b: bool
       of false: nil
       of true: z: float
-      
+
   var t: TTypeEx
   t.b = true
   t.z = 4.5
diff --git a/tests/macros/tmacro3.nim b/tests/macros/tmacro3.nim
index 162212326..d7421ff7f 100644
--- a/tests/macros/tmacro3.nim
+++ b/tests/macros/tmacro3.nim
@@ -4,7 +4,7 @@ discard """
 
 import  macros
 
-type 
+type
     TA = tuple[a: int]
     PA = ref TA
 
@@ -19,7 +19,7 @@ test:
 macro test2*(a: stmt): stmt {.immediate.} =
   proc testproc(recurse: int) =
     echo "Thats weird"
-    var o : PNimrodNode = nil
+    var o : NimNode = nil
     echo "  no its not!"
     o = newNimNode(nnkNone)
     if recurse > 0:
diff --git a/tests/macros/tmacro4.nim b/tests/macros/tmacro4.nim
index 10a23b159..a56369369 100644
--- a/tests/macros/tmacro4.nim
+++ b/tests/macros/tmacro4.nim
@@ -7,7 +7,7 @@ import
 
 macro test_macro*(n: stmt): stmt {.immediate.} =
   result = newNimNode(nnkStmtList)
-  var ass : PNimrodNode = newNimNode(nnkAsgn)
+  var ass : NimNode = newNimNode(nnkAsgn)
   add(ass, newIdentNode("str"))
   add(ass, newStrLitNode("after"))
   add(result, ass)
diff --git a/tests/macros/tmacro5.nim b/tests/macros/tmacro5.nim
index 9882ad90d..d7a4fe8c8 100644
--- a/tests/macros/tmacro5.nim
+++ b/tests/macros/tmacro5.nim
@@ -1,7 +1,7 @@
 import macros,json
 
-var decls{.compileTime.}: seq[PNimrodNode] = @[]
-var impls{.compileTime.}: seq[PNimrodNode] = @[]
+var decls{.compileTime.}: seq[NimNode] = @[]
+var impls{.compileTime.}: seq[NimNode] = @[]
 
 macro importImpl_forward(name, returns): stmt {.immediate.} =
   result = newNimNode(nnkEmpty)
@@ -38,7 +38,7 @@ macro importImpl_forward(name, returns): stmt {.immediate.} =
   decls.add res
   echo(repr(res))
 
-macro importImpl(name, returns: expr, body: stmt): stmt {.immediate.} = 
+macro importImpl(name, returns: expr, body: stmt): stmt {.immediate.} =
   #var res = getAST(importImpl_forward(name, returns))
   discard getAST(importImpl_forward(name, returns))
   var res = copyNimTree(decls[decls.high])
@@ -56,4 +56,4 @@ importImpl(Item, int):
 importImpl(Foo, int16):
   echo 77
 
-okayy
\ No newline at end of file
+okayy
diff --git a/tests/macros/tmacros1.nim b/tests/macros/tmacros1.nim
index 3c814ad6d..1a1073a44 100644
--- a/tests/macros/tmacros1.nim
+++ b/tests/macros/tmacros1.nim
@@ -15,10 +15,10 @@ macro outterMacro*(n: stmt): stmt {.immediate.} =
   expectKind(n, TNimrodNodeKind.nnkCall)
   if n.len != 3 or n[1].kind != TNimrodNodeKind.nnkIdent:
     error("Macro " & callNode.repr &
-      " requires the ident passed as parameter (eg: " & callNode.repr & 
+      " requires the ident passed as parameter (eg: " & callNode.repr &
       "(the_name_you_want)): statements.")
   result = newNimNode(TNimrodNodeKind.nnkStmtList)
-  var ass : PNimrodNode = newNimNode(nnkAsgn)
+  var ass : NimNode = newNimNode(nnkAsgn)
   ass.add(newIdentNode(n[1].ident))
   ass.add(newStrLitNode(innerProc(4)))
   result.add(ass)
diff --git a/tests/macros/tnimnode_for_runtime.nim b/tests/macros/tnimnode_for_runtime.nim
index 69c7aedd2..0520cd0dd 100644
--- a/tests/macros/tnimnode_for_runtime.nim
+++ b/tests/macros/tnimnode_for_runtime.nim
@@ -3,7 +3,7 @@ discard """
 """
 
 import macros
-proc makeMacro: PNimrodNode =
+proc makeMacro: NimNode =
   result = nil
 
 var p = makeMacro()
diff --git a/tests/macros/tstringinterp.nim b/tests/macros/tstringinterp.nim
index a500ed56e..bc79cdaba 100644
--- a/tests/macros/tstringinterp.nim
+++ b/tests/macros/tstringinterp.nim
@@ -19,7 +19,7 @@ template processInterpolations(e: expr) =
 
 macro formatStyleInterpolation(e: expr): expr =
   let e = callsite()
-  var 
+  var
     formatString = ""
     arrayNode = newNimNode(nnkBracket)
     idx = 1
@@ -27,14 +27,14 @@ macro formatStyleInterpolation(e: expr): expr =
   proc addString(s: string) =
     formatString.add(s)
 
-  proc addExpr(e: PNimrodNode) =
+  proc addExpr(e: NimNode) =
     arrayNode.add(e)
     formatString.add("$" & $(idx))
     inc idx
 
   proc addDollar() =
     formatString.add("$$")
-    
+
   processInterpolations(e)
 
   result = parseExpr("\"x\" % [y]")
@@ -43,11 +43,11 @@ macro formatStyleInterpolation(e: expr): expr =
 
 macro concatStyleInterpolation(e: expr): expr =
   let e = callsite()
-  var args: seq[PNimrodNode]
+  var args: seq[NimNode]
   newSeq(args, 0)
 
   proc addString(s: string)    = args.add(newStrLitNode(s))
-  proc addExpr(e: PNimrodNode) = args.add(e)
+  proc addExpr(e: NimNode) = args.add(e)
   proc addDollar()             = args.add(newStrLitNode"$")
 
   processInterpolations(e)
@@ -59,7 +59,7 @@ macro concatStyleInterpolation(e: expr): expr =
 proc sum(a, b, c: int): int =
   return (a + b + c)
 
-var 
+var
   alice = "Alice"
   bob = "Bob"
   a = 10
diff --git a/tests/macros/tvarnimnode.nim b/tests/macros/tvarnimnode.nim
index 73fcc16ea..ab0f66caa 100644
--- a/tests/macros/tvarnimnode.nim
+++ b/tests/macros/tvarnimnode.nim
@@ -6,7 +6,7 @@ discard """
 
 import macros
 
-proc test(f: var PNimrodNode) {.compileTime.} =
+proc test(f: var NimNode) {.compileTime.} =
   f = newNimNode(nnkStmtList)
   f.add newCall(newIdentNode("echo"), newLit(10))