Commit 693c9aa0 by Olli Etuaho

Replace setArray function in TPublicType with functions from TType

Having only one way of setting or clearing arrayness of types clarifies code dealing with arrays. TEST=angle_unittests BUG=angleproject:941 Change-Id: I98cb7c44fd66440c9de8b4c6c4a02827e9300db7 Reviewed-on: https://chromium-review.googlesource.com/264361Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 93a90fd0
......@@ -1238,7 +1238,7 @@ TPublicType TParseContext::addFullySpecifiedType(TQualifier qualifier, TLayoutQu
{
error(typeSpecifier.line, "not supported", "first-class array");
recover();
returnType.setArray(false);
returnType.clearArrayness();
}
if (shaderVersion < 300)
......@@ -1347,7 +1347,7 @@ TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &public
}
else
{
arrayType.setArray(true, size);
arrayType.setArraySize(size);
}
TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(arrayType), identifierLocation);
......@@ -1468,7 +1468,7 @@ TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &publicType, c
if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
recover();
TPublicType arrayType(publicType);
arrayType.setArray(true, size);
arrayType.setArraySize(size);
TVariable* variable = NULL;
if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
recover();
......
......@@ -553,11 +553,16 @@ struct TPublicType
secondarySize = r;
}
void setArray(bool a, int s = 0)
void setArraySize(int s)
{
array = a;
array = true;
arraySize = s;
}
void clearArrayness()
{
array = false;
arraySize = 0;
}
bool isStructureContainingArrays() const
{
......
......@@ -807,7 +807,7 @@ parameter_declarator
int size;
if (context->arraySizeErrorCheck(@3, $4, size))
context->recover();
$1.setArray(true, size);
$1.setArraySize(size);
TType* type = new TType($1);
TParameter param = { $2.string, type };
......@@ -930,7 +930,7 @@ fully_specified_type
if ($1.array) {
ES3_ONLY("[]", @1, "first-class-array");
if (context->shaderVersion != 300) {
$1.setArray(false);
$1.clearArrayness();
}
}
}
......@@ -1120,7 +1120,7 @@ type_specifier_no_prec
int size;
if (context->arraySizeErrorCheck(@2, $3, size))
context->recover();
$$.setArray(true, size);
$$.setArraySize(size);
}
}
;
......
......@@ -3277,7 +3277,7 @@ yyreduce:
int size;
if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
context->recover();
(yyvsp[-4].interm.type).setArray(true, size);
(yyvsp[-4].interm.type).setArraySize(size);
TType* type = new TType((yyvsp[-4].interm.type));
TParameter param = { (yyvsp[-3].lex).string, type };
......@@ -3471,7 +3471,7 @@ yyreduce:
if ((yyvsp[0].interm.type).array) {
ES3_ONLY("[]", (yylsp[0]), "first-class-array");
if (context->shaderVersion != 300) {
(yyvsp[0].interm.type).setArray(false);
(yyvsp[0].interm.type).clearArrayness();
}
}
}
......@@ -3786,7 +3786,7 @@ yyreduce:
int size;
if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
context->recover();
(yyval.interm.type).setArray(true, size);
(yyval.interm.type).setArraySize(size);
}
}
......
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