tidying some interfaces

This commit is contained in:
Vern Paxson 2021-02-27 08:32:04 -08:00
parent d9b67edf52
commit a912f6dd9a
3 changed files with 4 additions and 4 deletions

View file

@ -468,7 +468,7 @@ NameExpr::NameExpr(IDPtr arg_id, bool const_init)
} }
// This isn't in-lined to avoid needing to pull in ID.h. // This isn't in-lined to avoid needing to pull in ID.h.
IDPtr NameExpr::IdPtr() const IDPtr& NameExpr::IdPtr() const
{ {
return id; return id;
} }

View file

@ -405,7 +405,7 @@ public:
explicit NameExpr(IDPtr id, bool const_init = false); explicit NameExpr(IDPtr id, bool const_init = false);
ID* Id() const { return id.get(); } ID* Id() const { return id.get(); }
IDPtr IdPtr(); const IDPtr& IdPtr() const;
ValPtr Eval(Frame* f) const override; ValPtr Eval(Frame* f) const override;
void Assign(Frame* f, ValPtr v) override; void Assign(Frame* f, ValPtr v) override;

View file

@ -989,7 +989,7 @@ ExprPtr ModExpr::Duplicate()
// nullptr, and the caller should have ensured that the starting point is // nullptr, and the caller should have ensured that the starting point is
// a disjunction (since a bare "/pat/ in var" by itself isn't a "cascade" // a disjunction (since a bare "/pat/ in var" by itself isn't a "cascade"
// and doesn't present a potential optimization opportunity. // and doesn't present a potential optimization opportunity.
static bool is_pattern_cascade(ExprPtr e, IDPtr& id, static bool is_pattern_cascade(const ExprPtr& e, IDPtr& id,
std::vector<ConstExprPtr>& patterns) std::vector<ConstExprPtr>& patterns)
{ {
auto lhs = e->GetOp1(); auto lhs = e->GetOp1();
@ -1002,7 +1002,7 @@ static bool is_pattern_cascade(ExprPtr e, IDPtr& id,
rhs->Tag() != EXPR_NAME ) rhs->Tag() != EXPR_NAME )
return false; return false;
auto rhs_id = rhs->AsNameExpr()->IdPtr(); const auto& rhs_id = rhs->AsNameExpr()->IdPtr();
if ( id && rhs_id != id ) if ( id && rhs_id != id )
return false; return false;