Commit 4ddae359 by Olli Etuaho Committed by Commit Bot

Use array_specifier in struct declarator parsing

This will make implementing arrays of arrays simpler for struct members as well. Similar refactoring was already done for other types of array declarations. BUG=angleproject:2125 TEST=angle_unittests Change-Id: I0483c3a7c006d37090c7c972cb3d7763d3909c8f Reviewed-on: https://chromium-review.googlesource.com/739824Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 9cd7163e
...@@ -4555,14 +4555,13 @@ TField *TParseContext::parseStructDeclarator(TString *identifier, const TSourceL ...@@ -4555,14 +4555,13 @@ TField *TParseContext::parseStructDeclarator(TString *identifier, const TSourceL
TField *TParseContext::parseStructArrayDeclarator(TString *identifier, TField *TParseContext::parseStructArrayDeclarator(TString *identifier,
const TSourceLoc &loc, const TSourceLoc &loc,
TIntermTyped *arraySize, unsigned int arraySize,
const TSourceLoc &arraySizeLoc) const TSourceLoc &arraySizeLoc)
{ {
checkIsNotReserved(loc, *identifier); checkIsNotReserved(loc, *identifier);
TType *type = new TType(EbtVoid, EbpUndefined); TType *type = new TType(EbtVoid, EbpUndefined);
unsigned int size = checkIsValidArraySize(arraySizeLoc, arraySize); type->makeArray(arraySize);
type->makeArray(size);
return new TField(type, identifier, loc); return new TField(type, identifier, loc);
} }
......
...@@ -300,7 +300,7 @@ class TParseContext : angle::NonCopyable ...@@ -300,7 +300,7 @@ class TParseContext : angle::NonCopyable
TField *parseStructDeclarator(TString *identifier, const TSourceLoc &loc); TField *parseStructDeclarator(TString *identifier, const TSourceLoc &loc);
TField *parseStructArrayDeclarator(TString *identifier, TField *parseStructArrayDeclarator(TString *identifier,
const TSourceLoc &loc, const TSourceLoc &loc,
TIntermTyped *arraySize, unsigned int arraySize,
const TSourceLoc &arraySizeLoc); const TSourceLoc &arraySizeLoc);
TFieldList *combineStructFieldLists(TFieldList *processedFields, TFieldList *combineStructFieldLists(TFieldList *processedFields,
......
...@@ -1218,8 +1218,8 @@ struct_declarator ...@@ -1218,8 +1218,8 @@ struct_declarator
: identifier { : identifier {
$$ = context->parseStructDeclarator($1.string, @1); $$ = context->parseStructDeclarator($1.string, @1);
} }
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET { | identifier array_specifier {
$$ = context->parseStructArrayDeclarator($1.string, @1, $3, @3); $$ = context->parseStructArrayDeclarator($1.string, @1, $2, @2);
} }
; ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment