summaryrefslogtreecommitdiff
path: root/server-beta/src/searcher-old/field.lua
blob: c5667b04dceee5544a617418c1b7e227ea016a05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local guide    = require 'parser.guide'
local checkSMT = require 'searcher.setmetatable'

local m = {}

function m:eachDef(source, callback)
    local parent = source.parent
    local key = guide.getKeyName(source)
    self:eachField(parent, key, function (info)
        if info.mode == 'set' then
            callback(info)
        end
    end)
end

function m:eachRef(source, callback)
    local parent = source.parent
    local key = guide.getKeyName(source)
    self:eachField(parent, key, function (info)
        if info.mode == 'set' or info.mode == 'set' then
            callback(info)
        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

function m:getValue(source)
    return self:getValue(source.parent)
end

return m