From 79b514e6230a2104607a0091526e8c86d37f9570 Mon Sep 17 00:00:00 2001 From: lalawue Date: Sun, 30 Jul 2023 01:00:50 +0800 Subject: [PATCH] unused local variable detection ignore "Self", "Super", "__st" --- .../langserver/check/analysis/analysis_check_loc_var.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luahelper-lsp/langserver/check/analysis/analysis_check_loc_var.go b/luahelper-lsp/langserver/check/analysis/analysis_check_loc_var.go index d763031..f94804f 100644 --- a/luahelper-lsp/langserver/check/analysis/analysis_check_loc_var.go +++ b/luahelper-lsp/langserver/check/analysis/analysis_check_loc_var.go @@ -26,8 +26,8 @@ func (a *Analysis) checkLocVarCall() { // 扫描当前scope,判断哪些局部变量定义了未使用 for varName, varInfoList := range scope.LocVarMap { - // _ 局部变量忽略, _G也忽略 - if varName == "_" || varName == "_G" { + // _ 局部变量忽略, _G也忽略,moocscript 独有的 Self、Super、__st 也忽略 + if varName == "_" || varName == "_G" || varName == "Self" || varName == "Super" || varName == "__st" { continue }