1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

Don't use any syntactic sugar for dynamic attrs

This doesn't change any functionality but moves some behavior out of the
parser and into the evaluator in order to simplify the code.

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-12-31 23:56:26 +00:00
parent 6f3a51809a
commit cd49fe4f9b
4 changed files with 68 additions and 128 deletions

View file

@ -50,10 +50,19 @@ struct Env;
struct Value;
struct EvalState;
struct StaticEnv;
struct Expr;
/* An attribute path is a sequence of attribute names. */
typedef vector<Symbol> AttrPath;
struct AttrName
{
Symbol symbol;
Expr *expr;
AttrName(const Symbol & s) : symbol(s) {};
AttrName(Expr *e) : expr(e) {};
};
typedef std::vector<AttrName> AttrPath;
string showAttrPath(const AttrPath & attrPath);
@ -138,7 +147,7 @@ struct ExprSelect : Expr
Expr * e, * def;
AttrPath attrPath;
ExprSelect(Expr * e, const AttrPath & attrPath, Expr * def) : e(e), def(def), attrPath(attrPath) { };
ExprSelect(Expr * e, const Symbol & name) : e(e), def(0) { attrPath.push_back(name); };
ExprSelect(Expr * e, const Symbol & name) : e(e), def(0) { attrPath.push_back(AttrName(name)); };
COMMON_METHODS
};