mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:34:42 +01:00
Rename ToString to mention Operator (#2539)
Naming this ToString within the Carbon namespace encourages incidental overloading of the function, and that doesn't seem to be intentional; this feels questionable [under overloading style](https://google.github.io/styleguide/cppguide.html#Function_Overloading). OperatorToString seems helpful in that it makes it easy to see at a glance where it's being used.
This commit is contained in:
@@ -49,10 +49,11 @@ auto BinaryOperatorExpressionMatcher::MatchAndExplainImpl(
|
||||
return false;
|
||||
}
|
||||
if (op->op() != op_) {
|
||||
*out << "whose operator is not " << ToString(op_);
|
||||
*out << "whose operator is not " << OperatorToString(op_);
|
||||
return false;
|
||||
}
|
||||
*out << "which is a " << ToString(op_) << " expression whose left operand ";
|
||||
*out << "which is a " << OperatorToString(op_)
|
||||
<< " expression whose left operand ";
|
||||
bool matched = lhs_.MatchAndExplain(*op->arguments()[0], out);
|
||||
*out << " and right operand ";
|
||||
if (!rhs_.MatchAndExplain(*op->arguments()[1], out)) {
|
||||
@@ -63,7 +64,7 @@ auto BinaryOperatorExpressionMatcher::MatchAndExplainImpl(
|
||||
|
||||
void BinaryOperatorExpressionMatcher::DescribeToImpl(std::ostream* out,
|
||||
bool negated) const {
|
||||
*out << "is " << (negated ? "not " : "") << "a " << ToString(op_)
|
||||
*out << "is " << (negated ? "not " : "") << "a " << OperatorToString(op_)
|
||||
<< " expression whose ";
|
||||
*out << "left operand ";
|
||||
lhs_.DescribeTo(out);
|
||||
|
||||
Reference in New Issue
Block a user