Handle local variable shadowing.

This commit is contained in:
Bob Nystrom
2013-11-30 18:28:01 -08:00
parent 74c414937c
commit 88852960ca
7 changed files with 186 additions and 113 deletions
@@ -0,0 +1,3 @@
fn(a) {
var a = "oops" // expect error
}
+6
View File
@@ -0,0 +1,6 @@
{
var a = "outer"
{
io.write(a) // expect: outer
}
}
+6
View File
@@ -0,0 +1,6 @@
var a = "global"
{
var a = "shadow"
io.write(a) // expect: shadow
}
io.write(a) // expect: global
+8
View File
@@ -0,0 +1,8 @@
{
var a = "local"
{
var a = "shadow"
io.write(a) // expect: shadow
}
io.write(a) // expect: local
}