Move ErrorOnDivideByZero out of ConstantFolder interface.
At one point, this was used by BinaryExpression, but now it's just an implementation detail and there's no need to expose it. Change-Id: I705cdd18a587cebd09126f5669c08d69ca1f693a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471618 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
0566f5d93a
commit
6fc735ecbd
@ -176,8 +176,8 @@ static bool is_constant_value(const Expression& expr, double value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConstantFolder::ErrorOnDivideByZero(const Context& context, int line, Operator op,
|
||||
const Expression& right) {
|
||||
static bool error_on_divide_by_zero(const Context& context, int line, Operator op,
|
||||
const Expression& right) {
|
||||
switch (op.kind()) {
|
||||
case Token::Kind::TK_SLASH:
|
||||
case Token::Kind::TK_SLASHEQ:
|
||||
@ -398,7 +398,7 @@ std::unique_ptr<Expression> ConstantFolder::Simplify(const Context& context,
|
||||
return Literal::MakeBool(context, leftExpr.fLine, /*value=*/false);
|
||||
}
|
||||
|
||||
if (ErrorOnDivideByZero(context, line, op, *right)) {
|
||||
if (error_on_divide_by_zero(context, line, op, *right)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -49,13 +49,6 @@ public:
|
||||
static std::unique_ptr<Expression> MakeConstantValueForVariable(
|
||||
std::unique_ptr<Expression> expr);
|
||||
|
||||
/**
|
||||
* Reports an error and returns true if op is a division / mod operator and right is zero or
|
||||
* contains a zero element.
|
||||
*/
|
||||
static bool ErrorOnDivideByZero(const Context& context, int line, Operator op,
|
||||
const Expression& right);
|
||||
|
||||
/** Simplifies the binary expression `left OP right`. Returns null if it can't be simplified. */
|
||||
static std::unique_ptr<Expression> Simplify(const Context& context,
|
||||
int line,
|
||||
|
Loading…
Reference in New Issue
Block a user