Refactor validating jump statements out of glslang.y
Move the logic to ParseContext. This will simplify changing the logic for
the break statement that is needed to implement switch.
BUG=angle:921, angle:911
TEST=WebGL conformance tests
Change-Id: Ib8bbc7075c05d345e90377202b5446fb3307f94c
Reviewed-on: https://chromium-review.googlesource.com/251522
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index 2890bd0..b712730 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -32,10 +32,10 @@
shaderSpec(spec),
compileOptions(options),
treeRoot(0),
- loopNestingLevel(0),
+ mLoopNestingLevel(0),
structNestingLevel(0),
currentFunctionType(NULL),
- functionReturnsValue(false),
+ mFunctionReturnsValue(false),
checksPrecisionErrors(checksPrecErrors),
defaultMatrixPacking(EmpColumnMajor),
defaultBlockStorage(EbsShared),
@@ -51,10 +51,10 @@
int shaderVersion;
int compileOptions;
TIntermNode* treeRoot; // root of parse tree being created
- int loopNestingLevel; // 0 if outside all loops
+ int mLoopNestingLevel; // 0 if outside all loops
int structNestingLevel; // incremented while parsing a struct declaration
const TType* currentFunctionType; // the return type of the function that's currently being parsed
- bool functionReturnsValue; // true if a non-void function has a return
+ bool mFunctionReturnsValue; // true if a non-void function has a return
bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
TLayoutMatrixPacking defaultMatrixPacking;
@@ -170,6 +170,9 @@
const TSourceLoc &);
TIntermTyped *addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right,
const TSourceLoc &);
+
+ TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc);
+ TIntermBranch *addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc);
};
int PaParseStrings(size_t count, const char* const string[], const int length[],