Fixed another division by zero error in skslc
You'd think by now it would have occurred to me that mod is also a kind of division. BUG=skia:6087 Change-Id: I5128d09db94d06f10762ad5c23df32551c5e5855 Reviewed-on: https://skia-review.googlesource.com/6607 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
c55bc9a8dd
commit
2503ab6e92
@ -882,7 +882,12 @@ std::unique_ptr<Expression> IRGenerator::constantFold(const Expression& left,
|
||||
}
|
||||
fErrors.error(right.fPosition, "division by zero");
|
||||
return nullptr;
|
||||
case Token::PERCENT: return RESULT(Int, %);
|
||||
case Token::PERCENT:
|
||||
if (rightVal) {
|
||||
return RESULT(Int, %);
|
||||
}
|
||||
fErrors.error(right.fPosition, "division by zero");
|
||||
return nullptr;
|
||||
case Token::BITWISEAND: return RESULT(Int, &);
|
||||
case Token::BITWISEOR: return RESULT(Int, |);
|
||||
case Token::BITWISEXOR: return RESULT(Int, ^);
|
||||
|
Loading…
Reference in New Issue
Block a user