Collapse Sequence into Block. (#927)

This commit is contained in:
Jon Meow
2021-11-01 14:59:39 -07:00
committed by GitHub
parent e69ec3f528
commit 904774fbb8
7 changed files with 60 additions and 131 deletions
+2 -15
View File
@@ -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";
}