Convert IRGenerator::convertDo to DoStatement::Make.
We currently don't have any optimizations for do-statements so the
primary benefit is moving code out of IRGenerator.
Change-Id: Ibc4d1ecd87ebef572e742dfdb15821cf4ac0f047
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/376179
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 098185f..7899ca4 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -450,7 +450,7 @@
case Statement::Kind::kDo: {
const DoStatement& d = statement.as<DoStatement>();
- return std::make_unique<DoStatement>(offset, stmt(d.statement()), expr(d.test()));
+ return DoStatement::Make(*fContext, stmt(d.statement()), expr(d.test()));
}
case Statement::Kind::kExpression: {
const ExpressionStatement& e = statement.as<ExpressionStatement>();
@@ -473,6 +473,7 @@
case Statement::Kind::kInlineMarker:
case Statement::Kind::kNop:
return statement.clone();
+
case Statement::Kind::kReturn: {
const ReturnStatement& r = statement.as<ReturnStatement>();
if (!r.expression()) {