1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 23:11:16 +02:00

Show position info in Boolean operations

This commit is contained in:
Eelco Dolstra 2014-04-04 22:43:52 +02:00
parent bd9b1d97b4
commit 4c5faad994
5 changed files with 28 additions and 31 deletions

View file

@ -277,28 +277,13 @@ 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 \
{ \
Pos pos; \
Expr * e1, * e2; \
Expr##name(Expr * e1, Expr * e2) : e1(e1), e2(e2) { }; \
Expr##name(const Pos & pos, Expr * e1, Expr * e2) : pos(pos), e1(e1), e2(e2) { }; \
void show(std::ostream & str) \
{ \
str << *e1 << " " s " " << *e2; \
@ -310,6 +295,7 @@ struct ExprApp : Expr
void eval(EvalState & state, Env & env, Value & v); \
};
MakeBinOp(App, "")
MakeBinOp(OpEq, "==")
MakeBinOp(OpNEq, "!=")
MakeBinOp(OpAnd, "&&")