Move variable identifier parsing to ParseContext
This change is purely refactoring existing functionality to make it
easier to change variable identifier parsing.
BUG=angleproject:911
BUG=541551
Change-Id: I282fbb66d40cd71fa0f4804e4a8e893744cd6bfc
Reviewed-on: https://chromium-review.googlesource.com/309724
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 04e88da..84ba5e4 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1182,6 +1182,25 @@
return variable;
}
+TIntermTyped *TParseContext::parseVariableIdentifier(const TSourceLoc &location,
+ const TString *name,
+ const TSymbol *symbol)
+{
+ const TVariable *variable = getNamedVariable(location, name, symbol);
+
+ if (variable->getType().getQualifier() == EvqConst)
+ {
+ TConstantUnion *constArray = variable->getConstPointer();
+ TType t(variable->getType());
+ return intermediate.addConstantUnion(constArray, t, location);
+ }
+ else
+ {
+ return intermediate.addSymbol(variable->getUniqueId(), variable->getName(),
+ variable->getType(), location);
+ }
+}
+
//
// Look up a function name in the symbol table, and make sure it is a function.
//