Commit d5d5baee authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

support for configuration-dependent default rules

parent ad5655a4
......@@ -33,7 +33,7 @@ function loadmodules(path)
end
for phase, rules in pairs(mod.defrules) do
if not defrules[phase] then defrules[phase] = {} end
util.extend(defrules[phase], rules)
table.insert(defrules[phase], rules)
end
end
......@@ -87,7 +87,11 @@ function Config:init(policyconfig)
end
local function insertdefrules(phase)
if defrules[phase] then insertrules(defrules[phase]) end
for i, rulegroup in ipairs(defrules[phase] or {}) do
if type(rulegroup) == 'function' then
insertrules(rulegroup(self.input))
else insertrules(rulegroup) end
end
end
for i, path in ipairs(procorder) do morph(path, classmap[path]) end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment