summaryrefslogtreecommitdiff
path: root/script/core/hover
diff options
context:
space:
mode:
Diffstat (limited to 'script/core/hover')
-rw-r--r--script/core/hover/args.lua (renamed from script/core/hover/arg.lua)24
-rw-r--r--script/core/hover/label.lua6
2 files changed, 11 insertions, 19 deletions
diff --git a/script/core/hover/arg.lua b/script/core/hover/args.lua
index 7611a895..900a7496 100644
--- a/script/core/hover/arg.lua
+++ b/script/core/hover/args.lua
@@ -13,7 +13,7 @@ local function optionalArg(arg)
end
end
-local function asFunction(source, oop)
+local function asFunction(source)
local args = {}
local methodDef
local parent = source.parent
@@ -47,14 +47,10 @@ local function asFunction(source, oop)
::CONTINUE::
end
end
- if oop then
- return table.concat(args, ', ', 2)
- else
- return table.concat(args, ', ')
- end
+ return args
end
-local function asDocFunction(source, oop)
+local function asDocFunction(source)
if not source.args then
return ''
end
@@ -68,19 +64,15 @@ local function asDocFunction(source, oop)
arg.extends and infer.getInfer(arg.extends):view 'any' or 'any'
)
end
- if oop then
- return table.concat(args, ', ', 2)
- else
- return table.concat(args, ', ')
- end
+ return args
end
-return function (source, oop)
+return function (source)
if source.type == 'function' then
- return asFunction(source, oop)
+ return asFunction(source)
end
if source.type == 'doc.type.function' then
- return asDocFunction(source, oop)
+ return asDocFunction(source)
end
- return ''
+ return {}
end
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua
index c037b3f5..7f9f29a4 100644
--- a/script/core/hover/label.lua
+++ b/script/core/hover/label.lua
@@ -1,5 +1,5 @@
local buildName = require 'core.hover.name'
-local buildArg = require 'core.hover.arg'
+local buildArgs = require 'core.hover.args'
local buildReturn = require 'core.hover.return'
local buildTable = require 'core.hover.table'
local infer = require 'vm.infer'
@@ -12,7 +12,7 @@ local guide = require 'parser.guide'
local function asFunction(source, oop)
local name = buildName(source, oop)
- local arg = buildArg(source, oop)
+ local args = buildArgs(source)
local rtn = buildReturn(source)
local lines = {}
@@ -20,7 +20,7 @@ local function asFunction(source, oop)
, vm.isAsync(source) and 'async ' or ''
, oop and 'method' or 'function'
, name or ''
- , arg
+ , oop and table.concat(args, ', ', 2) or table.concat(args, ', ')
)
lines[2] = rtn