Remove createAssign: only called once
This will make it easier to add tracking of static reads.
BUG=angleproject:2262
TEST=angle_unittests
Change-Id: I23e0587c022c45ac62434a2a0d8170e8978d1c24
Reviewed-on: https://chromium-review.googlesource.com/983916
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index fbfa454..b4fcbb7 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -5327,41 +5327,34 @@
return node;
}
-TIntermBinary *TParseContext::createAssign(TOperator op,
- TIntermTyped *left,
- TIntermTyped *right,
- const TSourceLoc &loc)
-{
- if (binaryOpCommonCheck(op, left, right, loc))
- {
- if (op == EOpMulAssign)
- {
- op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType());
- if (!isMultiplicationTypeCombinationValid(op, left->getType(), right->getType()))
- {
- return nullptr;
- }
- }
- TIntermBinary *node = new TIntermBinary(op, left, right);
- node->setLine(loc);
-
- return node;
- }
- return nullptr;
-}
-
TIntermTyped *TParseContext::addAssign(TOperator op,
TIntermTyped *left,
TIntermTyped *right,
const TSourceLoc &loc)
{
checkCanBeLValue(loc, "assign", left);
- TIntermTyped *node = createAssign(op, left, right, loc);
+ TIntermBinary *node = nullptr;
+ if (binaryOpCommonCheck(op, left, right, loc))
+ {
+ if (op == EOpMulAssign)
+ {
+ op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType());
+ if (isMultiplicationTypeCombinationValid(op, left->getType(), right->getType()))
+ {
+ node = new TIntermBinary(op, left, right);
+ }
+ }
+ else
+ {
+ node = new TIntermBinary(op, left, right);
+ }
+ }
if (node == nullptr)
{
assignError(loc, "assign", left->getCompleteString(), right->getCompleteString());
return left;
}
+ node->setLine(loc);
return node;
}