* Fixes #9365 : let with exportC pragma in template. * Fix according to comments.
This commit is contained in:
parent
55cf971adf
commit
a6d4421241
2 changed files with 15 additions and 0 deletions
|
|
@ -197,6 +197,12 @@ proc addLocalDecl(c: var TemplCtx, n: var PNode, k: TSymKind) =
|
|||
else:
|
||||
replaceIdentBySym(c.c, n, ident)
|
||||
else:
|
||||
if (n.kind == nkPragmaExpr and sonsLen(n) >= 2 and n.sons[1].kind == nkPragma):
|
||||
let pragmaNode = n.sons[1]
|
||||
for i in 0..<pragmaNode.sons.len:
|
||||
openScope(c)
|
||||
pragmaNode.sons[i] = semTemplBody(c,pragmaNode.sons[i])
|
||||
closeScope(c)
|
||||
let ident = getIdentNode(c, n)
|
||||
if not isTemplParam(c, ident):
|
||||
# fix #2670, consider:
|
||||
|
|
|
|||
9
tests/template/template_pragmas.nim
Normal file
9
tests/template/template_pragmas.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
proc output_x:string {.compileTime.} = "x"
|
||||
|
||||
template t =
|
||||
const x = output_x()
|
||||
let
|
||||
bar {.exportC:"bar" & x.} = 100
|
||||
|
||||
static:
|
||||
doAssert(compiles (t()))
|
||||
Loading…
Add table
Add a link
Reference in a new issue