parent
35e37fd8ec
commit
25f5ea7000
3 changed files with 13 additions and 0 deletions
|
|
@ -71,6 +71,7 @@ const
|
||||||
letPragmas* = varPragmas
|
letPragmas* = varPragmas
|
||||||
procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect,
|
procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect,
|
||||||
wThread, wRaises, wLocks, wTags, wGcSafe}
|
wThread, wRaises, wLocks, wTags, wGcSafe}
|
||||||
|
forVarPragmas* = {wInject, wGensym}
|
||||||
allRoutinePragmas* = methodPragmas + iteratorPragmas + lambdaPragmas
|
allRoutinePragmas* = methodPragmas + iteratorPragmas + lambdaPragmas
|
||||||
|
|
||||||
proc getPragmaVal*(procAst: PNode; name: TSpecialWord): PNode =
|
proc getPragmaVal*(procAst: PNode; name: TSpecialWord): PNode =
|
||||||
|
|
|
||||||
|
|
@ -567,6 +567,8 @@ proc symForVar(c: PContext, n: PNode): PSym =
|
||||||
let m = if n.kind == nkPragmaExpr: n.sons[0] else: n
|
let m = if n.kind == nkPragmaExpr: n.sons[0] else: n
|
||||||
result = newSymG(skForVar, m, c)
|
result = newSymG(skForVar, m, c)
|
||||||
styleCheckDef(c.config, result)
|
styleCheckDef(c.config, result)
|
||||||
|
if n.kind == nkPragmaExpr:
|
||||||
|
pragma(c, result, n.sons[1], forVarPragmas)
|
||||||
|
|
||||||
proc semForVars(c: PContext, n: PNode): PNode =
|
proc semForVars(c: PContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
|
|
|
||||||
10
tests/pragmas/t8741.nim
Normal file
10
tests/pragmas/t8741.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
discard """
|
||||||
|
line: 9
|
||||||
|
errormsg: "attempting to call undeclared routine: 'foobar'"
|
||||||
|
"""
|
||||||
|
|
||||||
|
for a {.gensym, inject.} in @[1,2,3]:
|
||||||
|
discard
|
||||||
|
|
||||||
|
for a {.foobar.} in @[1,2,3]:
|
||||||
|
discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue