From df4fb9b5157cbf11f3fc5f6041afef657f0acfba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 28 Jun 2022 16:28:33 +0800 Subject: diag `missing-return` --- script/vm/compiler.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'script/vm/compiler.lua') diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index b2cdb1be..f42a4768 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -492,6 +492,7 @@ function vm.getReturnOfFunction(func, index) end return vm.createGeneric(rtn, sign) end + return nil end ---@return vm.node @@ -976,7 +977,6 @@ local function compileForVars(source) end ---@param source parser.object ----@return vm.node local function compileLocal(source) vm.setNode(source, source) @@ -1077,7 +1077,7 @@ local binarySwich = util.switch() : call(function (source) local node1 = vm.compileNode(source[1]) local node2 = vm.compileNode(source[2]) - local r1 = vm.test(source[1]) + local r1 = vm.testCondition(source[1]) if r1 == true then vm.setNode(source, node2) elseif r1 == false then @@ -1090,7 +1090,7 @@ local binarySwich = util.switch() : call(function (source) local node1 = vm.compileNode(source[1]) local node2 = vm.compileNode(source[2]) - local r1 = vm.test(source[1]) + local r1 = vm.testCondition(source[1]) if r1 == true then vm.setNode(source, node1) elseif r1 == false then @@ -1784,7 +1784,7 @@ local compilerSwitch = util.switch() return end if source.op.type == 'not' then - local result = vm.test(source[1]) + local result = vm.testCondition(source[1]) if result == nil then vm.setNode(source, vm.declareGlobal('type', 'boolean')) return -- cgit v1.2.3