3
0
Fork 0
forked from mirrors/nixpkgs

lib.modules: Inline a private function

This should save about four calls per module.
This commit is contained in:
Robert Hensing 2022-03-01 10:45:46 +01:00
parent 28aeae2126
commit 2050669922

View file

@ -566,14 +566,14 @@ rec {
then value: value then value: value
else value: { config = value; }; else value: { config = value; };
coerce = unify: value: if isFunction value
then setFunctionArgs (args: unify (value args)) (functionArgs value)
else unify (shorthandToModule value);
allModules = defs: imap1 (n: { value, file }: allModules = defs: imap1 (n: { value, file }:
if isAttrs value || isFunction value then if isFunction value
# Annotate the value with the location of its definition for better error messages then setFunctionArgs
coerce (lib.modules.unifyModuleSyntax file "${toString file}-${toString n}") value (args: lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (value args))
(functionArgs value)
else if isAttrs value
then
lib.modules.unifyModuleSyntax file "${toString file}-${toString n}" (shorthandToModule value)
else value else value
) defs; ) defs;