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
TField *TParseContext::parseStructArrayDeclarator(TString *identifier,
const TSourceLoc &loc,
TIntermTyped *arraySize,
unsigned int arraySize,
const TSourceLoc &arraySizeLoc)
{
checkIsNotReserved(loc, *identifier);
TType *type = new TType(EbtVoid, EbpUndefined);
unsigned int size = checkIsValidArraySize(arraySizeLoc, arraySize);
type->makeArray(size);
type->makeArray(arraySize);
return new TField(type, identifier, loc);
}
......
......@@ -300,7 +300,7 @@ class TParseContext : angle::NonCopyable
TField *parseStructDeclarator(TString *identifier, const TSourceLoc &loc);
TField *parseStructArrayDeclarator(TString *identifier,
const TSourceLoc &loc,
TIntermTyped *arraySize,
unsigned int arraySize,
const TSourceLoc &arraySizeLoc);
TFieldList *combineStructFieldLists(TFieldList *processedFields,
......
......@@ -1218,8 +1218,8 @@ struct_declarator
: identifier {
$$ = context->parseStructDeclarator($1.string, @1);
}
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$ = context->parseStructArrayDeclarator($1.string, @1, $3, @3);
| identifier array_specifier {
$$ = 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