diff options
author | Araq <rumpf_a@web.de> | 2012-10-03 20:51:22 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-10-03 20:51:22 +0200 |
commit | c2b8669e04560e486e5df21b1217e6b9684ba88e (patch) | |
tree | cdff4a9c1ba92e7feb1990989caff5415fe83dd5 /compiler/ast.nim | |
parent | 9fbee85cc9dd95c1f99e5b55a3d382196eabb7fc (diff) | |
parent | 34e62d9f734189a9237725569aa282e9bedc11a3 (diff) | |
download | Nim-c2b8669e04560e486e5df21b1217e6b9684ba88e.tar.gz |
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'compiler/ast.nim')
-rwxr-xr-x | compiler/ast.nim | 7 |
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! |