custom pragmas: proper error handling
This commit is contained in:
parent
cddc389784
commit
fc967cc715
1 changed files with 4 additions and 3 deletions
|
|
@ -657,15 +657,16 @@ proc pragmaGuard(c: PContext; it: PNode; kind: TSymKind): PSym =
|
||||||
result = qualifiedLookUp(c, n, {checkUndeclared})
|
result = qualifiedLookUp(c, n, {checkUndeclared})
|
||||||
|
|
||||||
proc semCustomPragma(c: PContext, n: PNode): PNode =
|
proc semCustomPragma(c: PContext, n: PNode): PNode =
|
||||||
assert(n.kind in nkPragmaCallKinds + {nkIdent})
|
|
||||||
|
|
||||||
if n.kind == nkIdent:
|
if n.kind == nkIdent:
|
||||||
result = newTree(nkCall, n)
|
result = newTree(nkCall, n)
|
||||||
elif n.kind == nkExprColonExpr:
|
elif n.kind == nkExprColonExpr:
|
||||||
# pragma: arg -> pragma(arg)
|
# pragma: arg -> pragma(arg)
|
||||||
result = newTree(nkCall, n[0], n[1])
|
result = newTree(nkCall, n[0], n[1])
|
||||||
else:
|
elif n.kind in nkPragmaCallKinds + {nkIdent}:
|
||||||
result = n
|
result = n
|
||||||
|
else:
|
||||||
|
invalidPragma(n)
|
||||||
|
return n
|
||||||
|
|
||||||
let r = c.semOverloadedCall(c, result, n, {skTemplate}, {})
|
let r = c.semOverloadedCall(c, result, n, {skTemplate}, {})
|
||||||
if r.isNil or sfCustomPragma notin r[0].sym.flags:
|
if r.isNil or sfCustomPragma notin r[0].sym.flags:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue