diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-03-06 21:57:35 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-03-06 21:57:35 +0200 |
commit | 862c0ef83d7a85798df0474522dd4ba8cfcab674 (patch) | |
tree | e617065ce6bd6d72c278d7b22edbc5fcc5d86a58 /compiler/pragmas.nim | |
parent | 5324c9ebba1aa21c893db03c1d56d3ce1b42f162 (diff) | |
download | Nim-862c0ef83d7a85798df0474522dd4ba8cfcab674.tar.gz |
split the inline and closure iterators into different symbol kinds for easier discrimination between them
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 4304e5fb7..e0123c658 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -772,6 +772,17 @@ proc implictPragmas*(c: PContext, sym: PSym, n: PNode, addToLib(lib, sym) if sym.loc.r == nil: sym.loc.r = toRope(sym.name.s) +proc hasPragma*(n: PNode, pragma: TSpecialWord): bool = + if n == nil or n.sons == nil: + return false + + for p in n.sons: + var key = if p.kind == nkExprColonExpr: p[0] else: p + if key.kind == nkIdent and whichKeyword(key.ident) == pragma: + return true + + return false + proc pragma(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) = if n == nil: return for i in countup(0, sonsLen(n) - 1): |