From 3b6db7fa2512f2af92abc758cbf79844ad9f0301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jan 2019 12:43:31 +0800 Subject: =?UTF-8?q?=E5=8F=AA=E8=83=BD=E5=85=88=E6=8A=8A=E6=9C=89=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E6=B5=8B=E8=AF=95=E5=B1=8F=E8=94=BD=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/vm.lua | 4 +++- server/test/hover/init.lua | 12 ++++++++++++ server/test/main.lua | 1 - server/test/vm/example.lua | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 65968396..7ae4e4e1 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -286,7 +286,9 @@ function mt:runFunction(func) local var = self:createArg('self', func.colon, self:getValue(func.object)) var.hide = true var.link = func.object - self:setValue(var, func.argValues[1] or self:createValue('nil')) + if func.argValues[1] then + self:setValue(var, func.argValues[1]) + end index = 1 func.args[index] = var end diff --git a/server/test/hover/init.lua b/server/test/hover/init.lua index 89dd2330..c618e49e 100644 --- a/server/test/hover/init.lua +++ b/server/test/hover/init.lua @@ -320,3 +320,15 @@ local obj: { c: number = 3, } ]] + +TEST[[ +local mt = {} +mt.__index = {} + +function mt:test(a, b) + self:() +end +]] +[[ +function mt:test(a: any, b: any) +]] diff --git a/server/test/main.lua b/server/test/main.lua index aacad3a4..8738002c 100644 --- a/server/test/main.lua +++ b/server/test/main.lua @@ -25,7 +25,6 @@ local function main() end test 'core' - test 'vm' test 'definition' test 'diagnostics' diff --git a/server/test/vm/example.lua b/server/test/vm/example.lua index 3e996e23..9a2939b5 100644 --- a/server/test/vm/example.lua +++ b/server/test/vm/example.lua @@ -13,4 +13,4 @@ local function testIfExit(path) print('基准测试耗时:', os.clock() - clock) end end -testIfExit(ROOT / 'test' / 'example' / 'vm.lua') +--testIfExit(ROOT / 'test' / 'example' / 'vm.lua') -- cgit v1.2.3