Unify the 8 grammar productions for declaring variables. This greatly simplifies making changes for this set of productions.

This change also naturally picks up redeclarations of built-in arrays and the addition of the remaining linker objects of const, arrays, etc.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23246 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-09-26 00:45:21 +00:00
parent 337dbc7d8c
commit 9839e2440e
45 changed files with 505 additions and 243 deletions

View file

@ -100,13 +100,12 @@ public:
void globalCheck(TSourceLoc, bool global, const char* token);
bool constructorError(TSourceLoc, TIntermNode*, TFunction&, TOperator, TType&);
void arraySizeCheck(TSourceLoc, TIntermTyped* expr, int& size);
bool arrayQualifierError(TSourceLoc, const TPublicType&);
bool arrayQualifierError(TSourceLoc, const TQualifier&);
void arraySizeRequiredCheck(TSourceLoc, int size);
void arrayDimError(TSourceLoc);
void arrayDimCheck(TSourceLoc, TArraySizes* sizes1, TArraySizes* sizes2);
void arrayDimCheck(TSourceLoc, const TType*, TArraySizes*);
void arrayCheck(TSourceLoc, TString& identifier, const TPublicType&, TVariable*& variable);
bool voidErrorCheck(TSourceLoc, const TString&, const TPublicType&);
bool voidErrorCheck(TSourceLoc, const TString&, TBasicType);
void boolCheck(TSourceLoc, const TIntermTyped*);
void boolCheck(TSourceLoc, const TPublicType&);
bool samplerErrorCheck(TSourceLoc, const TPublicType& pType, const char* reason);
@ -119,9 +118,7 @@ public:
void precisionQualifierCheck(TSourceLoc, TPublicType&);
void parameterSamplerCheck(TSourceLoc, TStorageQualifier qualifier, const TType& type);
bool containsSampler(const TType& type);
void nonInitConstCheck(TSourceLoc, TString& identifier, TPublicType& type);
void nonInitCheck(TSourceLoc, TString& identifier, TPublicType& type);
TVariable* redeclare(TSourceLoc, const TString&, const TType&, bool& newDeclaration);
TVariable* redeclareBuiltin(TSourceLoc, const TString&, const TType&, bool& newDeclaration);
void paramCheck(TSourceLoc, TStorageQualifier qualifier, TType* type);
void nestedBlockCheck(TSourceLoc);
void nestedStructCheck(TSourceLoc);
@ -131,8 +128,7 @@ public:
void mergeLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src);
const TFunction* findFunction(TSourceLoc, TFunction* pfnCall, bool *builtIn = 0);
bool executeInitializerError(TSourceLoc, TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
TIntermNode* declareVariable(TSourceLoc, TString& identifier, TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0);
TIntermTyped* addConstructor(TIntermNode*, const TType&, TOperator, TFunction*, TSourceLoc);
TIntermTyped* constructStruct(TIntermNode*, const TType&, int, TSourceLoc);
TIntermTyped* constructBuiltIn(const TType&, TOperator, TIntermNode*, TSourceLoc, bool subset);
@ -170,6 +166,11 @@ public:
protected:
const char* getPreamble();
TBehavior getExtensionBehavior(const char* behavior);
void nonInitConstCheck(TSourceLoc, TString& identifier, TType& type);
TVariable* TParseContext::declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration);
void declareArray(TSourceLoc, TString& identifier, const TType&, TVariable*&, bool& newDeclaration);
TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TType&, TIntermTyped* initializer, TVariable* variable);
public:
//