refactor(plugin): refactored rebuild

This commit is contained in:
Folke Lemaitre 2023-10-04 12:50:46 +02:00
parent d8453bc137
commit 82da5a0048
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 12 additions and 8 deletions

View File

@ -172,8 +172,14 @@ function Spec:warn(msg)
end
--- Rebuilds a plugin spec excluding any removed fragments
---@param name string
---@param name? string
function Spec:rebuild(name)
if not name then
for n, _ in pairs(self.dirty) do
self:rebuild(n)
end
self.dirty = {}
end
local plugin = self.plugins[name]
if not plugin then
return
@ -292,11 +298,11 @@ function Spec:fix_disabled()
end
self:fix_optional()
-- rebuild any plugin specs that were modified
for name, _ in pairs(self.dirty) do
self:rebuild(name)
end
self:rebuild()
self:fix_cond()
self:rebuild()
self.dirty = {}
for _, plugin in pairs(self.plugins) do
@ -311,9 +317,7 @@ function Spec:fix_disabled()
end
-- rebuild any plugin specs that were modified
for name, _ in pairs(self.dirty) do
self:rebuild(name)
end
self:rebuild()
end
---@param msg string