diff options
Diffstat (limited to 'server-beta/src/core/getglobal.lua')
-rw-r--r-- | server-beta/src/core/getglobal.lua | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/server-beta/src/core/getglobal.lua b/server-beta/src/core/getglobal.lua index 4b4f4a10..a8bcb04c 100644 --- a/server-beta/src/core/getglobal.lua +++ b/server-beta/src/core/getglobal.lua @@ -66,45 +66,50 @@ function m:field(source, key, callback) local found = false used[source] = true - local node = source.node - local myKey = guide.getKeyName(node) - - if myKey == key then - callback(source) - end - - self:eachDef(node, function (src) - if myKey ~= key then - return - end + self:eachRef(source, function (src) used[src] = true - if node.type == 'setfield' - or node.type == 'setindex' - or node.type == 'setmethod' then - callback(src, 'set') - elseif node.type == 'getfield' - or node.type == 'getindex' - or node.type == 'getmethod' then - callback(src, 'get') - end - end) - self:eachValue(node, function (src) - self:eachField(src, key, function (src, mode) - if used[src] then - return + if src.type == 'getfield' then + if guide.getKeyName(src.field) == key then + callback(src.field, 'get') + end + elseif src.type == 'setfield' then + if guide.getKeyName(src.field) == key then + callback(src.field, 'set') end - used[src] = true - if mode == 'set' then - callback(src, mode) - found = true + elseif src.type == 'getmethod' then + if guide.getKeyName(src.method) == key then + callback(src.method, 'get') end - end) + elseif src.type == 'setmethod' then + if guide.getKeyName(src.method) == key then + callback(src.method, 'set') + end + elseif src.type == 'getindex' then + if guide.getKeyName(src.index) == key then + callback(src.index, 'get') + end + elseif src.type == 'setindex' then + if guide.getKeyName(src.index) == key then + callback(src.index, 'set') + end + elseif src.type == 'getglobal' then + if guide.getKeyName(src.parent) == key then + callback(src.parent, 'get') + end + elseif src.type == 'setglobal' then + --if guide.getKeyName(src.parent) == key then + -- callback(src.parent, 'set') + --end + else + self:eachField(src, key, callback) + end end) checkSMT(self, key, used, found, callback) end function m:value(source, callback) + callback(source) if source.value then self:eachValue(source.value, callback) end |