diff options
Diffstat (limited to 'server-beta/src/seacher/method.lua')
-rw-r--r-- | server-beta/src/seacher/method.lua | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/server-beta/src/seacher/method.lua b/server-beta/src/seacher/method.lua new file mode 100644 index 00000000..52c00358 --- /dev/null +++ b/server-beta/src/seacher/method.lua @@ -0,0 +1,33 @@ +local guide = require 'parser.guide' + +local m = {} + +function m:eachDef(source, callback) + local node = source.parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' then + callback(src, mode) + end + end) +end + +function m:eachRef(source, callback) + local node = source.parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (src, mode) + if mode == 'set' or mode == 'get' then + callback(src, mode) + end + end) +end + +function m:eachField(source, key, callback) + self:eachField(source.parent, key, callback) +end + +function m:eachValue(source, callback) + self:eachValue(source.parent, callback) +end + +return m |