mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 15:01:05 +01:00
Simplify the API and implementation of Stack (#667)
This commit is contained in:
@@ -84,12 +84,13 @@ void Action::Print(llvm::raw_ostream& out) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Action::PrintList(Stack<Action*> ls, llvm::raw_ostream& out) {
|
||||
if (!ls.IsEmpty()) {
|
||||
out << *ls.Pop();
|
||||
if (!ls.IsEmpty()) {
|
||||
void Action::PrintList(const Stack<Action*>& ls, llvm::raw_ostream& out) {
|
||||
auto it = ls.begin();
|
||||
while (it != ls.end()) {
|
||||
out << **it;
|
||||
++it;
|
||||
if (it != ls.end()) {
|
||||
out << " :: ";
|
||||
PrintList(ls, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user