summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/locale/en-US/script.lni1
-rw-r--r--server/locale/zh-CN/script.lni1
-rw-r--r--server/src/emmy/manager.lua2
-rw-r--r--server/src/parser/ast.lua16
-rw-r--r--server/test/build_package.lua2
-rw-r--r--server/test/full/normal.lua4
6 files changed, 21 insertions, 5 deletions
diff --git a/server/locale/en-US/script.lni b/server/locale/en-US/script.lni
index 39256be4..ca6c3120 100644
--- a/server/locale/en-US/script.lni
+++ b/server/locale/en-US/script.lni
@@ -61,6 +61,7 @@ PARSER_UNSUPPORT_SYMBOL = '{version} does not support this grammar.'
PARSER_UNEXPECT_DOTS = 'Cannot use `...` outside a vararg function.'
PARSER_UNKNOWN_TAG = 'Unknown tag.'
PARSER_MULTI_TAG = 'Dose not support multi tags.'
+PARSER_UNEXPECT_LFUNC_NAME = 'Local function can only use identifiers as name.'
SYMBOL_ANONYMOUS = '<Anonymous>'
diff --git a/server/locale/zh-CN/script.lni b/server/locale/zh-CN/script.lni
index e1f775ef..ed15ddf0 100644
--- a/server/locale/zh-CN/script.lni
+++ b/server/locale/zh-CN/script.lni
@@ -61,6 +61,7 @@ PARSER_UNSUPPORT_SYMBOL = '{version} 不支持该符号。'
PARSER_UNEXPECT_DOTS = '`...`只能在不定参函数中使用。'
PARSER_UNKNOWN_TAG = '不支持的标签。'
PARSER_MULTI_TAG = '只能设置一个标签。'
+PARSER_UNEXPECT_LFUNC_NAME = '局部函数只能使用标识符作为名称。'
SYMBOL_ANONYMOUS = '<匿名函数>'
diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua
index 658fb56b..9b6978b9 100644
--- a/server/src/emmy/manager.lua
+++ b/server/src/emmy/manager.lua
@@ -147,7 +147,7 @@ function mt:addParam(source, bind)
paramObj:bindGeneric(bind)
else
paramObj:bindType(bind)
- self:eachClass(bind:getName(), function (class)
+ self:eachClass(bind:getType(), function (class)
if class.type == 'emmy.alias' then
class:eachEnum(function (enum)
paramObj:addEnum(enum)
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index f2486fd6..e307f8b8 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -2,6 +2,7 @@ local tonumber = tonumber
local string_char = string.char
local utf8_char = utf8.char
local type = type
+local table = table
local Errs
local State
@@ -625,6 +626,15 @@ local Defs = {
if obj.argFinish > obj.finish then
obj.argFinish = obj.finish
end
+
+ if name.type ~= 'name' then
+ pushError {
+ type = 'UNEXPECT_LFUNC_NAME',
+ start = name.start,
+ finish = name.finish,
+ }
+ end
+
return obj
end,
Table = function (start, ...)
@@ -696,10 +706,10 @@ local Defs = {
local last = list[#list]
list.finish = last.finish
return list
- elseif first == '' then
- return nil
- else
+ elseif type(first) == 'table' then
return first
+ else
+ return nil
end
end,
ArgList = function (...)
diff --git a/server/test/build_package.lua b/server/test/build_package.lua
index 9c6b6859..9006e2c5 100644
--- a/server/test/build_package.lua
+++ b/server/test/build_package.lua
@@ -1,7 +1,7 @@
local json = require 'json'
local diagDefault = require 'constant.DiagnosticDefaultSeverity'
-local VERSION = "0.10.2"
+local VERSION = "0.10.3"
local package = {
name = "lua",
diff --git a/server/test/full/normal.lua b/server/test/full/normal.lua
index 3de45c51..facc0139 100644
--- a/server/test/full/normal.lua
+++ b/server/test/full/normal.lua
@@ -146,3 +146,7 @@ TEST [[
function scene:selectByCylinder(center, radius, height)
end
]]
+
+TEST [[
+local x = ,
+]]