summaryrefslogtreecommitdiff
path: root/server-beta/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-30 17:07:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-30 17:07:36 +0800
commit4e01c062182d333ea7d7007c2f44d036993d9c0f (patch)
tree704ff507105783ea76f840e938cd0955c6833c99 /server-beta/src
parent8397d997279ed8087dde359cf4bfd14a4aaaa46d (diff)
downloadlua-language-server-4e01c062182d333ea7d7007c2f44d036993d9c0f.zip
支持method
Diffstat (limited to 'server-beta/src')
-rw-r--r--server-beta/src/core/engineer.lua9
-rw-r--r--server-beta/src/parser/ast.lua5
-rw-r--r--server-beta/src/parser/compile.lua1
3 files changed, 11 insertions, 4 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua
index c5ed636c..6baa0d20 100644
--- a/server-beta/src/core/engineer.lua
+++ b/server-beta/src/core/engineer.lua
@@ -14,7 +14,9 @@ mt.type = 'engineer'
mt['local'] = function (self, source, mode, callback)
if mode == 'def' then
- callback(source, 'local')
+ if source.tag ~= 'self' then
+ callback(source, 'local')
+ end
if source.ref then
for _, ref in ipairs(source.ref) do
if ref.type == 'setlocal' then
@@ -22,6 +24,11 @@ mt['local'] = function (self, source, mode, callback)
end
end
end
+ if source.tag == 'self' then
+ local method = source.method
+ local node = method.node
+ self:search(node, node.type, mode, callback)
+ end
end
end
mt['getlocal'] = function (self, source, mode, callback)
diff --git a/server-beta/src/parser/ast.lua b/server-beta/src/parser/ast.lua
index c9ae7078..47a8d4d1 100644
--- a/server-beta/src/parser/ast.lua
+++ b/server-beta/src/parser/ast.lua
@@ -824,16 +824,15 @@ local Defs = {
if name.type == 'getname' then
name.type = 'setname'
name.value = actions
- return name
elseif name.type == 'getfield' then
name.type = 'setfield'
name.value = actions
- return name
elseif name.type == 'getmethod' then
name.type = 'setmethod'
name.value = actions
- return name
end
+ name.range = actions.finish
+ return name
end,
LocalFunction = function (start, name, args, actions, finish)
actions.type = 'function'
diff --git a/server-beta/src/parser/compile.lua b/server-beta/src/parser/compile.lua
index ead4b882..2bcb7e46 100644
--- a/server-beta/src/parser/compile.lua
+++ b/server-beta/src/parser/compile.lua
@@ -89,6 +89,7 @@ local vmMap = {
finish = 0,
method = obj,
effect = obj.finish,
+ tag = 'self',
[1] = 'self',
}
Compile(value, obj)