Moved storage class parsing from base type to variable level
This commit is contained in:
parent
16aa0ac315
commit
a839ccc960
|
@ -44,14 +44,6 @@ Declaration* Parser::ParseBaseTypeDeclaration(uint32 flags)
|
|||
|
||||
break;
|
||||
|
||||
case TK_STATIC:
|
||||
mScanner->NextToken();
|
||||
return ParseBaseTypeDeclaration(flags | DTF_STATIC);
|
||||
|
||||
case TK_EXTERN:
|
||||
mScanner->NextToken();
|
||||
return ParseBaseTypeDeclaration(flags | DTF_EXTERN);
|
||||
|
||||
case TK_CONST:
|
||||
mScanner->NextToken();
|
||||
return ParseBaseTypeDeclaration(flags | DTF_CONST);
|
||||
|
@ -615,6 +607,7 @@ Expression* Parser::ParseInitExpression(Declaration* dtype)
|
|||
Declaration* Parser::ParseDeclaration(bool variable)
|
||||
{
|
||||
bool definingType = false;
|
||||
uint32 storageFlags = 0;
|
||||
|
||||
if (mScanner->mToken == TK_TYPEDEF)
|
||||
{
|
||||
|
@ -622,6 +615,16 @@ Declaration* Parser::ParseDeclaration(bool variable)
|
|||
variable = false;
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else if (mScanner->mToken == TK_STATIC)
|
||||
{
|
||||
storageFlags |= DTF_STATIC;
|
||||
mScanner->NextToken();
|
||||
}
|
||||
else if (mScanner->mToken == TK_EXTERN)
|
||||
{
|
||||
storageFlags |= DTF_EXTERN;
|
||||
mScanner->NextToken();
|
||||
}
|
||||
|
||||
Declaration* bdec = ParseBaseTypeDeclaration(0);
|
||||
|
||||
|
@ -646,7 +649,8 @@ Declaration* Parser::ParseDeclaration(bool variable)
|
|||
{
|
||||
if (variable)
|
||||
{
|
||||
ndec->mFlags |= ndec->mBase->mFlags & (DTF_CONST | DTF_STATIC | DTF_VOLATILE | DTF_EXTERN);
|
||||
ndec->mFlags |= storageFlags;
|
||||
ndec->mFlags |= ndec->mBase->mFlags & (DTF_CONST | DTF_VOLATILE);
|
||||
|
||||
if (ndec->mBase->mType == DT_TYPE_FUNCTION)
|
||||
ndec->mType = DT_CONST_FUNCTION;
|
||||
|
|
Loading…
Reference in New Issue