summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-07-29 10:20:39 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-08-11 20:14:44 +0200
commitdfe067a74a0b62b74bf9680f1982805132ac9ffa (patch)
treeebcb0a14be4ded137678c2fc481e2d11cc58e4e2
parent4150606422ca559616d25e0ae4b7a005d73171d3 (diff)
downloadNim-dfe067a74a0b62b74bf9680f1982805132ac9ffa.tar.gz
reorder pass: consider the 'using' statement; disabled debug output
-rw-r--r--compiler/reorder.nim4
-rw-r--r--tests/modules/treorder.nim12
2 files changed, 10 insertions, 6 deletions
diff --git a/compiler/reorder.nim b/compiler/reorder.nim
index 215bc4112..06b937421 100644
--- a/compiler/reorder.nim
+++ b/compiler/reorder.nim
@@ -35,7 +35,7 @@ proc computeDeps(n: PNode, declares, uses: var IntSet; topLevel: bool) =
   of procDefs:
     decl(n[0])
     for i in 1..bodyPos: deps(n[i])
-  of nkLetSection, nkVarSection:
+  of nkLetSection, nkVarSection, nkUsingStmt:
     for a in n:
       if a.kind in {nkIdentDefs, nkVarTuple}:
         for j in countup(0, a.len-3): decl(a[j])
@@ -99,4 +99,4 @@ proc reorder*(n: PNode): PNode =
       result.sons[i].flags = result.sons[i].flags - {nfTempMark, nfPermMark}
       result.sons[L - i].flags = result.sons[L - i].flags - {nfTempMark, nfPermMark}
       swap(result.sons[i], result.sons[L - i])
-  echo result
+  #echo result
diff --git a/tests/modules/treorder.nim b/tests/modules/treorder.nim
index abe74c5df..25280c429 100644
--- a/tests/modules/treorder.nim
+++ b/tests/modules/treorder.nim
@@ -3,10 +3,11 @@ discard """
   output: '''works 34
 34
 defined
-first impl'''
+3'''
 """
 
 {.reorder: on.}
+{.experimental.}
 
 {.push callconv: stdcall.}
 proc bar(x: T)
@@ -32,11 +33,14 @@ else:
   proc whendep() = echo "undefined"
 
 when not declared(goo):
-  proc goo() = echo "first impl"
+  proc goo(my, omy) = echo my
 
 when not declared(goo):
-  proc goo() = echo "second impl"
+  proc goo(my, omy) = echo omy
 
-goo()
+using
+  my, omy: int
+
+goo(3, 4)
 
 {.pop.}