SkSL enum changes
Changed a couple of SkSL enums to enum classes and rearranged things to
make their storage within IRNode type safe.
Change-Id: I6509d027d79161c1a09473e90943aae061583f20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324624
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/sksl/SkSLInliner.cpp b/src/sksl/SkSLInliner.cpp
index 18c3a69..f9d282a 100644
--- a/src/sksl/SkSLInliner.cpp
+++ b/src/sksl/SkSLInliner.cpp
@@ -503,7 +503,8 @@
auto assignment =
std::make_unique<ExpressionStatement>(std::make_unique<BinaryExpression>(
offset,
- clone_with_ref_kind(*resultExpr, VariableReference::kWrite_RefKind),
+ clone_with_ref_kind(*resultExpr,
+ VariableReference::RefKind::kWrite),
Token::Kind::TK_EQ,
expr(r.expression()),
&resultExpr->type()));
@@ -633,7 +634,7 @@
const Variable* variableSymbol = symbolTableForCall->add(std::make_unique<Variable>(
/*offset=*/-1, fModifiers->handle(Modifiers()),
nameFrag, type, caller->isBuiltin(),
- Variable::kLocal_Storage, initialValue->get()));
+ Variable::Storage::kLocal, initialValue->get()));
// Prepare the variable declaration (taking extra care with `out` params to not clobber any
// initial value).
@@ -719,7 +720,7 @@
inlinedBody.children().push_back(
std::make_unique<ExpressionStatement>(std::make_unique<BinaryExpression>(
offset,
- clone_with_ref_kind(*arguments[i], VariableReference::kWrite_RefKind),
+ clone_with_ref_kind(*arguments[i], VariableReference::RefKind::kWrite),
Token::Kind::TK_EQ,
std::move(varMap[p]),
&arguments[i]->type())));
@@ -727,7 +728,8 @@
if (resultExpr != nullptr) {
// Return our result variable as our replacement expression.
- SkASSERT(resultExpr->as<VariableReference>().refKind() == VariableReference::kRead_RefKind);
+ SkASSERT(resultExpr->as<VariableReference>().refKind() ==
+ VariableReference::RefKind::kRead);
inlinedCall.fReplacementExpr = std::move(resultExpr);
} else {
// It's a void function, so it doesn't actually result in anything, but we have to return