summary refs log tree commit diff stats
path: root/compiler/ast.nim
diff options
context:
space:
mode:
authorOscar Campbell <oscar@campbell.nu>2015-06-10 19:08:45 +0200
committerOscar Campbell <oscar@campbell.nu>2015-06-10 19:08:45 +0200
commitb3eb8ab81c325d21dd234e945224b0e14a1b88f4 (patch)
tree58217a7430f79b3215b3f44fd89eabb9ecc5422d /compiler/ast.nim
parentf0b6c03b2686aca85670cd35f84c6b0bdc3ff23d (diff)
parentd892887c937a1e07418afb620098d4cd98275b2a (diff)
downloadNim-b3eb8ab81c325d21dd234e945224b0e14a1b88f4.tar.gz
Merge branch 'devel' into bugfix-2858-testament-sources-system-wide
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r--compiler/ast.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index c141352cb..668f20bcd 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -10,7 +10,7 @@
 # abstract syntax tree + symbol table
 
 import
-  msgs, hashes, nversion, options, strutils, crc, ropes, idents, lists,
+  msgs, hashes, nversion, options, strutils, securehash, ropes, idents, lists,
   intsets, idgen
 
 type
@@ -948,6 +948,9 @@ proc add*(father, son: PNode) =
 proc `[]`*(n: PNode, i: int): PNode {.inline.} =
   result = n.sons[i]
 
+template `-|`*(b, s: expr): expr =
+  (if b >= 0: b else: s.len + b)
+
 # 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 =