Make static blocks introduce their own scope
Treat the static block as a normal block, don't leak any identifier in the outer scope. Fixes #5958
This commit is contained in:
parent
105a472dc5
commit
9543689306
2 changed files with 11 additions and 0 deletions
|
|
@ -1772,7 +1772,9 @@ proc semStaticStmt(c: PContext, n: PNode): PNode =
|
|||
#echo "semStaticStmt"
|
||||
#writeStackTrace()
|
||||
inc c.inStaticContext
|
||||
openScope(c)
|
||||
let a = semStmt(c, n.sons[0])
|
||||
closeScope(c)
|
||||
dec c.inStaticContext
|
||||
n.sons[0] = a
|
||||
evalStaticStmt(c.module, c.graph, a, c.p.owner)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue