mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11:16 +02:00
Include position info in function application
This allows error messages like: error: the anonymous function at `/etc/nixos/configuration.nix:1:1' called without required argument `foo', at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:77:59'
This commit is contained in:
parent
3f8e1f5682
commit
b72c8d2e5b
7 changed files with 45 additions and 22 deletions
|
@ -273,6 +273,23 @@ struct ExprBuiltin : Expr
|
|||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprApp : Expr
|
||||
{
|
||||
Pos pos;
|
||||
Expr * e1, * e2;
|
||||
ExprApp(Expr * e1, Expr * e2) : e1(e1), e2(e2) { };
|
||||
ExprApp(const Pos & pos, Expr * e1, Expr * e2) : pos(pos), e1(e1), e2(e2) { };
|
||||
void show(std::ostream & str)
|
||||
{
|
||||
str << *e1 << " " << *e2;
|
||||
}
|
||||
void bindVars(const StaticEnv & env)
|
||||
{
|
||||
e1->bindVars(env); e2->bindVars(env);
|
||||
}
|
||||
void eval(EvalState & state, Env & env, Value & v);
|
||||
};
|
||||
|
||||
#define MakeBinOp(name, s) \
|
||||
struct Expr##name : Expr \
|
||||
{ \
|
||||
|
@ -289,7 +306,6 @@ struct ExprBuiltin : Expr
|
|||
void eval(EvalState & state, Env & env, Value & v); \
|
||||
};
|
||||
|
||||
MakeBinOp(App, "")
|
||||
MakeBinOp(OpEq, "==")
|
||||
MakeBinOp(OpNEq, "!=")
|
||||
MakeBinOp(OpAnd, "&&")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue