Promote unary nodes automatically
Unary nodes now get their type set automatically based on the
operation and operand. The operand should only be changed to another
of the same type after the node is constructed. The operation can't
be changed on unary and binary nodes after they've been constructed.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: Ib1ea3dcb1162261966c02d5f03d8091cf647fac1
Reviewed-on: https://chromium-review.googlesource.com/378935
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RewriteElseBlocks.cpp b/src/compiler/translator/RewriteElseBlocks.cpp
index 52ede17..d583e73 100644
--- a/src/compiler/translator/RewriteElseBlocks.cpp
+++ b/src/compiler/translator/RewriteElseBlocks.cpp
@@ -31,13 +31,6 @@
TIntermNode *rewriteSelection(TIntermSelection *selection);
};
-TIntermUnary *MakeNewUnary(TOperator op, TIntermTyped *operand)
-{
- TIntermUnary *unary = new TIntermUnary(op, operand->getType());
- unary->setOperand(operand);
- return unary;
-}
-
ElseBlockRewriter::ElseBlockRewriter()
: TIntermTraverser(true, false, true),
mFunctionType(NULL)
@@ -113,7 +106,7 @@
}
TIntermSymbol *conditionSymbolElse = createTempSymbol(boolType);
- TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolElse);
+ TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot, conditionSymbolElse);
falseBlock = new TIntermSelection(negatedCondition,
selection->getFalseBlock(), negatedElse);
}