fix: better weak handling

This commit is contained in:
Folke Lemaitre 2023-05-22 14:31:23 +02:00
parent cd3802a54b
commit af39d61d3f
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 6 additions and 1 deletions

View File

@ -141,9 +141,14 @@ function Spec:warn(msg)
end end
function Spec:fix_disabled() function Spec:fix_disabled()
---@param plugin LazyPlugin
local function all_weak(plugin)
return (not plugin) or (rawget(plugin, "weak") and all_weak(plugin._.super))
end
-- handle weak plugins -- handle weak plugins
for _, plugin in pairs(self.plugins) do for _, plugin in pairs(self.plugins) do
if plugin.weak and not plugin._.super then if plugin.weak and all_weak(plugin) then
self.plugins[plugin.name] = nil self.plugins[plugin.name] = nil
end end
end end