Replace vector<SwitchCase> in Switch with a StatementArray.
This is conceptually the same thing, but we have various places in the
code which expect a unique_ptr<Statement>, and they don't allow a
unique_ptr<SwitchCase> to be passed in, since the types don't match.
This change is particularly relevant to the ProgramWriter, which will be
updated in a followup CL to pass the unique_ptr to visit methods.
Change-Id: I012669fa429a13658ac2be31342c92750fe84b92
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382723
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/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index a1e0f52..9f15deb 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -405,8 +405,8 @@
AutoRehydratorSymbolTable symbols(this);
std::unique_ptr<Expression> expr = this->expression();
int caseCount = this->readU8();
- std::vector<std::unique_ptr<SwitchCase>> cases;
- cases.reserve(caseCount);
+ StatementArray cases;
+ cases.reserve_back(caseCount);
for (int i = 0; i < caseCount; ++i) {
std::unique_ptr<Expression> value = this->expression();
std::unique_ptr<Statement> statement = this->statement();