summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-07-20 15:06:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-07-20 15:06:28 +0800
commit798eb5cd94ea879900ca5096045ad72b44b4e1e4 (patch)
tree4e9abed04d90c07f40fda22d9f3512cd50888fb1 /script/vm
parent8b681399d4a5098fd1ec35e053f775df7cd67a5a (diff)
downloadlua-language-server-798eb5cd94ea879900ca5096045ad72b44b4e1e4.zip
fix visible
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/visible.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/script/vm/visible.lua b/script/vm/visible.lua
index d4c1c710..d13ecf1f 100644
--- a/script/vm/visible.lua
+++ b/script/vm/visible.lua
@@ -8,6 +8,9 @@ local glob = require 'glob'
---@field package _visibleType? parser.visibleType
local function getVisibleType(source)
+ if guide.isLiteral(source) then
+ return 'public'
+ end
if source._visibleType then
return source._visibleType
end
@@ -53,20 +56,24 @@ local function getVisibleType(source)
return 'public'
end
+---@class vm.node
+---@field package _visibleType parser.visibleType
+
---@param source parser.object
---@return parser.visibleType
function vm.getVisibleType(source)
- if source._visibleType then
- return source._visibleType
+ local node = vm.compileNode(source)
+ if node._visibleType then
+ return node._visibleType
end
for _, def in ipairs(vm.getDefs(source)) do
local visible = getVisibleType(def)
if visible ~= 'public' then
- source._visibleType = visible
+ node._visibleType = visible
return visible
end
end
- source._visibleType = 'public'
+ node._visibleType = 'public'
return 'public'
end