diff options
author | sumneko <sumneko@hotmail.com> | 2019-06-03 19:56:45 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-06-03 19:56:45 +0800 |
commit | dd1ffb990002769906a68ca7ac67e25d6eef2149 (patch) | |
tree | f523b039d038fc93fd3eabfbed97a97ff851cdea | |
parent | e938352367e8a44c280bbe156d4d7b9a3c21d882 (diff) | |
download | lua-language-server-dd1ffb990002769906a68ca7ac67e25d6eef2149.zip |
修正报错
-rw-r--r-- | server/src/vm/emmy.lua | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/server/src/vm/emmy.lua b/server/src/vm/emmy.lua index 91cab721..d41a3535 100644 --- a/server/src/vm/emmy.lua +++ b/server/src/vm/emmy.lua @@ -266,16 +266,16 @@ function mt:doEmmyTableType(action) return type end -function mt:doEmmyFunctionType(action) +function mt:buildEmmyFunctionType(source) ---@type emmyMgr local emmyMgr = self.emmyMgr - self:instantSource(action) - local funcObj = emmyMgr:addFunctionType(action) + self:instantSource(source) + local funcObj = emmyMgr:addFunctionType(source) ---@type emmyFunction - local func = functionMgr.create(action) - for i = 1, #action // 2 do - local nameSource = action[i*2-1] - local typeSource = action[i*2] + local func = functionMgr.create(source) + for i = 1, #source // 2 do + local nameSource = source[i*2-1] + local typeSource = source[i*2] local paramType = self:buildEmmyAnyType(typeSource) funcObj:addParam(nameSource[1], paramType) local value = self:createValue(paramType:getType(), typeSource) @@ -283,7 +283,7 @@ function mt:doEmmyFunctionType(action) self:instantSource(nameSource) func:addArg(nameSource[1], nameSource, value) end - local returnSource = action[#action] + local returnSource = source[#source] if returnSource then local returnType = self:buildEmmyAnyType(returnSource) funcObj:addReturn(returnType) @@ -296,6 +296,11 @@ function mt:doEmmyFunctionType(action) return funcObj end +function mt:doEmmyFunctionType(action) + local funcObj = self:buildEmmyFunctionType(action) + return funcObj +end + function mt:buildEmmyAnyType(source) if source.type == 'emmyType' then return self:buildEmmyType(source) |