libexpr: make ExprInheritFrom not be an ExprVar
this was only a convenient fiction when it was introduced, but it is no longer. Change-Id: I72c50e7774c75408c1a40aee7da22059474ba01d
This commit is contained in:
@@ -1259,6 +1259,14 @@ void ExprVar::eval(EvalState & state, Env & env, Value & v)
|
||||
}
|
||||
|
||||
|
||||
void ExprInheritFrom::eval(EvalState & state, Env & env, Value & v)
|
||||
{
|
||||
Value * v2 = env.values[displ];
|
||||
state.forceValue(*v2, pos);
|
||||
v = *v2;
|
||||
}
|
||||
|
||||
|
||||
static std::string showAttrPath(EvalState & state, Env & env, const AttrPath & attrPath)
|
||||
{
|
||||
std::ostringstream out;
|
||||
|
||||
@@ -138,20 +138,17 @@ struct ExprVar : Expr
|
||||
* Unlike normal variable references, the displacement is set during parsing, and always refers to
|
||||
* `ExprAttrs::inheritFromExprs` (by itself or in `ExprLet`), whose values are put into their own `Env`.
|
||||
*/
|
||||
struct ExprInheritFrom : ExprVar
|
||||
struct ExprInheritFrom : Expr
|
||||
{
|
||||
ref<Expr> fromExpr;
|
||||
Displacement displ;
|
||||
|
||||
ExprInheritFrom(PosIdx pos, Displacement displ, ref<Expr> fromExpr)
|
||||
: ExprVar(pos, {}), fromExpr(fromExpr)
|
||||
: Expr(pos), fromExpr(fromExpr), displ(displ)
|
||||
{
|
||||
this->level = 0;
|
||||
this->displ = displ;
|
||||
this->fromWith = nullptr;
|
||||
}
|
||||
|
||||
JSON toJSON(SymbolTable const & symbols) const override;
|
||||
void bindVars(Evaluator & es, const std::shared_ptr<const StaticEnv> & env) override;
|
||||
COMMON_METHODS
|
||||
};
|
||||
|
||||
struct ExprSelect : Expr
|
||||
|
||||
Reference in New Issue
Block a user