summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-beta/src/core/engineer.lua6
-rw-r--r--server-beta/src/core/getfield.lua13
-rw-r--r--server-beta/src/core/getglobal.lua18
-rw-r--r--server-beta/test/definition/bug.lua7
-rw-r--r--server-beta/test/definition/init.lua2
5 files changed, 25 insertions, 21 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua
index 4f29d1ea..656c29bf 100644
--- a/server-beta/src/core/engineer.lua
+++ b/server-beta/src/core/engineer.lua
@@ -293,15 +293,15 @@ function mt:childMode(source)
if source.type == 'getfield' then
return source.field, 'get'
elseif source.type == 'setfield' then
- return source.field, 'set'
+ return source.field, 'set', source.value
elseif source.type == 'getmethod' then
return source.method, 'get'
elseif source.type == 'setmethod' then
- return source.method, 'set'
+ return source.method, 'set', source.value
elseif source.type == 'getindex' then
return source.index, 'get'
elseif source.type == 'setindex' then
- return source.index, 'set'
+ return source.index, 'set', source.value
elseif source.type == 'field' then
return self:childMode(source.parent)
elseif source.type == 'method' then
diff --git a/server-beta/src/core/getfield.lua b/server-beta/src/core/getfield.lua
index c7d16316..fd0c8f33 100644
--- a/server-beta/src/core/getfield.lua
+++ b/server-beta/src/core/getfield.lua
@@ -29,11 +29,14 @@ function m:field(source, key, callback)
self:eachRef(source, function (src)
used[src] = true
- local child, mode = self:childMode(src)
+ local child, mode, value = self:childMode(src)
if child then
if key == guide.getKeyName(child) then
callback(child, mode)
end
+ if value then
+ self:eachField(value, key, callback)
+ end
return
end
if src.type == 'getglobal' then
@@ -45,13 +48,7 @@ function m:field(source, key, callback)
end
end
elseif src.type == 'setglobal' then
- local parent = src.parent
- child, mode = self:childMode(parent)
- if child then
- if key == guide.getKeyName(child) then
- callback(child, mode)
- end
- end
+ self:eachField(src.value, key, callback)
else
self:eachField(src, key, callback)
end
diff --git a/server-beta/src/core/getglobal.lua b/server-beta/src/core/getglobal.lua
index a6814a7d..05429c64 100644
--- a/server-beta/src/core/getglobal.lua
+++ b/server-beta/src/core/getglobal.lua
@@ -68,29 +68,29 @@ function m:field(source, key, callback)
self:eachRef(source, function (src)
used[src] = true
- local child, mode = self:childMode(src)
+ local child, mode, value = self:childMode(src)
if child then
if key == guide.getKeyName(child) then
callback(child, mode)
end
+ if value then
+ self:eachField(value, key, callback)
+ end
return
end
if src.type == 'getglobal' then
local parent = src.parent
- child, mode = self:childMode(parent)
+ child, mode, value = self:childMode(parent)
if child then
if key == guide.getKeyName(child) then
callback(child, mode)
end
- end
- elseif src.type == 'setglobal' then
- local parent = src.parent
- child, mode = self:childMode(parent)
- if child then
- if key == guide.getKeyName(child) then
- callback(child, mode)
+ if value then
+ self:eachField(value, key, callback)
end
end
+ elseif src.type == 'setglobal' then
+ self:eachField(src.value, key, callback)
else
self:eachField(src, key, callback)
end
diff --git a/server-beta/test/definition/bug.lua b/server-beta/test/definition/bug.lua
index 1d3ab02c..27d4700c 100644
--- a/server-beta/test/definition/bug.lua
+++ b/server-beta/test/definition/bug.lua
@@ -54,6 +54,13 @@ self[self.results.<?labels?>] = lbl
]]
TEST [[
+self.results = {
+ <!labels!> = {},
+}
+self[self.results.<?labels?>] = lbl
+]]
+
+TEST [[
local mt = {}
function mt:<!x!>()
end
diff --git a/server-beta/test/definition/init.lua b/server-beta/test/definition/init.lua
index 2654e7b2..cc8c584b 100644
--- a/server-beta/test/definition/init.lua
+++ b/server-beta/test/definition/init.lua
@@ -62,4 +62,4 @@ require 'definition.table'
require 'definition.method'
require 'definition.label'
require 'definition.bug'
-require 'definition.emmy'
+--require 'definition.emmy'