summary refs log tree commit diff stats
path: root/compiler/ast.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-10-03 20:51:22 +0200
committerAraq <rumpf_a@web.de>2012-10-03 20:51:22 +0200
commitc2b8669e04560e486e5df21b1217e6b9684ba88e (patch)
treecdff4a9c1ba92e7feb1990989caff5415fe83dd5 /compiler/ast.nim
parent9fbee85cc9dd95c1f99e5b55a3d382196eabb7fc (diff)
parent34e62d9f734189a9237725569aa282e9bedc11a3 (diff)
downloadNim-c2b8669e04560e486e5df21b1217e6b9684ba88e.tar.gz
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'compiler/ast.nim')
-rwxr-xr-xcompiler/ast.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index 814784029..aa94644aa 100755
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -350,6 +350,8 @@ type
                       # pass of semProcTypeNode performed after instantiation.
                       # this won't be needed if we don't perform this redundant
                       # second pass (stay tuned).
+    tfRetType         # marks return types in proc (used to detect type classes 
+                      # used as return types for return type inference)
     tfAll,            # type class requires all constraints to be met (default)
     tfAny,            # type class requires any constraint to be met
     tfCapturesEnv,    # whether proc really captures some environment
@@ -779,6 +781,11 @@ proc add*(father, son: PNode) =
 proc `[]`*(n: PNode, i: int): PNode {.inline.} =
   result = n.sons[i]
 
+# son access operators with support for negative indices
+template `{}`*(n: PNode, i: int): expr = n[i -| n]
+template `{}=`*(n: PNode, i: int, s: PNode): stmt =
+  n.sons[i -| n] = s
+  
 var emptyNode* = newNode(nkEmpty)
 # There is a single empty node that is shared! Do not overwrite it!