From 682614e0004472d485b834e3608bfa9c62a6fee6 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, 19 Jul 2023 17:09:56 +0800 Subject: check visible recursive fix #2145 --- script/vm/visible.lua | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'script/vm') 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 @@ -55,6 +53,23 @@ function vm.getVisibleType(source) return 'public' 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) -- cgit v1.2.3