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/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 9c67af0..829e964 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -417,14 +417,6 @@
}
return result;
};
- auto stmts = [&](const StatementArray& ss) {
- StatementArray result;
- result.reserve_back(ss.size());
- for (const auto& s : ss) {
- result.push_back(stmt(s));
- }
- return result;
- };
auto expr = [&](const std::unique_ptr<Expression>& e) -> std::unique_ptr<Expression> {
if (e) {
return this->inlineExpression(offset, varMap, symbolTableForStatement, *e);
@@ -527,7 +519,7 @@
cases.reserve(ss.cases().size());
for (const std::unique_ptr<SwitchCase>& sc : ss.cases()) {
cases.push_back(std::make_unique<SwitchCase>(offset, expr(sc->value()),
- stmts(sc->statements())));
+ stmt(sc->statement())));
}
return SwitchStatement::Make(*fContext, offset, ss.isStatic(), expr(ss.value()),
std::move(cases), SymbolTable::WrapIfBuiltin(ss.symbols()));
@@ -957,9 +949,7 @@
this->visitExpression(&switchStmt.value());
for (const std::unique_ptr<SwitchCase>& switchCase : switchStmt.cases()) {
// The switch-case's fValue cannot be a FunctionCall; skip it.
- for (std::unique_ptr<Statement>& caseBlock : switchCase->statements()) {
- this->visitStatement(&caseBlock);
- }
+ this->visitStatement(&switchCase->statement());
}
break;
}