fixes #3171
This commit is contained in:
parent
9275d5c617
commit
bd786812e7
2 changed files with 282 additions and 272 deletions
|
|
@ -591,8 +591,11 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
|||
validPragmas: TSpecialWords): bool =
|
||||
var it = n.sons[i]
|
||||
var key = if it.kind == nkExprColonExpr: it.sons[0] else: it
|
||||
if key.kind == nkIdent:
|
||||
var userPragma = strTableGet(c.userPragmas, key.ident)
|
||||
if key.kind == nkBracketExpr:
|
||||
processNote(c, it)
|
||||
return
|
||||
let ident = considerQuotedIdent(key)
|
||||
var userPragma = strTableGet(c.userPragmas, ident)
|
||||
if userPragma != nil:
|
||||
inc c.instCounter
|
||||
if c.instCounter > 100:
|
||||
|
|
@ -603,7 +606,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
|||
n.sons[i] = userPragma.ast
|
||||
dec c.instCounter
|
||||
else:
|
||||
var k = whichKeyword(key.ident)
|
||||
var k = whichKeyword(ident)
|
||||
if k in validPragmas:
|
||||
case k
|
||||
of wExportc:
|
||||
|
|
@ -864,7 +867,6 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
|||
noVal(it)
|
||||
else: invalidPragma(it)
|
||||
else: invalidPragma(it)
|
||||
else: processNote(c, it)
|
||||
|
||||
proc implicitPragmas*(c: PContext, sym: PSym, n: PNode,
|
||||
validPragmas: TSpecialWords) =
|
||||
|
|
|
|||
8
tests/pragmas/tsym_as_pragma.nim
Normal file
8
tests/pragmas/tsym_as_pragma.nim
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
# bug #3171
|
||||
|
||||
template newDataWindow(): stmt =
|
||||
let eventClosure = proc (closure: pointer): bool {.closure, cdecl.} =
|
||||
discard
|
||||
|
||||
newDataWindow()
|
||||
Loading…
Add table
Add a link
Reference in a new issue