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

more cleanup

This commit is contained in:
Ben Burdette 2021-12-27 18:29:55 -07:00
parent 4610e02d04
commit 5954cbf3e9
5 changed files with 18 additions and 49 deletions

View file

@ -99,10 +99,9 @@ struct ExprInt : Expr
NixInt n;
Value v;
ExprInt(NixInt n) : n(n) { mkInt(v, n); };
COMMON_METHODS
Value * maybeThunk(EvalState & state, Env & env);
Pos* getPos() { return 0; }
COMMON_METHODS
};
struct ExprFloat : Expr
@ -110,10 +109,9 @@ struct ExprFloat : Expr
NixFloat nf;
Value v;
ExprFloat(NixFloat nf) : nf(nf) { mkFloat(v, nf); };
COMMON_METHODS
Value * maybeThunk(EvalState & state, Env & env);
Pos* getPos() { return 0; }
COMMON_METHODS
};
struct ExprString : Expr
@ -121,10 +119,9 @@ struct ExprString : Expr
Symbol s;
Value v;
ExprString(const Symbol & s) : s(s) { mkString(v, s); };
COMMON_METHODS
Value * maybeThunk(EvalState & state, Env & env);
Pos* getPos() { return 0; }
COMMON_METHODS
};
/* Temporary class used during parsing of indented strings. */
@ -132,7 +129,6 @@ struct ExprIndStr : Expr
{
string s;
ExprIndStr(const string & s) : s(s) { };
Pos* getPos() { return 0; }
};
@ -141,9 +137,9 @@ struct ExprPath : Expr
string s;
Value v;
ExprPath(const string & s) : s(s) { v.mkPath(this->s.c_str()); };
COMMON_METHODS
Value * maybeThunk(EvalState & state, Env & env);
Pos* getPos() { return 0; }
COMMON_METHODS
};
typedef uint32_t Level;
@ -169,9 +165,9 @@ struct ExprVar : Expr
ExprVar(const Symbol & name) : name(name) { };
ExprVar(const Pos & pos, const Symbol & name) : pos(pos), name(name) { };
COMMON_METHODS
Value * maybeThunk(EvalState & state, Env & env);
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprSelect : Expr
@ -181,8 +177,8 @@ struct ExprSelect : Expr
AttrPath attrPath;
ExprSelect(const Pos & pos, Expr * e, const AttrPath & attrPath, Expr * def) : pos(pos), e(e), def(def), attrPath(attrPath) { };
ExprSelect(const Pos & pos, Expr * e, const Symbol & name) : pos(pos), e(e), def(0) { attrPath.push_back(AttrName(name)); };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprOpHasAttr : Expr
@ -190,8 +186,8 @@ struct ExprOpHasAttr : Expr
Expr * e;
AttrPath attrPath;
ExprOpHasAttr(Expr * e, const AttrPath & attrPath) : e(e), attrPath(attrPath) { };
COMMON_METHODS
Pos* getPos() { return e->getPos(); }
COMMON_METHODS
};
struct ExprAttrs : Expr
@ -219,16 +215,16 @@ struct ExprAttrs : Expr
DynamicAttrDefs dynamicAttrs;
ExprAttrs(const Pos &pos) : recursive(false), pos(pos) { };
ExprAttrs() : recursive(false), pos(noPos) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprList : Expr
{
std::vector<Expr *> elems;
ExprList() { };
COMMON_METHODS
Pos* getPos() { return 0; }
COMMON_METHODS
};
struct Formal
@ -266,8 +262,8 @@ struct ExprLambda : Expr
void setName(Symbol & name);
string showNamePos() const;
inline bool hasFormals() const { return formals != nullptr; }
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprCall : Expr
@ -278,8 +274,8 @@ struct ExprCall : Expr
ExprCall(const Pos & pos, Expr * fun, std::vector<Expr *> && args)
: fun(fun), args(args), pos(pos)
{ }
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprLet : Expr
@ -287,8 +283,8 @@ struct ExprLet : Expr
ExprAttrs * attrs;
Expr * body;
ExprLet(ExprAttrs * attrs, Expr * body) : attrs(attrs), body(body) { };
COMMON_METHODS
Pos* getPos() { return 0; }
COMMON_METHODS
};
struct ExprWith : Expr
@ -297,8 +293,8 @@ struct ExprWith : Expr
Expr * attrs, * body;
size_t prevWith;
ExprWith(const Pos & pos, Expr * attrs, Expr * body) : pos(pos), attrs(attrs), body(body) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprIf : Expr
@ -306,8 +302,8 @@ struct ExprIf : Expr
Pos pos;
Expr * cond, * then, * else_;
ExprIf(const Pos & pos, Expr * cond, Expr * then, Expr * else_) : pos(pos), cond(cond), then(then), else_(else_) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprAssert : Expr
@ -315,16 +311,16 @@ struct ExprAssert : Expr
Pos pos;
Expr * cond, * body;
ExprAssert(const Pos & pos, Expr * cond, Expr * body) : pos(pos), cond(cond), body(body) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprOpNot : Expr
{
Expr * e;
ExprOpNot(Expr * e) : e(e) { };
COMMON_METHODS
Pos* getPos() { return 0; }
COMMON_METHODS
};
#define MakeBinOp(name, s) \
@ -361,16 +357,16 @@ struct ExprConcatStrings : Expr
vector<Expr *> * es;
ExprConcatStrings(const Pos & pos, bool forceString, vector<Expr *> * es)
: pos(pos), forceString(forceString), es(es) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};
struct ExprPos : Expr
{
Pos pos;
ExprPos(const Pos & pos) : pos(pos) { };
COMMON_METHODS
Pos* getPos() { return &pos; }
COMMON_METHODS
};