mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-16 01:18:14 +00:00
Collapse Sequence into Block. (#927)
This commit is contained in:
1 parent
e69ec3f528
commit
904774fbb8
7 files changed
+60
-131
No files matched your search
@@ -78,27 +78,14 @@ void Statement::PrintDepth(int depth, llvm::raw_ostream& out) const {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Kind::Sequence: {
|
||||
const auto& seq = cast<Sequence>(*this);
|
||||
seq.statement().PrintDepth(depth, out);
|
||||
if (depth < 0 || depth > 1) {
|
||||
out << "\n";
|
||||
} else {
|
||||
out << " ";
|
||||
}
|
||||
if (seq.next()) {
|
||||
(*seq.next())->PrintDepth(depth - 1, out);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Kind::Block: {
|
||||
const auto& block = cast<Block>(*this);
|
||||
out << "{";
|
||||
if (depth < 0 || depth > 1) {
|
||||
out << "\n";
|
||||
}
|
||||
if (block.sequence()) {
|
||||
(*block.sequence())->PrintDepth(depth, out);
|
||||
for (const auto* statement : block.statements()) {
|
||||
statement->PrintDepth(depth, out);
|
||||
if (depth < 0 || depth > 1) {
|
||||
out << "\n";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user