Replace the vector<Statement> in SwitchCase with a Block.
Change-Id: Ic2d1240ab785101365b0fd934562505fb5a3e599
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381816
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLMetalCodeGenerator.cpp b/src/sksl/SkSLMetalCodeGenerator.cpp
index a5eaf91..93a75b7 100644
--- a/src/sksl/SkSLMetalCodeGenerator.cpp
+++ b/src/sksl/SkSLMetalCodeGenerator.cpp
@@ -1857,12 +1857,11 @@
} else {
this->writeLine("default:");
}
- fIndentation++;
- for (const auto& stmt : c->statements()) {
- this->writeStatement(*stmt);
- this->writeLine();
+ if (!c->statement()->isEmpty()) {
+ fIndentation++;
+ this->writeStatement(*c->statement());
+ fIndentation--;
}
- fIndentation--;
}
fIndentation--;
this->write("}");
@@ -2322,9 +2321,7 @@
const SwitchStatement& sw = s->as<SwitchStatement>();
Requirements result = this->requirements(sw.value().get());
for (const std::unique_ptr<SwitchCase>& sc : sw.cases()) {
- for (const auto& st : sc->statements()) {
- result |= this->requirements(st.get());
- }
+ result |= this->requirements(sc->statement().get());
}
return result;
}