Refactor style in ParseContext.h.
BUG=angleproject:995
Change-Id: I893785a068d0d5cf4afc18123896bf540e53a3e0
Reviewed-on: https://chromium-review.googlesource.com/270627
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 3736a79..5b8f209 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -653,7 +653,7 @@
return false;
}
-bool TParseContext::containsSampler(TType& type)
+bool TParseContext::containsSampler(const TType& type)
{
if (IsSampler(type.getBasicType()))
return true;
@@ -750,12 +750,13 @@
//
// Returns true if there is an error.
//
-bool TParseContext::arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type)
+bool TParseContext::arrayTypeErrorCheck(const TSourceLoc& line, const TPublicType &type)
{
//
// Can the type be an array?
//
- if (type.array) {
+ if (type.array)
+ {
error(line, "cannot declare arrays of arrays", TType(type).getCompleteString().c_str());
return true;
}
@@ -889,7 +890,7 @@
// These checks are common for all declarations starting a declarator list, and declarators that follow an empty
// declaration.
//
-bool TParseContext::singleDeclarationErrorCheck(TPublicType &publicType, const TSourceLoc &identifierLocation)
+bool TParseContext::singleDeclarationErrorCheck(const TPublicType &publicType, const TSourceLoc &identifierLocation)
{
switch (publicType.qualifier)
{
@@ -1095,7 +1096,7 @@
//
// Returns true on error, false if no error
//
-bool TParseContext::executeInitializer(const TSourceLoc &line, const TString &identifier, TPublicType &pType,
+bool TParseContext::executeInitializer(const TSourceLoc &line, const TString &identifier, const TPublicType &pType,
TIntermTyped *initializer, TIntermNode **intermNode)
{
ASSERT(intermNode != nullptr);
@@ -1357,7 +1358,7 @@
return intermediate.makeAggregate(symbol, identifierLocation);
}
-TIntermAggregate *TParseContext::parseSingleInitDeclaration(TPublicType &publicType,
+TIntermAggregate *TParseContext::parseSingleInitDeclaration(const TPublicType &publicType,
const TSourceLoc &identifierLocation,
const TString &identifier,
const TSourceLoc &initLocation,
@@ -1539,7 +1540,7 @@
return nullptr;
}
-TIntermAggregate *TParseContext::parseInitDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration,
+TIntermAggregate *TParseContext::parseInitDeclarator(const TPublicType &publicType, TIntermAggregate *aggregateDeclaration,
const TSourceLoc &identifierLocation, const TString &identifier,
const TSourceLoc &initLocation, TIntermTyped *initializer)
{
@@ -1576,7 +1577,7 @@
}
}
-TIntermAggregate *TParseContext::parseArrayInitDeclarator(TPublicType &publicType,
+TIntermAggregate *TParseContext::parseArrayInitDeclarator(const TPublicType &publicType,
TIntermAggregate *aggregateDeclaration,
const TSourceLoc& identifierLocation,
const TString &identifier,
@@ -1668,8 +1669,9 @@
}
}
-TFunction *TParseContext::addConstructorFunc(TPublicType publicType)
+TFunction *TParseContext::addConstructorFunc(const TPublicType &publicTypeIn)
{
+ TPublicType publicType = publicTypeIn;
TOperator op = EOpNull;
if (publicType.userDef)
{