summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/hover/function.lua4
-rw-r--r--server/src/emmy/manager.lua4
-rw-r--r--server/src/emmy/return.lua3
-rw-r--r--server/src/parser/ast.lua3
-rw-r--r--server/src/parser/grammar.lua4
-rw-r--r--server/src/vm/emmy.lua3
6 files changed, 13 insertions, 8 deletions
diff --git a/server/src/core/hover/function.lua b/server/src/core/hover/function.lua
index 6f8f325c..25849d69 100644
--- a/server/src/core/hover/function.lua
+++ b/server/src/core/hover/function.lua
@@ -128,7 +128,9 @@ local function buildValueReturns(func)
if i > 1 then
strs[#strs+1] = ', '
end
- if option and option.name then
+ if emmy and emmy.name then
+ strs[#strs+1] = ('%s: '):format(emmy.name)
+ elseif option and option.name then
strs[#strs+1] = ('%s: '):format(option.name)
end
strs[#strs+1] = rtn:getType()
diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua
index d7edbadb..c80e05df 100644
--- a/server/src/emmy/manager.lua
+++ b/server/src/emmy/manager.lua
@@ -160,8 +160,8 @@ function mt:addParam(source, bind)
return paramObj
end
-function mt:addReturn(source, bind)
- local returnObj = newReturn(self, source)
+function mt:addReturn(source, bind, name)
+ local returnObj = newReturn(self, source, name)
if bind then
if bind.type == 'emmy.generic' then
returnObj:bindGeneric(bind)
diff --git a/server/src/emmy/return.lua b/server/src/emmy/return.lua
index a23f3ac9..1fc97923 100644
--- a/server/src/emmy/return.lua
+++ b/server/src/emmy/return.lua
@@ -25,9 +25,10 @@ function mt:bindGeneric(generic)
end
end
-return function (manager, source)
+return function (manager, source, name)
local self = setmetatable({
source = source.id,
+ name = name and name[1],
option = source.option,
_manager = manager,
}, mt)
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 8ac4e0f4..92d14eb6 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -1394,13 +1394,14 @@ local Defs = {
emmy.finish = emmy[#emmy].finish
return emmy
end,
- EmmyReturn = function (start, type, finish, option)
+ EmmyReturn = function (start, type, name, finish, option)
local emmy = {
type = 'emmyReturn',
option = option,
start = start,
finish = finish - 1,
[1] = type,
+ [2] = name,
}
return emmy
end,
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 37f3c483..6a98284d 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -570,8 +570,8 @@ EmmyParam <- MustEmmyName %s* EmmyType %s* EmmyOption %s* EmmyTypeEnum*
EmmyOption <- Table?
-> EmmyOption
-EmmyReturn <- {} %nil {} Table -> EmmyOption
- / {} EmmyType {} EmmyOption
+EmmyReturn <- {} %nil %nil {} Table -> EmmyOption
+ / {} EmmyType (%s* EmmyName/%nil) {} EmmyOption
EmmyField <- (EmmyFieldAccess MustEmmyName %s* EmmyType)
EmmyFieldAccess <- ({'public'} Cut %s*)
diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua
index b193a7de..9342a851 100644
--- a/server/src/vm/emmy.lua
+++ b/server/src/vm/emmy.lua
@@ -197,7 +197,8 @@ function mt:doEmmyReturn(action)
local emmyMgr = self.emmyMgr
self:instantSource(action)
local type = action[1] and (self:getGenericByType(action[1]) or self:buildEmmyAnyType(action[1]))
- local rtn = emmyMgr:addReturn(action, type)
+ local name = action[2]
+ local rtn = emmyMgr:addReturn(action, type, name)
action:set('emmy.return', rtn)
self:addEmmyReturn(rtn)
if self.lsp then