From 08638eedb6cf74bd815e933f4a90e989a1516948 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 20:30:27 +0800 Subject: some fix --- script/core/diagnostics/param-type-mismatch.lua | 3 +++ script/core/diagnostics/unused-vararg.lua | 3 +++ 2 files changed, 6 insertions(+) (limited to 'script/core/diagnostics') diff --git a/script/core/diagnostics/param-type-mismatch.lua b/script/core/diagnostics/param-type-mismatch.lua index a4390b50..6f34f579 100644 --- a/script/core/diagnostics/param-type-mismatch.lua +++ b/script/core/diagnostics/param-type-mismatch.lua @@ -22,6 +22,9 @@ return function (uri, callback) local param = f.args and f.args[i] if param then defNode:merge(vm.compileNode(param)) + if param[1] == '...' then + defNode:addOptional() + end end end end diff --git a/script/core/diagnostics/unused-vararg.lua b/script/core/diagnostics/unused-vararg.lua index ce033cf3..08f12c4d 100644 --- a/script/core/diagnostics/unused-vararg.lua +++ b/script/core/diagnostics/unused-vararg.lua @@ -15,6 +15,9 @@ return function (uri, callback) end guide.eachSourceType(ast.ast, 'function', function (source) + if #source == 0 then + return + end local args = source.args if not args then return -- cgit v1.2.3