Check multiplication validity in ParseContext
This improves separation of responsibilities in the code: ParseContext
should handle operand type validation, while TIntermBinary::promote
should ideally only determine the type of the node based on the
operation and operands.
BUG=angleproject:952
TEST=angle_unittests
Change-Id: I9a8d8ede21cdf35de631623a62194c0da5c604d2
Reviewed-on: https://chromium-review.googlesource.com/372622
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/RemovePow.cpp b/src/compiler/translator/RemovePow.cpp
index 48fc1f9..db79ca5 100644
--- a/src/compiler/translator/RemovePow.cpp
+++ b/src/compiler/translator/RemovePow.cpp
@@ -60,7 +60,8 @@
log->setLine(node->getLine());
log->setType(x->getType());
- TIntermBinary *mul = new TIntermBinary(EOpMul, y, log);
+ TOperator op = TIntermBinary::GetMulOpBasedOnOperands(y->getType(), log->getType());
+ TIntermBinary *mul = new TIntermBinary(op, y, log);
mul->setLine(node->getLine());
bool valid = mul->promote();
UNUSED_ASSERTION_VARIABLE(valid);