implemented delegators and improved the error messages of unmatched type classes
This commit is contained in:
parent
89086a8e19
commit
28d9398de7
13 changed files with 130 additions and 93 deletions
|
|
@ -835,7 +835,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue