diff options
Diffstat (limited to 'server-beta/src/core')
-rw-r--r-- | server-beta/src/core/field.lua | 8 | ||||
-rw-r--r-- | server-beta/src/core/getindex.lua | 2 | ||||
-rw-r--r-- | server-beta/src/core/method.lua | 7 | ||||
-rw-r--r-- | server-beta/src/core/setfield.lua | 30 | ||||
-rw-r--r-- | server-beta/src/core/setindex.lua | 22 | ||||
-rw-r--r-- | server-beta/src/core/setmethod.lua | 26 | ||||
-rw-r--r-- | server-beta/src/core/tablefield.lua | 6 |
7 files changed, 58 insertions, 43 deletions
diff --git a/server-beta/src/core/field.lua b/server-beta/src/core/field.lua index e1e67c08..12c13632 100644 --- a/server-beta/src/core/field.lua +++ b/server-beta/src/core/field.lua @@ -28,13 +28,7 @@ function m:field(source, key, callback) end function m:value(source, callback) - local parent = source.parent - if parent.type == 'setfield' - or parent.type == 'tablefield' then - if parent.value then - self:eachValue(parent.value, callback) - end - end + self:eachValue(source.parent, callback) end return m diff --git a/server-beta/src/core/getindex.lua b/server-beta/src/core/getindex.lua index 0c0913dc..c0b3e517 100644 --- a/server-beta/src/core/getindex.lua +++ b/server-beta/src/core/getindex.lua @@ -13,7 +13,7 @@ function m:field(source, key, callback) local myKey = guide.getKeyName(source) if key == myKey then - callback(source, 'set') + callback(source, 'get') end self:eachField(node, myKey, function (src, mode) diff --git a/server-beta/src/core/method.lua b/server-beta/src/core/method.lua index c8ea61e1..a5005587 100644 --- a/server-beta/src/core/method.lua +++ b/server-beta/src/core/method.lua @@ -27,12 +27,7 @@ function m:field(source, key, callback) end function m:value(source, callback) - local parent = source.parent - if parent.type == 'setmethod' then - if parent.value then - self:eachValue(parent.value, callback) - end - end + self:eachValue(source.parent, callback) end return m diff --git a/server-beta/src/core/setfield.lua b/server-beta/src/core/setfield.lua index 3736663b..6f629d55 100644 --- a/server-beta/src/core/setfield.lua +++ b/server-beta/src/core/setfield.lua @@ -9,22 +9,26 @@ function m:field(source, key, callback) used[source] = true local node = source.node - used[node] = true + self:eachDef(node, function (src) + used[src] = true + end) local myKey = guide.getKeyName(source) if key == myKey then callback(source, 'set') end - self:eachField(node, key, function (src, mode) - if used[src] then - return - end - used[src] = true - if mode == 'set' then - callback(src, mode) - found = true - end + self:eachField(node, myKey, function (src, mode) + self:eachField(src, key, function (src, mode) + if used[src] then + return + end + used[src] = true + if mode == 'set' then + callback(src, mode) + found = true + end + end) end) self:eachValue(node, function (src) @@ -43,4 +47,10 @@ function m:field(source, key, callback) checkSMT(self, key, used, found, callback) end +function m:value(source, callback) + if source.value then + self:eachValue(source.value, callback) + end +end + return m diff --git a/server-beta/src/core/setindex.lua b/server-beta/src/core/setindex.lua index 60813166..0c0913dc 100644 --- a/server-beta/src/core/setindex.lua +++ b/server-beta/src/core/setindex.lua @@ -13,18 +13,20 @@ function m:field(source, key, callback) local myKey = guide.getKeyName(source) if key == myKey then - callback(source, 'get') + callback(source, 'set') end - self:eachField(node, key, function (src, mode) - if used[src] then - return - end - used[src] = true - if mode == 'set' then - callback(src, mode) - found = true - end + self:eachField(node, myKey, function (src, mode) + self:eachField(src, key, function (src, mode) + if used[src] then + return + end + used[src] = true + if mode == 'set' then + callback(src, mode) + found = true + end + end) end) self:eachValue(node, function (src) diff --git a/server-beta/src/core/setmethod.lua b/server-beta/src/core/setmethod.lua index 3736663b..881b5083 100644 --- a/server-beta/src/core/setmethod.lua +++ b/server-beta/src/core/setmethod.lua @@ -16,15 +16,17 @@ function m:field(source, key, callback) callback(source, 'set') end - self:eachField(node, key, function (src, mode) - if used[src] then - return - end - used[src] = true - if mode == 'set' then - callback(src, mode) - found = true - end + self:eachField(node, myKey, function (src, mode) + self:eachField(src, key, function (src, mode) + if used[src] then + return + end + used[src] = true + if mode == 'set' then + callback(src, mode) + found = true + end + end) end) self:eachValue(node, function (src) @@ -43,4 +45,10 @@ function m:field(source, key, callback) checkSMT(self, key, used, found, callback) end +function m:value(source, callback) + if source.value then + self:eachValue(source.value, callback) + end +end + return m diff --git a/server-beta/src/core/tablefield.lua b/server-beta/src/core/tablefield.lua index a5447e3f..cfc6bace 100644 --- a/server-beta/src/core/tablefield.lua +++ b/server-beta/src/core/tablefield.lua @@ -6,4 +6,10 @@ function m:field(source, key, callback) end end +function m:value(source, callback) + if source.value then + self:eachValue(source.value, callback) + end +end + return m |