forked from lix-project/lix
Handle exporters checking correctly
This commit is contained in:
parent
2f4250a416
commit
5d04a4db9b
1 changed files with 14 additions and 7 deletions
|
@ -374,9 +374,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
if (v.type != tLambda)
|
if (v.type != tLambda)
|
||||||
throw Error("exporter must be a function");
|
throw Error("exporter must be a function");
|
||||||
if (!v.lambda.fun->formals ||
|
if (!v.lambda.fun->formals ||
|
||||||
v.lambda.fun->formals->argNames.find(state->symbols.create("program")) == v.lambda.fun->formals->argNames.end() ||
|
v.lambda.fun->formals->argNames.find(state->symbols.create("program")) == v.lambda.fun->formals->argNames.end())
|
||||||
v.lambda.fun->formals->argNames.find(state->symbols.create("args")) == v.lambda.fun->formals->argNames.end())
|
throw Error("exporter must take formal argument 'program'");
|
||||||
throw Error("exporter must take formal arguments 'program' and 'args'");
|
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
e.addTrace(pos, hintfmt("while checking the template '%s'", attrPath));
|
e.addTrace(pos, hintfmt("while checking the template '%s'", attrPath));
|
||||||
throw;
|
throw;
|
||||||
|
@ -506,13 +505,21 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "defaultExporter")
|
else if (name == "defaultExporter")
|
||||||
checkExporter(name, vOutput, pos);
|
for (auto & attr : *vOutput.attrs) {
|
||||||
|
checkSystemName(attr.name, *attr.pos);
|
||||||
|
checkExporter(fmt("%s.%s", name, attr.name), *attr.value, *attr.pos);
|
||||||
|
}
|
||||||
|
|
||||||
else if (name == "exporters") {
|
else if (name == "exporters") {
|
||||||
state->forceAttrs(vOutput, pos);
|
state->forceAttrs(vOutput, pos);
|
||||||
for (auto & attr : *vOutput.attrs)
|
for (auto & attr : *vOutput.attrs) {
|
||||||
checkExporter(fmt("%s.%s", name, attr.name),
|
checkSystemName(attr.name, *attr.pos);
|
||||||
*attr.value, *attr.pos);
|
state->forceAttrs(*attr.value, *attr.pos);
|
||||||
|
for (auto & attr2 : *attr.value->attrs)
|
||||||
|
checkExporter(
|
||||||
|
fmt("%s.%s.%s", name, attr.name, attr2.name),
|
||||||
|
*attr2.value, *attr2.pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue