diff options
author | LemonBoy <thatlemon@gmail.com> | 2018-06-24 18:27:40 +0200 |
---|---|---|
committer | LemonBoy <thatlemon@gmail.com> | 2018-06-24 18:27:40 +0200 |
commit | 95436893061176d51b1c11fdf5418b3ed17a8455 (patch) | |
tree | 7da71a2d383c24a9fe9c6c4abc4e2630c34f1c95 /compiler | |
parent | 105a472dc5eb239c68d7e13d8eef93c8dc0311be (diff) | |
download | Nim-95436893061176d51b1c11fdf5418b3ed17a8455.tar.gz |
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
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semstmts.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 292238dc9..fe4318de5 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -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) |