summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua3
-rw-r--r--script/core/diagnostics/redundant-parameter.lua9
-rw-r--r--script/core/guide.lua14
-rw-r--r--script/core/hover/init.lua6
-rw-r--r--script/parser/ast.lua14
5 files changed, 14 insertions, 32 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 60dbea7c..fb7d2122 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -1282,9 +1282,6 @@ local function getFuncParamByCallIndex(func, index)
if not func.args or #func.args == 0 then
return nil
end
- if func.parent.type == 'setmethod' then
- return func.args[index - 1]
- end
if index > #func.args then
if func.args[#func.args].type == '...' then
return func.args[#func.args]
diff --git a/script/core/diagnostics/redundant-parameter.lua b/script/core/diagnostics/redundant-parameter.lua
index fc446f7c..6eb04f26 100644
--- a/script/core/diagnostics/redundant-parameter.lua
+++ b/script/core/diagnostics/redundant-parameter.lua
@@ -10,18 +10,12 @@ local function countCallArgs(source)
if not source.args then
return 0
end
- if source.node and source.node.type == 'getmethod' then
- result = result + 1
- end
result = result + #source.args
return result
end
local function countFuncArgs(source)
local result = 0
- if source.parent and source.parent.type == 'setmethod' then
- result = result + 1
- end
if not source.args or #source.args == 0 then
return result
end
@@ -34,9 +28,6 @@ end
local function countOverLoadArgs(source, doc)
local result = 0
- if source.parent and source.parent.type == 'setmethod' then
- result = result + 1
- end
local func = doc.overload
if not func.args or #func.args == 0 then
return result
diff --git a/script/core/guide.lua b/script/core/guide.lua
index e23fbf0e..b2f13a80 100644
--- a/script/core/guide.lua
+++ b/script/core/guide.lua
@@ -1399,10 +1399,6 @@ function m.getCallAndArgIndex(callarg)
end
end
local call = callargs.parent
- local node = call.node
- if node.type == 'getmethod' then
- index = index + 1
- end
return call, index
end
@@ -1429,16 +1425,6 @@ function m.getCallValue(source)
or call.node.special == 'xpcall' then
return call.args and call.args[1], call.args, index - 1
end
- if call.node.type == 'getmethod' then
- local args = {}
- args[1] = call.node.node
- if call.args then
- for _, arg in ipairs(call.args) do
- args[#args+1] = arg
- end
- end
- return call.node, args, index
- end
return call.node, call.args, index
end
diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua
index 9c08ad7e..81285ef2 100644
--- a/script/core/hover/init.lua
+++ b/script/core/hover/init.lua
@@ -21,9 +21,6 @@ local function eachFunctionAndOverload(value, callback)
end
local function getHoverAsValue(source)
- local oop = source.type == 'method'
- or source.type == 'getmethod'
- or source.type == 'setmethod'
local label = getLabel(source)
local desc = getDesc(source)
if not desc then
@@ -49,9 +46,6 @@ local function getHoverAsFunction(source)
local defs = 0
local protos = 0
local other = 0
- local oop = source.type == 'method'
- or source.type == 'getmethod'
- or source.type == 'setmethod'
local mark = {}
for _, def in ipairs(values) do
def = guide.getObjectValue(def) or def
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 45801cf6..9acdb06b 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -6,6 +6,7 @@ local mathType = math.type
local tableRemove = table.remove
local pairs = pairs
local tableSort = table.sort
+local tableInsert = table.insert
_ENV = nil
@@ -701,6 +702,14 @@ local Defs = {
finish = call.finish,
}
end
+ if call.type == 'call'
+ and call.node
+ and call.node.type == 'getmethod' then
+ if not call.args then
+ call.args = {}
+ end
+ tableInsert(call.args, 1, call.node)
+ end
return call
end,
BinaryOp = function (start, op)
@@ -1017,6 +1026,11 @@ local Defs = {
elseif name.type == 'getmethod' then
name.type = 'setmethod'
name.value = actions
+ if not args then
+ args = {}
+ actions.args = args
+ end
+ tableInsert(args, 1, name.node)
elseif name.type == 'getindex' then
name.type = 'setfield'
name.value = actions