Clean up unary and aggregate math folding
Prefer asserts instead of adding internal errors to the compiler log
when types of arguments are not as expected or the folding function
runs into an operation it can't handle. Neither of these cases should
be possible, the checks for correct argument types are solid at this
point.
In the future, when new built-in functions are added, constant folding
support for them should be added as well.
foldUnaryWithDifferentReturnType and foldUnaryWithSameReturnType are
renamed to foldUnaryNonComponentWise and foldUnaryComponentWise
respectively. These names better reflect what these functions are
doing.
The info sink member is removed from TIntermediate, since TDiagnostics
is now passed into the functions that may generate warnings instead.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I6a08abbe29cf23f3a318032fdc46dd3dbaf4410e
Reviewed-on: https://chromium-review.googlesource.com/377959
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index 9db6a66..02f6416 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -31,14 +31,13 @@
public:
TParseContext(TSymbolTable &symt,
TExtensionBehavior &ext,
- TIntermediate &interm,
sh::GLenum type,
ShShaderSpec spec,
int options,
bool checksPrecErrors,
TInfoSink &is,
const ShBuiltInResources &resources)
- : intermediate(interm),
+ : intermediate(),
symbolTable(symt),
mDeferredSingleDeclarationErrorCheck(false),
mShaderType(type),
@@ -367,7 +366,7 @@
TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &line);
// TODO(jmadill): make these private
- TIntermediate &intermediate; // to hold and build a parse tree
+ TIntermediate intermediate; // to build a parse tree
TSymbolTable &symbolTable; // symbol table that goes with the language currently being parsed
private: