Skip to content

Commit cf3d510

Browse files
committed
class -> local/global -> .value
1 parent bf334a7 commit cf3d510

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

script/vm/compiler.lua

+10
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ function vm.getClassFields(suri, node, key, pushResult)
214214
pushResult(field)
215215
end
216216
end)
217+
if src.value and src.value.type == 'table' then
218+
searchFieldSwitch('table', suri, src.value, key, function (field)
219+
local fieldKey = guide.getKeyName(field)
220+
if not searchedFields[fieldKey]
221+
and guide.isSet(field) then
222+
hasFounded[fieldKey] = true
223+
pushResult(field)
224+
end
225+
end)
226+
end
217227
end
218228
end
219229
-- look into extends(if field not found)

test/definition/luadoc.lua

+22
Original file line numberDiff line numberDiff line change
@@ -859,3 +859,25 @@ end
859859
860860
<?t?>
861861
]]
862+
863+
TEST [[
864+
---@class A
865+
local t = {
866+
<!x!> = nil,
867+
}
868+
869+
---@type A
870+
local f
871+
f.<?x?>
872+
]]
873+
874+
TEST [[
875+
---@class A
876+
G = {
877+
<!x!> = nil,
878+
}
879+
880+
---@type A
881+
local f
882+
f.<?x?>
883+
]]

0 commit comments

Comments
 (0)