remove ExprAttrs::AttrDef::inherited

it's no longer widely used and has a rather confusing meaning now that
inherit-from is handled very differently.
This commit is contained in:
pennae 2024-02-26 15:33:52 +01:00
parent a704123ea1
commit 375cc2438a
3 changed files with 2 additions and 4 deletions

View file

@ -1220,7 +1220,7 @@ void ExprAttrs::eval(EvalState & state, Env & env, Value & v)
Displacement displ = 0;
for (auto & i : attrs) {
Value * vAttr;
if (hasOverrides && !i.second.inherited()) {
if (hasOverrides && i.second.kind != AttrDef::Kind::Inherited) {
vAttr = state.allocValue();
mkThunk(*vAttr, *i.second.chooseByKind(&env2, &env, inheritEnv), i.second.e);
} else

View file

@ -189,8 +189,6 @@ struct ExprAttrs : Expr
: kind(kind), e(e), pos(pos) { };
AttrDef() { };
bool inherited() const { return kind == Kind::Inherited; }
template<typename T>
const T & chooseByKind(const T & plain, const T & inherited, const T & inheritedFrom) const
{

View file

@ -89,7 +89,7 @@ inline void ParserState::addAttr(ExprAttrs * attrs, AttrPath && attrPath, Expr *
if (i->symbol) {
ExprAttrs::AttrDefs::iterator j = attrs->attrs.find(i->symbol);
if (j != attrs->attrs.end()) {
if (!j->second.inherited()) {
if (j->second.kind != ExprAttrs::AttrDef::Kind::Inherited) {
ExprAttrs * attrs2 = dynamic_cast<ExprAttrs *>(j->second.e);
if (!attrs2) dupAttr(attrPath, pos, j->second.pos);
attrs = attrs2;