Represent splat constructors with a dedicated ConstructorSplat class.
Change-Id: Ic9c3d688b571591d057ab6a4e998f1f9712a1b58
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392117
Commit-Queue: Brian Osman <brianosman@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 422013b..2d61939 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -19,6 +19,7 @@
#include "src/sksl/ir/SkSLConstructor.h"
#include "src/sksl/ir/SkSLConstructorArray.h"
#include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
+#include "src/sksl/ir/SkSLConstructorSplat.h"
#include "src/sksl/ir/SkSLContinueStatement.h"
#include "src/sksl/ir/SkSLDiscardStatement.h"
#include "src/sksl/ir/SkSLDoStatement.h"
@@ -326,6 +327,12 @@
*ctor.type().clone(symbolTableForExpression),
expr(ctor.argument()));
}
+ case Expression::Kind::kConstructorSplat: {
+ const ConstructorSplat& ctor = expression.as<ConstructorSplat>();
+ return ConstructorSplat::Make(*fContext, offset,
+ *ctor.type().clone(symbolTableForExpression),
+ expr(ctor.argument()));
+ }
case Expression::Kind::kExternalFunctionCall: {
const ExternalFunctionCall& externalCall = expression.as<ExternalFunctionCall>();
return std::make_unique<ExternalFunctionCall>(offset, &externalCall.function(),
@@ -922,7 +929,8 @@
}
case Expression::Kind::kConstructor:
case Expression::Kind::kConstructorArray:
- case Expression::Kind::kConstructorDiagonalMatrix: {
+ case Expression::Kind::kConstructorDiagonalMatrix:
+ case Expression::Kind::kConstructorSplat: {
AnyConstructor& constructorExpr = (*expr)->asAnyConstructor();
for (std::unique_ptr<Expression>& arg : constructorExpr.argumentSpan()) {
this->visitExpression(&arg);