summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-09-03 03:14:56 +0300
committerZahary Karadjov <zahary@gmail.com>2013-09-03 03:14:56 +0300
commit6082595e968f000b5089b1db7e72ad55bbf3fac3 (patch)
tree06a76e725c59524b5e7ab23e8c5f1a7c1bef5e54 /compiler/semstmts.nim
parent39da6979add895cf58e9c6f883ef8df465975cd6 (diff)
parentc8c8d2035af189bdf63b39d4e47266a6e67c38b9 (diff)
downloadNim-6082595e968f000b5089b1db7e72ad55bbf3fac3.tar.gz
Merge branch 'type-classes' into upstream
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 7e69dbd92..0ce58ba5c 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -838,7 +838,14 @@ proc semProcAnnotation(c: PContext, prc: PNode): PNode =
     var it = n.sons[i]
     var key = if it.kind == nkExprColonExpr: it.sons[0] else: it
     let m = lookupMacro(c, key)
-    if m == nil: continue
+    if m == nil:
+      if key.kind == nkIdent and key.ident.id == ord(wDelegator):
+        if considerAcc(prc.sons[namePos]).s == "()":
+          prc.sons[namePos] = newIdentNode(idDelegator, prc.info)
+          prc.sons[pragmasPos] = copyExcept(n, i)
+        else:
+          LocalError(prc.info, errOnlyACallOpCanBeDelegator)
+      continue
     # we transform ``proc p {.m, rest.}`` into ``m(do: proc p {.rest.})`` and
     # let the semantic checker deal with it:
     var x = newNodeI(nkCall, n.info)
@@ -1147,7 +1154,7 @@ proc semPragmaBlock(c: PContext, n: PNode): PNode =
 
 proc semStaticStmt(c: PContext, n: PNode): PNode =
   let a = semStmt(c, n.sons[0])
-  result = evalStaticExpr(c.module, a, c.p.owner)
+  result = evalStaticExpr(c, c.module, a, c.p.owner)
   if result.isNil:
     LocalError(n.info, errCannotInterpretNodeX, renderTree(n))
     result = emptyNode