local * doesn't grab names in nested scopes

This commit is contained in:
leaf corcoran 2013-01-13 12:23:49 -08:00
parent cad4aea610
commit e075c2f971
6 changed files with 41 additions and 2 deletions

View File

@ -336,6 +336,9 @@ do
get = function(self, name)
return self._state[name]
end,
get_current = function(self, name)
return rawget(self._state, name)
end,
listen = function(self, name, fn)
self._listeners[name] = fn
end,

View File

@ -196,6 +196,9 @@ class Block
get: (name) =>
@_state[name]
get_current: (name) =>
rawget @_state, name
listen: (name, fn) =>
@_listeners[name] = fn

View File

@ -345,7 +345,7 @@ local Statement = Transformer({
assign = function(self, node)
local names, values = unpack(node, 2)
do
local globber = self:get("name_glob")
local globber = self:get_current("name_glob")
if globber then
local _list_0 = names
for _index_0 = 1, #_list_0 do

View File

@ -164,7 +164,7 @@ Statement = Transformer {
assign: (node) =>
names, values = unpack node, 2
if globber = @get "name_glob"
if globber = @get_current "name_glob"
for name in *names
if globber name
@put_name name

View File

@ -33,3 +33,20 @@ do
local *
x,y = "a", "b"
do
local *
if something
x = 2323
-- this is broken
do
local *
do
x = "one"
x = 100
do
x = "two"

View File

@ -30,4 +30,20 @@ end
do
local x, y
x, y = "a", "b"
end
do
if something then
x = 2323
end
end
do
local x
do
x = "one"
end
x = 100
do
x = "two"
end
end