Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
class -> local/global -> .value
  • Loading branch information
sumneko committed Apr 14, 2022
1 parent bf334a7 commit cf3d510
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions script/vm/compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ function vm.getClassFields(suri, node, key, pushResult)
pushResult(field)
end
end)
if src.value and src.value.type == 'table' then
searchFieldSwitch('table', suri, src.value, key, function (field)
local fieldKey = guide.getKeyName(field)
if not searchedFields[fieldKey]
and guide.isSet(field) then
hasFounded[fieldKey] = true
pushResult(field)
end
end)
end
end
end
-- look into extends(if field not found)
Expand Down
22 changes: 22 additions & 0 deletions test/definition/luadoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -859,3 +859,25 @@ end
<?t?>
]]

TEST [[
---@class A
local t = {
<!x!> = nil,
}
---@type A
local f
f.<?x?>
]]

TEST [[
---@class A
G = {
<!x!> = nil,
}
---@type A
local f
f.<?x?>
]]

0 comments on commit cf3d510

Please sign in to comment.