summary refs log tree commit diff stats
path: root/compiler/astalgo.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-05-18 20:53:41 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-05-18 20:53:41 +0200
commitfeef109e60fd33ff350cbcf82298a7cae83bbd72 (patch)
tree8ffd0028e2401765a6a7d6100d5731bd9f3f0425 /compiler/astalgo.nim
parent3af5a5d9e3604a903505a04d2747c04986e6042f (diff)
downloadNim-feef109e60fd33ff350cbcf82298a7cae83bbd72.tar.gz
make tests green again
Diffstat (limited to 'compiler/astalgo.nim')
-rw-r--r--compiler/astalgo.nim40
1 files changed, 21 insertions, 19 deletions
diff --git a/compiler/astalgo.nim b/compiler/astalgo.nim
index 2ad1e24cb..1b6417964 100644
--- a/compiler/astalgo.nim
+++ b/compiler/astalgo.nim
@@ -61,11 +61,12 @@ type
 proc initIdentIter*(ti: var TIdentIter, tab: TStrTable, s: PIdent): PSym
 proc nextIdentIter*(ti: var TIdentIter, tab: TStrTable): PSym
 
-# these are for debugging only: They are not really deprecated, but I want
-# the warning so that release versions do not contain debugging statements:
-proc debug*(conf: ConfigRef; n: PSym) {.deprecated.}
-proc debug*(conf: ConfigRef; n: PType) {.deprecated.}
-proc debug*(conf: ConfigRef; n: PNode) {.deprecated.}
+when declared(echo):
+  # these are for debugging only: They are not really deprecated, but I want
+  # the warning so that release versions do not contain debugging statements:
+  proc debug*(conf: ConfigRef; n: PSym) {.deprecated.}
+  proc debug*(conf: ConfigRef; n: PType) {.deprecated.}
+  proc debug*(conf: ConfigRef; n: PNode) {.deprecated.}
 
 template mdbg*: bool {.dirty.} =
   when compiles(c.module):
@@ -445,22 +446,23 @@ proc debugTree(conf: ConfigRef; n: PNode, indent: int, maxRecDepth: int;
           addf(result, "$N$1]", [istr])
     addf(result, "$N$1}", [rspaces(indent)])
 
-proc debug(conf: ConfigRef; n: PSym) =
-  if n == nil:
-    echo("null")
-  elif n.kind == skUnknown:
-    echo("skUnknown")
-  else:
-    #writeLine(stdout, $symToYaml(n, 0, 1))
-    echo("$1_$2: $3, $4, $5, $6" % [
-      n.name.s, $n.id, $flagsToStr(n.flags), $flagsToStr(n.loc.flags),
-      $lineInfoToStr(conf, n.info), $n.kind])
+when declared(echo):
+  proc debug(conf: ConfigRef; n: PSym) =
+    if n == nil:
+      echo("null")
+    elif n.kind == skUnknown:
+      echo("skUnknown")
+    else:
+      #writeLine(stdout, $symToYaml(n, 0, 1))
+      echo("$1_$2: $3, $4, $5, $6" % [
+        n.name.s, $n.id, $flagsToStr(n.flags), $flagsToStr(n.loc.flags),
+        $lineInfoToStr(conf, n.info), $n.kind])
 
-proc debug(conf: ConfigRef; n: PType) =
-  echo($debugType(conf, n))
+  proc debug(conf: ConfigRef; n: PType) =
+    echo($debugType(conf, n))
 
-proc debug(conf: ConfigRef; n: PNode) =
-  echo($debugTree(conf, n, 0, 100))
+  proc debug(conf: ConfigRef; n: PNode) =
+    echo($debugTree(conf, n, 0, 100))
 
 proc nextTry(h, maxHash: Hash): Hash =
   result = ((5 * h) + 1) and maxHash