mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 06:30:09 +01:00
Add name accessor to NamedEntityView (#994)
This required changing BindingPattern::name() to return `"_"` instead of nullopt when representing a `"_"` binding. Semi-related drive-by fixes: - Update BindingPlaceholderValue to expose a NamedEntity instead of a string name, and stop exposing its type. - Drop the unused SourceLocation parameter of ValueEqual
This commit is contained in:
@@ -26,12 +26,7 @@ void Pattern::Print(llvm::raw_ostream& out) const {
|
||||
break;
|
||||
case PatternKind::BindingPattern: {
|
||||
const auto& binding = cast<BindingPattern>(*this);
|
||||
if (binding.name().has_value()) {
|
||||
out << *binding.name();
|
||||
} else {
|
||||
out << "_";
|
||||
}
|
||||
out << ": " << binding.type();
|
||||
out << binding.name() << ": " << binding.type();
|
||||
break;
|
||||
}
|
||||
case PatternKind::TuplePattern: {
|
||||
|
||||
Reference in New Issue
Block a user