diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-11-26 22:15:33 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-11-27 00:36:29 +0100 |
commit | 93cf0ef52ef81af15009566f90e0d020903e8c2b (patch) | |
tree | 872220fcf81859bc4ff1044449de1ad4aea48138 /compiler/pragmas.nim | |
parent | 518c72e57a9c787a2d59b0895263427b4774ecad (diff) | |
download | Nim-93cf0ef52ef81af15009566f90e0d020903e8c2b.tar.gz |
don't crash where there is an unknown statement pragma [backport]
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index ef5223559..62f70a090 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -1110,10 +1110,13 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, else: sym.flags.incl sfUsed of wLiftLocals: discard else: invalidPragma(c, it) - elif sym.kind in {skVar,skLet,skParam,skField,skProc,skFunc,skConverter,skMethod,skType}: + elif sym != nil and sym.kind in {skVar, skLet, skParam, skField, skProc, + skFunc, skConverter, skMethod, skType}: n.sons[i] = semCustomPragma(c, it) - else: + elif sym != nil: illegalCustomPragma(c, it, sym) + else: + invalidPragma(c, it) proc implicitPragmas*(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) = |