Implement custom annotations (#6987)

This commit is contained in:
cooldome 2018-01-09 14:25:22 +00:00 • committed by Andreas Rumpf
commit 2c9e56a783
10 changed files with 254 additions and 42 deletions

View file

@ -608,7 +608,10 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
popOwner(c)
s.ast = n
result = n
if n.sons[bodyPos].kind == nkEmpty:
if sfCustomPragma in s.flags:
if n.sons[bodyPos].kind != nkEmpty:
localError(n.sons[bodyPos].info, errImplOfXNotAllowed, s.name.s)
elif n.sons[bodyPos].kind == nkEmpty:
localError(n.info, errImplOfXexpected, s.name.s)
var proto = searchForProc(c, c.currentScope, s)
if proto == nil: