Convert Operators namespace to first-class Operator object.
This lets us write `op.isAssignment()` instead of
`Operators::IsAssignment(op)`.
Change-Id: If35f2ac500b6ccabc364f9104faaad6e62564667
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369958
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/src/sksl/SkSLAnalysis.cpp b/src/sksl/SkSLAnalysis.cpp
index fa19e7a..cf9905f 100644
--- a/src/sksl/SkSLAnalysis.cpp
+++ b/src/sksl/SkSLAnalysis.cpp
@@ -538,7 +538,7 @@
return "expected loop index on left hand side of condition";
}
// relational_operator is one of: > >= < <= == or !=
- switch (cond.getOperator()) {
+ switch (cond.getOperator().kind()) {
case Token::Kind::TK_GT:
case Token::Kind::TK_GTEQ:
case Token::Kind::TK_LT:
@@ -575,7 +575,7 @@
if (!getConstant(next.right(), &loopInfo.fDelta)) {
return "loop index must be modified by a constant expression";
}
- switch (next.getOperator()) {
+ switch (next.getOperator().kind()) {
case Token::Kind::TK_PLUSEQ: break;
case Token::Kind::TK_MINUSEQ: loopInfo.fDelta = -loopInfo.fDelta; break;
default:
@@ -587,7 +587,7 @@
if (!is_loop_index(next.operand())) {
return "expected loop index in loop expression";
}
- switch (next.getOperator()) {
+ switch (next.getOperator().kind()) {
case Token::Kind::TK_PLUSPLUS: loopInfo.fDelta = 1; break;
case Token::Kind::TK_MINUSMINUS: loopInfo.fDelta = -1; break;
default:
@@ -599,7 +599,7 @@
if (!is_loop_index(next.operand())) {
return "expected loop index in loop expression";
}
- switch (next.getOperator()) {
+ switch (next.getOperator().kind()) {
case Token::Kind::TK_PLUSPLUS: loopInfo.fDelta = 1; break;
case Token::Kind::TK_MINUSMINUS: loopInfo.fDelta = -1; break;
default:
@@ -624,7 +624,7 @@
double val = loopInfo.fStart;
auto evalCond = [&]() {
- switch (cond.getOperator()) {
+ switch (cond.getOperator().kind()) {
case Token::Kind::TK_GT: return val > loopEnd;
case Token::Kind::TK_GTEQ: return val >= loopEnd;
case Token::Kind::TK_LT: return val < loopEnd;