This commit is contained in:
Andreas Rumpf 2018-10-26 01:25:06 +02:00
commit 0c3e6735ac

View file

@ -949,10 +949,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
recordPragma(c, it, "warning", s) recordPragma(c, it, "warning", s)
message(c.config, it.info, warnUser, s) message(c.config, it.info, warnUser, s)
of wError: of wError:
if sym != nil and (sym.isRoutine or sym.kind == skType): if sym != nil and (sym.isRoutine or sym.kind == skType) and wUsed in validPragmas:
# This is subtle but correct: the error *statement* is only # This is subtle but correct: the error *statement* is only
# allowed for top level statements. Seems to be easier than # allowed when 'wUsed' is not in validPragmas. Here this is the easiest way to
# distinguishing properly between # distinguish properly between
# ``proc p() {.error}`` and ``proc p() = {.error: "msg".}`` # ``proc p() {.error}`` and ``proc p() = {.error: "msg".}``
if it.kind in nkPragmaCallKinds: discard getStrLitNode(c, it) if it.kind in nkPragmaCallKinds: discard getStrLitNode(c, it)
incl(sym.flags, sfError) incl(sym.flags, sfError)