summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-07-19 17:09:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-07-19 17:09:56 +0800
commit682614e0004472d485b834e3608bfa9c62a6fee6 (patch)
tree3d63e88ccacf237ddc6291de008c910c8842f58c /script/vm
parent2431b557a125a609bdd8ccbf9e072b8cba4661e6 (diff)
downloadlua-language-server-682614e0004472d485b834e3608bfa9c62a6fee6.zip
check visible recursive
fix #2145
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/visible.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/script/vm/visible.lua b/script/vm/visible.lua
index e550280f..d4c1c710 100644
--- a/script/vm/visible.lua
+++ b/script/vm/visible.lua
@@ -7,9 +7,7 @@ local glob = require 'glob'
---@class parser.object
---@field package _visibleType? parser.visibleType
----@param source parser.object
----@return parser.visibleType
-function vm.getVisibleType(source)
+local function getVisibleType(source)
if source._visibleType then
return source._visibleType
end
@@ -56,6 +54,23 @@ function vm.getVisibleType(source)
end
---@param source parser.object
+---@return parser.visibleType
+function vm.getVisibleType(source)
+ if source._visibleType then
+ return source._visibleType
+ end
+ for _, def in ipairs(vm.getDefs(source)) do
+ local visible = getVisibleType(def)
+ if visible ~= 'public' then
+ source._visibleType = visible
+ return visible
+ end
+ end
+ source._visibleType = 'public'
+ return 'public'
+end
+
+---@param source parser.object
---@return vm.global?
function vm.getParentClass(source)
if source.type == 'doc.field' then