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 =
|
validPragmas: TSpecialWords): bool =
|
||||||
var it = n.sons[i]
|
var it = n.sons[i]
|
||||||
var key = if it.kind == nkExprColonExpr: it.sons[0] else: it
|
var key = if it.kind == nkExprColonExpr: it.sons[0] else: it
|
||||||
if key.kind == nkIdent:
|
if key.kind == nkBracketExpr:
|
||||||
var userPragma = strTableGet(c.userPragmas, key.ident)
|
processNote(c, it)
|
||||||
|
return
|
||||||
|
let ident = considerQuotedIdent(key)
|
||||||
|
var userPragma = strTableGet(c.userPragmas, ident)
|
||||||
if userPragma != nil:
|
if userPragma != nil:
|
||||||
inc c.instCounter
|
inc c.instCounter
|
||||||
if c.instCounter > 100:
|
if c.instCounter > 100:
|
||||||
|
|
@ -603,7 +606,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
n.sons[i] = userPragma.ast
|
n.sons[i] = userPragma.ast
|
||||||
dec c.instCounter
|
dec c.instCounter
|
||||||
else:
|
else:
|
||||||
var k = whichKeyword(key.ident)
|
var k = whichKeyword(ident)
|
||||||
if k in validPragmas:
|
if k in validPragmas:
|
||||||
case k
|
case k
|
||||||
of wExportc:
|
of wExportc:
|
||||||
|
|
@ -864,7 +867,6 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
noVal(it)
|
noVal(it)
|
||||||
else: invalidPragma(it)
|
else: invalidPragma(it)
|
||||||
else: invalidPragma(it)
|
else: invalidPragma(it)
|
||||||
else: processNote(c, it)
|
|
||||||
|
|
||||||
proc implicitPragmas*(c: PContext, sym: PSym, n: PNode,
|
proc implicitPragmas*(c: PContext, sym: PSym, n: PNode,
|
||||||
validPragmas: TSpecialWords) =
|
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