Skip to content

Commit 798eb5c

Browse files
committed
fix visible
1 parent 8b68139 commit 798eb5c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

script/parser/compile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3937,7 +3937,7 @@ local function initState(lua, version, options)
39373937
else
39383938
state.ENVMode = '_ENV'
39393939
end
3940-
3940+
39413941
pushError = function (err)
39423942
local errs = state.errs
39433943
if err.finish < err.start then

script/vm/visible.lua

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ local glob = require 'glob'
88
---@field package _visibleType? parser.visibleType
99

1010
local function getVisibleType(source)
11+
if guide.isLiteral(source) then
12+
return 'public'
13+
end
1114
if source._visibleType then
1215
return source._visibleType
1316
end
@@ -53,20 +56,24 @@ local function getVisibleType(source)
5356
return 'public'
5457
end
5558

59+
---@class vm.node
60+
---@field package _visibleType parser.visibleType
61+
5662
---@param source parser.object
5763
---@return parser.visibleType
5864
function vm.getVisibleType(source)
59-
if source._visibleType then
60-
return source._visibleType
65+
local node = vm.compileNode(source)
66+
if node._visibleType then
67+
return node._visibleType
6168
end
6269
for _, def in ipairs(vm.getDefs(source)) do
6370
local visible = getVisibleType(def)
6471
if visible ~= 'public' then
65-
source._visibleType = visible
72+
node._visibleType = visible
6673
return visible
6774
end
6875
end
69-
source._visibleType = 'public'
76+
node._visibleType = 'public'
7077
return 'public'
7178
end
7279

0 commit comments

Comments
 (0)