Commit 856c497e by Olli Etuaho Committed by Commit Bot

Clarify error checking function names in the GLSL parser

Most error checking functions in ParseContext used to follow a format like <property>ErrorCheck. Sometimes this function would check that the node/value would have <property>, sometimes it would check that the node/value would not have it, which was confusing. Change most of these functions to use a lot more descriptive names, which clearly communicate what they are checking for. Also includes a bit of refactoring in constructorErrorCheck(), so that the function only checks for errors rather than also setting the type of the constructor node. Also make TType::arraySize unsigned, and return a sanitized size from checkIsValidArraySize() instead of using an output parameter. BUG=angleproject:911 TEST=angle_unittests Change-Id: Id9767b8c79594ad3f782f801ea68eb96df721a31 Reviewed-on: https://chromium-review.googlesource.com/367070Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 9371f7ab
......@@ -153,7 +153,7 @@ class TIntermTyped : public TIntermNode
const char *getBasicString() const { return mType.getBasicString(); }
TString getCompleteString() const { return mType.getCompleteString(); }
int getArraySize() const { return mType.getArraySize(); }
unsigned int getArraySize() const { return mType.getArraySize(); }
bool isConstructorWithOnlyConstantUnionParameters();
......
......@@ -357,7 +357,7 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary *node)
if (left->isArray())
{
// The shader will fail validation if the array length is not > 0.
maxSize = leftType.getArraySize() - 1;
maxSize = static_cast<int>(leftType.getArraySize()) - 1;
}
else
{
......
......@@ -224,7 +224,7 @@ const std::map<std::string, unsigned int> &OutputHLSL::getUniformRegisterMap() c
int OutputHLSL::vectorSize(const TType &type) const
{
int elementSize = type.isMatrix() ? type.getCols() : 1;
int arraySize = type.isArray() ? type.getArraySize() : 1;
unsigned int arraySize = type.isArray() ? type.getArraySize() : 1u;
return elementSize * arraySize;
}
......@@ -1711,7 +1711,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
TVector<TIntermSymbol *> samplerSymbols;
TString structName = samplerNamePrefixFromStruct(typedArg);
argType.createSamplerSymbols("angle_" + structName, "",
argType.isArray() ? argType.getArraySize() : 0,
argType.isArray() ? argType.getArraySize() : 0u,
&samplerSymbols, nullptr);
for (const TIntermSymbol *sampler : samplerSymbols)
{
......@@ -2502,7 +2502,7 @@ TString OutputHLSL::argumentString(const TIntermSymbol *symbol)
{
ASSERT(qualifier != EvqOut && qualifier != EvqInOut);
TVector<TIntermSymbol *> samplerSymbols;
type.createSamplerSymbols("angle" + nameStr, "", 0, &samplerSymbols, nullptr);
type.createSamplerSymbols("angle" + nameStr, "", 0u, &samplerSymbols, nullptr);
for (const TIntermSymbol *sampler : samplerSymbols)
{
if (mOutputType == SH_HLSL_4_1_OUTPUT)
......@@ -2870,14 +2870,14 @@ TString OutputHLSL::addArrayConstructIntoFunction(const TType& type)
fnOut << "void " << function.functionName << "(out "
<< typeName << " a[" << type.getArraySize() << "]";
for (int i = 0; i < type.getArraySize(); ++i)
for (unsigned int i = 0u; i < type.getArraySize(); ++i)
{
fnOut << ", " << typeName << " b" << i;
}
fnOut << ")\n"
"{\n";
for (int i = 0; i < type.getArraySize(); ++i)
for (unsigned int i = 0u; i < type.getArraySize(); ++i)
{
fnOut << " a[" << i << "] = b" << i << ";\n";
}
......
......@@ -126,50 +126,55 @@ class TParseContext : angle::NonCopyable
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc &line);
bool reservedErrorCheck(const TSourceLoc &line, const TString &identifier);
void assignError(const TSourceLoc &line, const char *op, TString left, TString right);
void unaryOpError(const TSourceLoc &line, const char *op, TString operand);
void binaryOpError(const TSourceLoc &line, const char *op, TString left, TString right);
void precisionErrorCheck(const TSourceLoc &line, TPrecision precision, TBasicType type);
bool lValueErrorCheck(const TSourceLoc &line, const char *op, TIntermTyped*);
void constErrorCheck(TIntermTyped *node);
void integerErrorCheck(TIntermTyped *node, const char *token);
void globalErrorCheck(const TSourceLoc &line, bool global, const char *token);
bool constructorErrorCheck(const TSourceLoc &line,
TIntermNode *argumentsNode,
TFunction &function,
TOperator op,
TType *type);
void arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped *expr, int &size);
bool arrayQualifierErrorCheck(const TSourceLoc &line, const TPublicType &type);
bool arrayTypeErrorCheck(const TSourceLoc &line, const TPublicType &type);
bool voidErrorCheck(const TSourceLoc &line, const TString &identifier, const TBasicType &type);
void boolErrorCheck(const TSourceLoc &, const TIntermTyped *);
void boolErrorCheck(const TSourceLoc &, const TPublicType &);
bool samplerErrorCheck(const TSourceLoc &line, const TPublicType &pType, const char *reason);
void locationDeclaratorListCheck(const TSourceLoc &line, const TPublicType &pType);
void parameterSamplerErrorCheck(const TSourceLoc &line,
TQualifier qualifier,
const TType &type);
void paramErrorCheck(const TSourceLoc &line,
TQualifier qualifier,
TQualifier paramQualifier,
TType *type);
bool extensionErrorCheck(const TSourceLoc &line, const TString&);
bool checkIsNotReserved(const TSourceLoc &line, const TString &identifier);
void checkPrecisionSpecified(const TSourceLoc &line, TPrecision precision, TBasicType type);
bool checkCanBeLValue(const TSourceLoc &line, const char *op, TIntermTyped *node);
void checkIsConst(TIntermTyped *node);
void checkIsScalarInteger(TIntermTyped *node, const char *token);
void checkIsAtGlobalLevel(const TSourceLoc &line, const char *token);
bool checkConstructorArguments(const TSourceLoc &line,
TIntermNode *argumentsNode,
const TFunction &function,
TOperator op,
const TType &type);
// Returns a sanitized array size to use (the size is at least 1).
unsigned int checkIsValidArraySize(const TSourceLoc &line, TIntermTyped *expr);
bool checkIsValidQualifierForArray(const TSourceLoc &line, const TPublicType &type);
bool checkIsValidTypeForArray(const TSourceLoc &line, const TPublicType &type);
bool checkIsNonVoid(const TSourceLoc &line, const TString &identifier, const TBasicType &type);
void checkIsScalarBool(const TSourceLoc &line, const TIntermTyped *type);
void checkIsScalarBool(const TSourceLoc &line, const TPublicType &pType);
bool checkIsNotSampler(const TSourceLoc &line, const TPublicType &pType, const char *reason);
void checkDeclaratorLocationIsNotSpecified(const TSourceLoc &line, const TPublicType &pType);
void checkLocationIsNotSpecified(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier);
void checkOutParameterIsNotSampler(const TSourceLoc &line,
TQualifier qualifier,
const TType &type);
void checkIsParameterQualifierValid(const TSourceLoc &line,
TQualifier qualifier,
TQualifier paramQualifier,
TType *type);
bool checkCanUseExtension(const TSourceLoc &line, const TString &extension);
void singleDeclarationErrorCheck(const TPublicType &publicType,
const TSourceLoc &identifierLocation);
void layoutLocationErrorCheck(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier);
void layoutSupportedErrorCheck(const TSourceLoc &location,
const TString &layoutQualifierName,
int versionRequired);
bool layoutWorkGroupSizeErrorCheck(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier);
void functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *);
void es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation);
void es3InputOutputTypeCheck(const TQualifier qualifier,
const TPublicType &type,
const TSourceLoc &qualifierLocation);
void checkLayoutQualifierSupported(const TSourceLoc &location,
const TString &layoutQualifierName,
int versionRequired);
bool checkWorkGroupSizeIsNotSpecified(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier);
void functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *fnCall);
void checkInvariantIsOutVariableES3(const TQualifier qualifier,
const TSourceLoc &invariantLocation);
void checkInputOutputTypeIsValidES3(const TQualifier qualifier,
const TPublicType &type,
const TSourceLoc &qualifierLocation);
const TPragma &pragma() const { return mDirectiveHandler.pragma(); }
const TExtensionBehavior &extensionBehavior() const { return mDirectiveHandler.extensionBehavior(); }
......@@ -265,7 +270,6 @@ class TParseContext : angle::NonCopyable
const TSourceLoc &location);
TFunction *addConstructorFunc(const TPublicType &publicType);
TIntermTyped *addConstructor(TIntermNode *arguments,
TType *type,
TOperator op,
TFunction *fnCall,
const TSourceLoc &line);
......@@ -375,7 +379,9 @@ class TParseContext : angle::NonCopyable
bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable);
void nonInitErrorCheck(const TSourceLoc &line, const TString &identifier, TPublicType *type);
void checkCanBeDeclaredWithoutInitializer(const TSourceLoc &line,
const TString &identifier,
TPublicType *type);
TIntermTyped *addBinaryMathInternal(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
......
......@@ -318,7 +318,6 @@ size_t TType::getObjectSize() const
if (isArray())
{
// TODO: getArraySize() returns an int, not a size_t
size_t currentArraySize = getArraySize();
if (currentArraySize > INT_MAX / totalSize)
totalSize = INT_MAX;
......@@ -364,7 +363,7 @@ bool TStructure::containsSamplers() const
void TStructure::createSamplerSymbols(const TString &structName,
const TString &structAPIName,
const int arrayOfStructsSize,
const unsigned int arrayOfStructsSize,
TVector<TIntermSymbol *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames) const
{
......@@ -373,9 +372,9 @@ void TStructure::createSamplerSymbols(const TString &structName,
const TType *fieldType = field->type();
if (IsSampler(fieldType->getBasicType()))
{
if (arrayOfStructsSize > 0)
if (arrayOfStructsSize > 0u)
{
for (int arrayIndex = 0; arrayIndex < arrayOfStructsSize; ++arrayIndex)
for (unsigned int arrayIndex = 0u; arrayIndex < arrayOfStructsSize; ++arrayIndex)
{
TStringStream name;
name << structName << "_" << arrayIndex << "_" << field->name();
......@@ -405,10 +404,11 @@ void TStructure::createSamplerSymbols(const TString &structName,
}
else if (fieldType->isStructureContainingSamplers())
{
int nestedArrayOfStructsSize = fieldType->isArray() ? fieldType->getArraySize() : 0;
unsigned int nestedArrayOfStructsSize =
fieldType->isArray() ? fieldType->getArraySize() : 0u;
if (arrayOfStructsSize > 0)
{
for (int arrayIndex = 0; arrayIndex < arrayOfStructsSize; ++arrayIndex)
for (unsigned int arrayIndex = 0u; arrayIndex < arrayOfStructsSize; ++arrayIndex)
{
TStringStream fieldName;
fieldName << structName << "_" << arrayIndex << "_" << field->name();
......
......@@ -123,7 +123,7 @@ class TStructure : public TFieldListCollection
void createSamplerSymbols(const TString &structName,
const TString &structAPIName,
const int arrayOfStructsSize,
const unsigned int arrayOfStructsSize,
TVector<TIntermSymbol *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames) const;
......@@ -387,13 +387,10 @@ class TType
}
bool isUnsizedArray() const
{
return array && arraySize == 0;
return array && arraySize == 0u;
}
int getArraySize() const
{
return arraySize;
}
void setArraySize(int s)
unsigned int getArraySize() const { return arraySize; }
void setArraySize(unsigned int s)
{
if (!array || arraySize != s)
{
......@@ -407,7 +404,7 @@ class TType
if (array)
{
array = false;
arraySize = 0;
arraySize = 0u;
invalidateMangledName();
}
}
......@@ -556,7 +553,7 @@ class TType
void createSamplerSymbols(const TString &structName,
const TString &structAPIName,
const int arrayOfStructsSize,
const unsigned int arrayOfStructsSize,
TVector<TIntermSymbol *> *outputSymbols,
TMap<TIntermSymbol *, TString> *outputSymbolsToAPINames) const
{
......@@ -584,7 +581,7 @@ class TType
unsigned char primarySize; // size of vector or cols matrix
unsigned char secondarySize; // rows of a matrix
bool array;
int arraySize;
unsigned int arraySize;
// 0 unless this is an interface block, or interface block member variable
TInterfaceBlock *interfaceBlock;
......
......@@ -128,7 +128,7 @@ unsigned int UniformHLSL::assignSamplerInStructUniformRegister(const TType &type
ASSERT(IsSampler(type.getBasicType()));
unsigned int registerIndex = mSamplerRegister;
mUniformRegisterMap[std::string(name.c_str())] = registerIndex;
unsigned int registerCount = type.isArray() ? type.getArraySize() : 1;
unsigned int registerCount = type.isArray() ? type.getArraySize() : 1u;
mSamplerRegister += registerCount;
if (outRegisterCount)
{
......@@ -175,9 +175,9 @@ void UniformHLSL::outputHLSLSamplerUniformGroup(
{
out << "static const uint " << DecorateIfNeeded(uniform->getName()) << ArrayString(type)
<< " = {";
for (int i = 0; i < type.getArraySize(); ++i)
for (unsigned int i = 0u; i < type.getArraySize(); ++i)
{
if (i > 0)
if (i > 0u)
out << ", ";
out << (samplerArrayIndex + i);
}
......@@ -281,7 +281,7 @@ void UniformHLSL::uniformsHeader(TInfoSinkBase &out,
{
TVector<TIntermSymbol *> samplerSymbols;
TMap<TIntermSymbol *, TString> symbolsToAPINames;
int arrayOfStructsSize = type.isArray() ? type.getArraySize() : 0;
unsigned int arrayOfStructsSize = type.isArray() ? type.getArraySize() : 0u;
type.createSamplerSymbols("angle_" + name.getString(), name.getString(),
arrayOfStructsSize, &samplerSymbols, &symbolsToAPINames);
for (TIntermSymbol *sampler : samplerSymbols)
......
......@@ -60,7 +60,7 @@ int ValidateOutputs::validateAndCountErrors(TInfoSinkBase &sink) const
for (const auto &symbol : mOutputs)
{
const TType &type = symbol->getType();
const size_t elementCount = static_cast<size_t>(type.isArray() ? type.getArraySize() : 1);
const size_t elementCount = static_cast<size_t>(type.isArray() ? type.getArraySize() : 1u);
const size_t location = static_cast<size_t>(type.getLayoutQualifier().location);
ASSERT(type.getLayoutQualifier().location != -1);
......
......@@ -477,7 +477,7 @@ void CollectVariables::visitVariable(const TIntermSymbol *variable,
attribute.type = GLVariableType(type);
attribute.precision = GLVariablePrecision(type);
attribute.name = variable->getSymbol().c_str();
attribute.arraySize = static_cast<unsigned int>(type.getArraySize());
attribute.arraySize = type.getArraySize();
attribute.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str();
attribute.location = variable->getType().getLayoutQualifier().location;
......@@ -497,7 +497,7 @@ void CollectVariables::visitVariable(const TIntermSymbol *variable,
attribute.type = GLVariableType(type);
attribute.precision = GLVariablePrecision(type);
attribute.name = variable->getSymbol().c_str();
attribute.arraySize = static_cast<unsigned int>(type.getArraySize());
attribute.arraySize = type.getArraySize();
attribute.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str();
attribute.location = variable->getType().getLayoutQualifier().location;
......
......@@ -290,7 +290,7 @@ postfix_expression
integer_expression
: expression {
context->integerErrorCheck($1, "[]");
context->checkIsScalarInteger($1, "[]");
$$ = $1;
}
;
......@@ -369,13 +369,13 @@ function_identifier
$$ = context->addConstructorFunc($1);
}
| IDENTIFIER {
context->reservedErrorCheck(@1, *$1.string);
context->checkIsNotReserved(@1, *$1.string);
const TType *type = TCache::getType(EbtVoid, EbpUndefined);
TFunction *function = new TFunction($1.string, type);
$$ = function;
}
| FIELD_SELECTION {
context->reservedErrorCheck(@1, *$1.string);
context->checkIsNotReserved(@1, *$1.string);
const TType *type = TCache::getType(EbtVoid, EbpUndefined);
TFunction *function = new TFunction($1.string, type);
$$ = function;
......@@ -529,7 +529,7 @@ conditional_expression
assignment_expression
: conditional_expression { $$ = $1; }
| unary_expression assignment_operator assignment_expression {
context->lValueErrorCheck(@2, "assign", $1);
context->checkCanBeLValue(@2, "assign", $1);
$$ = context->addAssign($2.op, $1, $3, @2);
}
;
......@@ -577,7 +577,7 @@ expression
constant_expression
: conditional_expression {
context->constErrorCheck($1);
context->checkIsConst($1);
$$ = $1;
}
;
......@@ -684,18 +684,17 @@ parameter_declarator
if ($1.type == EbtVoid) {
context->error(@2, "illegal use of type 'void'", $2.string->c_str());
}
context->reservedErrorCheck(@2, *$2.string);
context->checkIsNotReserved(@2, *$2.string);
TParameter param = {$2.string, new TType($1)};
$$.param = param;
}
| type_specifier identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
// Check that we can make an array out of this type
context->arrayTypeErrorCheck(@3, $1);
context->checkIsValidTypeForArray(@3, $1);
context->reservedErrorCheck(@2, *$2.string);
context->checkIsNotReserved(@2, *$2.string);
int size;
context->arraySizeErrorCheck(@3, $4, size);
unsigned int size = context->checkIsValidArraySize(@3, $4);
$1.setArraySize(size);
......@@ -716,24 +715,24 @@ parameter_declaration
//
: parameter_type_qualifier parameter_qualifier parameter_declarator {
$$ = $3;
context->paramErrorCheck(@3, $1, $2, $$.param.type);
context->checkIsParameterQualifierValid(@3, $1, $2, $$.param.type);
}
| parameter_qualifier parameter_declarator {
$$ = $2;
context->parameterSamplerErrorCheck(@2, $1, *$2.param.type);
context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type);
context->checkOutParameterIsNotSampler(@2, $1, *$2.param.type);
context->checkIsParameterQualifierValid(@2, EvqTemporary, $1, $$.param.type);
}
//
// Only type
//
| parameter_type_qualifier parameter_qualifier parameter_type_specifier {
$$ = $3;
context->paramErrorCheck(@3, $1, $2, $$.param.type);
context->checkIsParameterQualifierValid(@3, $1, $2, $$.param.type);
}
| parameter_qualifier parameter_type_specifier {
$$ = $2;
context->parameterSamplerErrorCheck(@2, $1, *$2.param.type);
context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type);
context->checkOutParameterIsNotSampler(@2, $1, *$2.param.type);
context->checkIsParameterQualifierValid(@2, EvqTemporary, $1, $$.param.type);
}
;
......@@ -855,12 +854,12 @@ type_qualifier
: ATTRIBUTE {
VERTEX_ONLY("attribute", @1);
ES2_ONLY("attribute", @1);
context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "attribute");
context->checkIsAtGlobalLevel(@1, "attribute");
$$.setBasic(EbtVoid, EvqAttribute, @1);
}
| VARYING {
ES2_ONLY("varying", @1);
context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying");
context->checkIsAtGlobalLevel(@1, "varying");
if (context->getShaderType() == GL_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqVaryingOut, @1);
else
......@@ -868,7 +867,7 @@ type_qualifier
}
| INVARIANT VARYING {
ES2_ONLY("varying", @1);
context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying");
context->checkIsAtGlobalLevel(@1, "invariant varying");
if (context->getShaderType() == GL_VERTEX_SHADER)
$$.setBasic(EbtVoid, EvqVaryingOut, @1);
else
......@@ -900,12 +899,12 @@ type_qualifier
$$.layoutQualifier = $1;
}
| INVARIANT storage_qualifier {
context->es3InvariantErrorCheck($2.qualifier, @1);
context->checkInvariantIsOutVariableES3($2.qualifier, @1);
$$.setBasic(EbtVoid, $2.qualifier, @2);
$$.invariant = true;
}
| INVARIANT interpolation_qualifier storage_qualifier {
context->es3InvariantErrorCheck($3.qualifier, @1);
context->checkInvariantIsOutVariableES3($3.qualifier, @1);
$$ = context->joinInterpolationQualifiers(@2, $2.qualifier, @3, $3.qualifier);
$$.invariant = true;
}
......@@ -947,7 +946,7 @@ storage_qualifier
$$.qualifier = EvqCentroidOut;
}
| UNIFORM {
context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform");
context->checkIsAtGlobalLevel(@1, "uniform");
$$.qualifier = EvqUniform;
}
;
......@@ -958,7 +957,7 @@ type_specifier
if ($$.precision == EbpUndefined) {
$$.precision = context->symbolTable.getDefaultPrecision($1.type);
context->precisionErrorCheck(@1, $$.precision, $1.type);
context->checkPrecisionSpecified(@1, $$.precision, $1.type);
}
}
| precision_qualifier type_specifier_no_prec {
......@@ -1023,10 +1022,9 @@ type_specifier_no_prec
| type_specifier_nonarray LEFT_BRACKET constant_expression RIGHT_BRACKET {
$$ = $1;
if (!context->arrayTypeErrorCheck(@2, $1))
if (!context->checkIsValidTypeForArray(@2, $1))
{
int size;
context->arraySizeErrorCheck(@2, $3, size);
unsigned int size = context->checkIsValidArraySize(@2, $3);
$$.setArraySize(size);
}
}
......@@ -1300,17 +1298,16 @@ struct_declarator_list
struct_declarator
: identifier {
context->reservedErrorCheck(@1, *$1.string);
context->checkIsNotReserved(@1, *$1.string);
TType* type = new TType(EbtVoid, EbpUndefined);
$$ = new TField(type, $1.string, @1);
}
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
context->reservedErrorCheck(@1, *$1.string);
context->checkIsNotReserved(@1, *$1.string);
TType* type = new TType(EbtVoid, EbpUndefined);
int size;
context->arraySizeErrorCheck(@3, $3, size);
unsigned int size = context->checkIsValidArraySize(@3, $3);
type->setArraySize(size);
$$ = new TField(type, $1.string, @1);
......@@ -1393,7 +1390,7 @@ expression_statement
selection_statement
: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
context->boolErrorCheck(@1, $3);
context->checkIsScalarBool(@1, $3);
$$ = context->intermediate.addSelection($3, $5, @1);
}
;
......@@ -1429,11 +1426,11 @@ condition
// In 1996 c++ draft, conditions can include single declarations
: expression {
$$ = $1;
context->boolErrorCheck($1->getLine(), $1);
context->checkIsScalarBool($1->getLine(), $1);
}
| fully_specified_type identifier EQUAL initializer {
TIntermNode *intermNode;
context->boolErrorCheck(@2, $1);
context->checkIsScalarBool(@2, $1);
if (!context->executeInitializer(@2, *$2.string, $1, $4, &intermNode))
$$ = $4;
......@@ -1450,7 +1447,7 @@ iteration_statement
context->decrLoopNestingLevel();
}
| DO { context->incrLoopNestingLevel(); } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
context->boolErrorCheck(@8, $6);
context->checkIsScalarBool(@8, $6);
$$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, @4);
context->decrLoopNestingLevel();
......
......@@ -504,7 +504,7 @@ void GetVariableTraverser::traverse(const TType &type,
VarT variable;
variable.name = name.c_str();
variable.arraySize = static_cast<unsigned int>(type.getArraySize());
variable.arraySize = type.getArraySize();
if (!structure)
{
......
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