summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/document_symbol.lua2
-rw-r--r--server/src/core/value.lua23
-rw-r--r--server/src/core/vm.lua17
3 files changed, 19 insertions, 23 deletions
diff --git a/server/src/core/document_symbol.lua b/server/src/core/document_symbol.lua
index d8a4daaf..5c7e059b 100644
--- a/server/src/core/document_symbol.lua
+++ b/server/src/core/document_symbol.lua
@@ -38,7 +38,7 @@ local function buildFunction(vm, func)
local var
if declarat then
if declarat.type == 'function' then
- var = declarat.name.bind
+ var = declarat.name and declarat.name.bind
else
var = declarat.bind
end
diff --git a/server/src/core/value.lua b/server/src/core/value.lua
index adc92ddd..05248d0d 100644
--- a/server/src/core/value.lua
+++ b/server/src/core/value.lua
@@ -176,29 +176,28 @@ function mt:removeUri(uri)
end
function mt:getDeclarat()
- local declarat = self:eachInfo(function (info)
+ if not self._info then
+ return nil
+ end
+ local uri = self.uri or ''
+ local infos = self._info[uri]
+ if not infos then
+ return nil
+ end
+ for _, info in ipairs(infos) do
if info.type == 'local' then
return info.source
end
- end)
- if declarat then
- return declarat
end
- local declarat = self:eachInfo(function (info)
+ for _, info in ipairs(infos) do
if info.type == 'return' then
return info.source
end
- end)
- if declarat then
- return declarat
end
- local declarat = self:eachInfo(function (info)
+ for _, info in ipairs(infos) do
if info.type == 'set' then
return info.source
end
- end)
- if declarat then
- return declarat
end
return nil
end
diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua
index 42893dd2..c2ca89a0 100644
--- a/server/src/core/vm.lua
+++ b/server/src/core/vm.lua
@@ -1360,21 +1360,18 @@ end
function mt:doLocalFunction(action)
local name = action.name
- local var, object
- local source
if name then
if name.type == 'simple' then
- var, object = self:getSimple(name, 'field')
- source = name[#name]
+ local var, object = self:getSimple(name, 'field')
+ local func = self:buildFunction(action, object)
+ self:setValue(var, func, name[#name])
else
- var = self:createLocal(name[1], name)
- source = name
+ local loc = self:createLocal(name[1], name)
+ local func = self:buildFunction(action)
+ func:addInfo('local', name, loc)
+ self:setValue(loc, func, name[#name])
end
end
- local func = self:buildFunction(action, object)
- if var then
- self:setValue(var, func, source)
- end
end
function mt:doAction(action)