Add tests for nested with blocks

Added two tests that test the behavior of nested `with` blocks. When a
nested `with` block is started, using a variable referenced from the
enclosing one, expected behavior is to change the short-dot syntax scope
to the newly-referenced variable.
This commit is contained in:
David Davidović 2015-09-05 17:01:28 +02:00 committed by leaf corcoran
parent b78cdab10b
commit 5ae8ffaed7
2 changed files with 31 additions and 1 deletions

View File

@ -93,6 +93,16 @@ do
with k.j = "jo"
print \upper!
do
with a
print .b
-- nested `with`s should change the scope correctly
with .c
print .d
do
with a
-- nested `with`s with assignments should change the scope correctly
with .b = 2
print .c

View File

@ -131,6 +131,26 @@ do
local _with_0 = "jo"
k.j = _with_0
print(_with_0:upper())
end
end
do
do
local _with_0 = a
print(_with_0.b)
do
local _with_1 = _with_0.c
print(_with_1.d)
end
end
end
do
do
local _with_0 = a
do
local _with_1 = 2
_with_0.b = _with_1
print(_with_1.c)
end
return _with_0
end
end