diff options
author | Araq <rumpf_a@web.de> | 2018-09-25 00:28:39 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-09-25 00:28:39 +0200 |
commit | 548fc778c9b7048f474bf53c5d665bb8425e3343 (patch) | |
tree | bfae68122544db324cbb01b032eab1795ed6e0b8 /compiler/pragmas.nim | |
parent | 8029a649ba2cd394cad1749c017d5758cdcdbd4c (diff) | |
download | Nim-548fc778c9b7048f474bf53c5d665bb8425e3343.tar.gz |
.error for routines now can also have a custom error message; improve error message for 'nil' strings
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 36c79bc9e..9a624fcce 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -954,12 +954,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, recordPragma(c, it, "warning", s) message(c.config, it.info, warnUser, s) of wError: - if sym != nil and sym.isRoutine: + if sym != nil and (sym.isRoutine or sym.kind == skType): # This is subtle but correct: the error *statement* is only # allowed for top level statements. Seems to be easier than # distinguishing properly between # ``proc p() {.error}`` and ``proc p() = {.error: "msg".}`` - noVal(c, it) + if it.kind in nkPragmaCallKinds: discard getStrLitNode(c, it) incl(sym.flags, sfError) else: let s = expectStrLit(c, it) |