Refactor class to represent structure.

We had a TTypeLine to represent a structure field, which simply encapsulated a TType and line number. The line number was only used during parsing for error reporting. There is no need to store a line number because it is already available in the parser token. TEST=WebGL conformance tests R=kbr@chromium.org Review URL: https://codereview.appspot.com/9223045 Additional edits required for dx11proto branch: src/compiler/OutputHLSL.cpp src/compiler/Types.h Conflicts: src/compiler/glslang_tab.cpp src/compiler/glslang_tab.h git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@2235 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 317d3ce5
......@@ -1041,10 +1041,10 @@ bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, Co
int index = 0;
for (size_t j = 0; j < structSize; j++) {
int size = (*fields)[j].type->getObjectSize();
int size = (*fields)[j]->getObjectSize();
for (int i = 0; i < size; i++) {
if ((*fields)[j].type->getBasicType() == EbtStruct) {
if (!CompareStructure(*(*fields)[j].type, &rightUnionArray[index], &leftUnionArray[index]))
if ((*fields)[j]->getBasicType() == EbtStruct) {
if (!CompareStructure(*(*fields)[j], &rightUnionArray[index], &leftUnionArray[index]))
return false;
} else {
if (leftUnionArray[index] != rightUnionArray[index])
......
......@@ -87,7 +87,7 @@ void TOutputGLSLBase::writeVariableType(const TType& type)
ASSERT(structure != NULL);
for (size_t i = 0; i < structure->size(); ++i)
{
const TType* fieldType = (*structure)[i].type;
const TType* fieldType = (*structure)[i];
ASSERT(fieldType != NULL);
if (writeVariablePrecision(fieldType->getPrecision()))
out << " ";
......@@ -143,7 +143,7 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
ASSERT(structure != NULL);
for (size_t i = 0; i < structure->size(); ++i)
{
const TType* fieldType = (*structure)[i].type;
const TType* fieldType = (*structure)[i];
ASSERT(fieldType != NULL);
pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
if (i != structure->size() - 1) out << ", ";
......
......@@ -1353,7 +1353,7 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
for (size_t i = 0; i < fields->size(); i++)
{
const TType *fieldType = (*fields)[i].type;
const TType *fieldType = (*fields)[i];
node->getLeft()->traverse(this);
out << "." + decorateField(fieldType->getFieldName(), node->getLeft()->getType()) + " == ";
......@@ -2583,7 +2583,7 @@ TString OutputHLSL::typeString(const TType &type)
for (unsigned int i = 0; i < fields.size(); i++)
{
const TType &field = *fields[i].type;
const TType &field = *fields[i];
string += " " + typeString(field) + " " + decorate(field.getFieldName()) + arrayString(field) + ";\n";
}
......@@ -2726,7 +2726,7 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI
for (unsigned int i = 0; i < fields.size(); i++)
{
const TType &field = *fields[i].type;
const TType &field = *fields[i];
structure += " " + typeString(field) + " " + decorateField(field.getFieldName(), type) + arrayString(field) + ";\n";
}
......@@ -2740,7 +2740,7 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI
for (unsigned int i = 0; i < fields.size(); i++)
{
ctorParameters.push_back(*fields[i].type);
ctorParameters.push_back(*fields[i]);
}
}
else if (parameters)
......@@ -2915,7 +2915,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
for (size_t i = 0; i < structure->size(); i++)
{
const TType *fieldType = (*structure)[i].type;
const TType *fieldType = (*structure)[i];
constUnion = writeConstantUnion(*fieldType, constUnion);
......@@ -3090,7 +3090,7 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde
{
for (size_t j = 0; j < structure->size(); j++)
{
const TType &fieldType = *(*structure)[j].type;
const TType &fieldType = *(*structure)[j];
const TString &fieldName = fieldType.getFieldName();
const TString uniformName = name + "[" + str(i) + "]." + fieldName;
......@@ -3105,7 +3105,7 @@ void OutputHLSL::declareUniform(const TType &type, const TString &name, int inde
for (size_t i = 0; i < structure->size(); i++)
{
const TType &fieldType = *(*structure)[i].type;
const TType &fieldType = *(*structure)[i];
const TString &fieldName = fieldType.getFieldName();
const TString uniformName = name + "." + fieldName;
......
......@@ -659,7 +659,7 @@ bool TParseContext::containsSampler(TType& type)
if (type.getBasicType() == EbtStruct) {
TTypeList& structure = *type.getStruct();
for (unsigned int i = 0; i < structure.size(); ++i) {
if (containsSampler(*structure[i].type))
if (containsSampler(*structure[i]))
return true;
}
}
......@@ -1139,7 +1139,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
if (type->isArray())
newNode = constructStruct(node, &elementType, 1, node->getLine(), false);
else if (op == EOpConstructStruct)
newNode = constructStruct(node, (*memberTypes).type, 1, node->getLine(), false);
newNode = constructStruct(node, *memberTypes, 1, node->getLine(), false);
else
newNode = constructBuiltIn(type, op, node, node->getLine(), false);
......@@ -1170,7 +1170,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type
if (type->isArray())
newNode = constructStruct(*p, &elementType, paramCount+1, node->getLine(), true);
else if (op == EOpConstructStruct)
newNode = constructStruct(*p, (memberTypes[paramCount]).type, paramCount+1, node->getLine(), true);
newNode = constructStruct(*p, memberTypes[paramCount], paramCount+1, node->getLine(), true);
else
newNode = constructBuiltIn(type, op, *p, node->getLine(), true);
......@@ -1430,10 +1430,10 @@ TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* n
TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
for ( index = 0; index < fields->size(); ++index) {
if ((*fields)[index].type->getFieldName() == identifier) {
if ((*fields)[index]->getFieldName() == identifier) {
break;
} else {
instanceSize += (*fields)[index].type->getObjectSize();
instanceSize += (*fields)[index]->getObjectSize();
}
}
......
......@@ -52,7 +52,7 @@ void TType::buildMangledName(TString& mangledName)
{// support MSVC++6.0
for (unsigned int i = 0; i < structure->size(); ++i) {
mangledName += '-';
(*structure)[i].type->buildMangledName(mangledName);
(*structure)[i]->buildMangledName(mangledName);
}
}
default:
......@@ -78,7 +78,7 @@ int TType::getStructSize() const
if (structureSize == 0)
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++)
structureSize += ((*tl).type)->getObjectSize();
structureSize += (*tl)->getObjectSize();
return structureSize;
}
......@@ -91,7 +91,7 @@ void TType::computeDeepestStructNesting()
int maxNesting = 0;
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); ++tl) {
maxNesting = std::max(maxNesting, ((*tl).type)->getDeepestStructNesting());
maxNesting = std::max(maxNesting, (*tl)->getDeepestStructNesting());
}
deepestStructNesting = 1 + maxNesting;
......@@ -106,8 +106,8 @@ bool TType::isStructureContainingArrays() const
for (TTypeList::const_iterator member = structure->begin(); member != structure->end(); member++)
{
if (member->type->isArray() ||
member->type->isStructureContainingArrays())
if ((*member)->isArray() ||
(*member)->isStructureContainingArrays())
{
return true;
}
......
......@@ -14,14 +14,7 @@
class TType;
struct TPublicType;
//
// Need to have association of line numbers to types in a list for building structs.
//
struct TTypeLine {
TType* type;
int line;
};
typedef TVector<TTypeLine> TTypeList;
typedef TVector<TType*> TTypeList;
inline TTypeList* NewPoolTTypeList()
{
......@@ -90,7 +83,7 @@ public:
for (size_t i = 0; i < structure->size(); i++)
{
registerCount += (*structure)[i].type->totalRegisterCount();
registerCount += (*structure)[i]->totalRegisterCount();
}
return registerCount;
......
......@@ -133,7 +133,7 @@ void getUserDefinedVariableInfo(const TType& type,
const TTypeList* structure = type.getStruct();
for (size_t i = 0; i < structure->size(); ++i) {
const TType* fieldType = (*structure)[i].type;
const TType* fieldType = (*structure)[i];
getVariableInfo(*fieldType,
name + "." + fieldType->getFieldName(),
mappedName + "." + TIntermTraverser::hash(fieldType->getFieldName(), hashFunction),
......
......@@ -74,8 +74,8 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
TQualifier qualifier;
TFunction* function;
TParameter param;
TTypeLine typeLine;
TTypeList* typeList;
TType* field;
TTypeList* structure;
};
} interm;
}
......@@ -154,8 +154,8 @@ extern void yyerror(TParseContext* context, const char* reason);
%type <interm.type> type_qualifier fully_specified_type type_specifier
%type <interm.type> type_specifier_no_prec type_specifier_nonarray
%type <interm.type> struct_specifier
%type <interm.typeLine> struct_declarator
%type <interm.typeList> struct_declarator_list struct_declaration struct_declaration_list
%type <interm.field> struct_declarator
%type <interm> struct_declarator_list struct_declaration struct_declaration_list
%type <interm.function> function_header function_declarator function_identifier
%type <interm.function> function_header_with_parameters function_call_header
%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
......@@ -384,7 +384,7 @@ postfix_expression
} else {
unsigned int i;
for (i = 0; i < fields->size(); ++i) {
if ((*fields)[i].type->getFieldName() == *$3.string) {
if ((*fields)[i]->getFieldName() == *$3.string) {
fieldFound = true;
break;
}
......@@ -397,7 +397,7 @@ postfix_expression
$$ = $1;
}
else {
$$->setType(*(*fields)[i].type);
$$->setType(*(*fields)[i]);
// change the qualifier of the return type, not of the structure field
// as the structure definition is shared between various structures.
$$->getTypePointer()->setQualifier(EvqConst);
......@@ -405,9 +405,9 @@ postfix_expression
} else {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, $3.line);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i], $3.line);
$$ = context->intermediate.addIndex(EOpIndexDirectStruct, $1, index, $2.line);
$$->setType(*(*fields)[i].type);
$$->setType(*(*fields)[i]);
}
} else {
context->error($2.line, " no such field in structure", $3.string->c_str());
......@@ -1698,7 +1698,7 @@ struct_specifier
if (context->reservedErrorCheck($2.line, *$2.string))
context->recover();
TType* structure = new TType($5, *$2.string);
TType* structure = new TType($5.structure, *$2.string);
TVariable* userTypeDef = new TVariable($2.string, *structure, true);
if (! context->symbolTable.insert(*userTypeDef)) {
context->error($2.line, "redefinition", $2.string->c_str(), "struct");
......@@ -1709,7 +1709,7 @@ struct_specifier
context->exitStructDeclaration();
}
| STRUCT LEFT_BRACE { if (context->enterStructDeclaration($2.line, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
TType* structure = new TType($4, TString(""));
TType* structure = new TType($4.structure, TString(""));
$$.setBasic(EbtStruct, EvqTemporary, $1.line);
$$.userDef = structure;
context->exitStructDeclaration();
......@@ -1722,14 +1722,15 @@ struct_declaration_list
}
| struct_declaration_list struct_declaration {
$$ = $1;
for (unsigned int i = 0; i < $2->size(); ++i) {
for (unsigned int j = 0; j < $$->size(); ++j) {
if ((*$$)[j].type->getFieldName() == (*$2)[i].type->getFieldName()) {
context->error((*$2)[i].line, "duplicate field name in structure:", "struct", (*$2)[i].type->getFieldName().c_str());
for (size_t i = 0; i < $2.structure->size(); ++i) {
TType* field = (*$2.structure)[i];
for (size_t j = 0; j < $$.structure->size(); ++j) {
if ((*$$.structure)[j]->getFieldName() == field->getFieldName()) {
context->error($2.line, "duplicate field name in structure:", "struct", field->getFieldName().c_str());
context->recover();
}
}
$$->push_back((*$2)[i]);
$$.structure->push_back(field);
}
}
;
......@@ -1738,14 +1739,14 @@ struct_declaration
: type_specifier struct_declarator_list SEMICOLON {
$$ = $2;
if (context->voidErrorCheck($1.line, (*$2)[0].type->getFieldName(), $1)) {
if (context->voidErrorCheck($1.line, (*$2.structure)[0]->getFieldName(), $1)) {
context->recover();
}
for (unsigned int i = 0; i < $$->size(); ++i) {
for (unsigned int i = 0; i < $$.structure->size(); ++i) {
//
// Careful not to replace already known aspects of type, like array-ness
//
TType* type = (*$$)[i].type;
TType* type = (*$$.structure)[i];
type->setBasicType($1.type);
type->setNominalSize($1.size);
type->setMatrix($1.matrix);
......@@ -1772,11 +1773,11 @@ struct_declaration
struct_declarator_list
: struct_declarator {
$$ = NewPoolTTypeList();
$$->push_back($1);
$$.structure = NewPoolTTypeList();
$$.structure->push_back($1);
}
| struct_declarator_list COMMA struct_declarator {
$$->push_back($3);
$$.structure->push_back($3);
}
;
......@@ -1785,22 +1786,20 @@ struct_declarator
if (context->reservedErrorCheck($1.line, *$1.string))
context->recover();
$$.type = new TType(EbtVoid, EbpUndefined);
$$.line = $1.line;
$$.type->setFieldName(*$1.string);
$$ = new TType(EbtVoid, EbpUndefined);
$$->setFieldName(*$1.string);
}
| identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
if (context->reservedErrorCheck($1.line, *$1.string))
context->recover();
$$.type = new TType(EbtVoid, EbpUndefined);
$$.line = $1.line;
$$.type->setFieldName(*$1.string);
$$ = new TType(EbtVoid, EbpUndefined);
$$->setFieldName(*$1.string);
int size;
if (context->arraySizeErrorCheck($2.line, $3, size))
context->recover();
$$.type->setArraySize(size);
$$->setArraySize(size);
}
;
......
......@@ -255,8 +255,8 @@ typedef union YYSTYPE
TQualifier qualifier;
TFunction* function;
TParameter param;
TTypeLine typeLine;
TTypeList* typeList;
TType* field;
TTypeList* structure;
};
} interm;
......@@ -699,13 +699,13 @@ static const yytype_uint16 yyrline[] =
1520, 1530, 1537, 1540, 1543, 1549, 1552, 1567, 1571, 1575,
1579, 1588, 1593, 1598, 1603, 1608, 1613, 1618, 1623, 1628,
1633, 1639, 1645, 1651, 1656, 1661, 1670, 1679, 1684, 1697,
1697, 1711, 1711, 1720, 1723, 1738, 1774, 1778, 1784, 1792,
1808, 1812, 1816, 1817, 1823, 1824, 1825, 1826, 1827, 1831,
1832, 1832, 1832, 1842, 1843, 1847, 1847, 1848, 1848, 1853,
1856, 1866, 1869, 1875, 1876, 1880, 1888, 1892, 1902, 1907,
1924, 1924, 1929, 1929, 1936, 1936, 1944, 1947, 1953, 1956,
1962, 1966, 1973, 1980, 1987, 1994, 2005, 2014, 2018, 2025,
2028, 2034, 2034
1697, 1711, 1711, 1720, 1723, 1739, 1775, 1779, 1785, 1792,
1807, 1811, 1815, 1816, 1822, 1823, 1824, 1825, 1826, 1830,
1831, 1831, 1831, 1841, 1842, 1846, 1846, 1847, 1847, 1852,
1855, 1865, 1868, 1874, 1875, 1879, 1887, 1891, 1901, 1906,
1923, 1923, 1928, 1928, 1935, 1935, 1943, 1946, 1952, 1955,
1961, 1965, 1972, 1979, 1986, 1993, 2004, 2013, 2017, 2024,
2027, 2033, 2033
};
#endif
......@@ -2354,7 +2354,7 @@ yyreduce:
} else {
unsigned int i;
for (i = 0; i < fields->size(); ++i) {
if ((*fields)[i].type->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
if ((*fields)[i]->getFieldName() == *(yyvsp[(3) - (3)].lex).string) {
fieldFound = true;
break;
}
......@@ -2367,7 +2367,7 @@ yyreduce:
(yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
}
else {
(yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
(yyval.interm.intermTypedNode)->setType(*(*fields)[i]);
// change the qualifier of the return type, not of the structure field
// as the structure definition is shared between various structures.
(yyval.interm.intermTypedNode)->getTypePointer()->setQualifier(EvqConst);
......@@ -2375,9 +2375,9 @@ yyreduce:
} else {
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i].type, (yyvsp[(3) - (3)].lex).line);
TIntermTyped* index = context->intermediate.addConstantUnion(unionArray, *(*fields)[i], (yyvsp[(3) - (3)].lex).line);
(yyval.interm.intermTypedNode) = context->intermediate.addIndex(EOpIndexDirectStruct, (yyvsp[(1) - (3)].interm.intermTypedNode), index, (yyvsp[(2) - (3)].lex).line);
(yyval.interm.intermTypedNode)->setType(*(*fields)[i].type);
(yyval.interm.intermTypedNode)->setType(*(*fields)[i]);
}
} else {
context->error((yyvsp[(2) - (3)].lex).line, " no such field in structure", (yyvsp[(3) - (3)].lex).string->c_str());
......@@ -3955,7 +3955,7 @@ yyreduce:
if (context->reservedErrorCheck((yyvsp[(2) - (6)].lex).line, *(yyvsp[(2) - (6)].lex).string))
context->recover();
TType* structure = new TType((yyvsp[(5) - (6)].interm.typeList), *(yyvsp[(2) - (6)].lex).string);
TType* structure = new TType((yyvsp[(5) - (6)].interm).structure, *(yyvsp[(2) - (6)].lex).string);
TVariable* userTypeDef = new TVariable((yyvsp[(2) - (6)].lex).string, *structure, true);
if (! context->symbolTable.insert(*userTypeDef)) {
context->error((yyvsp[(2) - (6)].lex).line, "redefinition", (yyvsp[(2) - (6)].lex).string->c_str(), "struct");
......@@ -3975,7 +3975,7 @@ yyreduce:
case 142:
{
TType* structure = new TType((yyvsp[(4) - (5)].interm.typeList), TString(""));
TType* structure = new TType((yyvsp[(4) - (5)].interm).structure, TString(""));
(yyval.interm.type).setBasic(EbtStruct, EvqTemporary, (yyvsp[(1) - (5)].lex).line);
(yyval.interm.type).userDef = structure;
context->exitStructDeclaration();
......@@ -3985,22 +3985,23 @@ yyreduce:
case 143:
{
(yyval.interm.typeList) = (yyvsp[(1) - (1)].interm.typeList);
(yyval.interm) = (yyvsp[(1) - (1)].interm);
}
break;
case 144:
{
(yyval.interm.typeList) = (yyvsp[(1) - (2)].interm.typeList);
for (unsigned int i = 0; i < (yyvsp[(2) - (2)].interm.typeList)->size(); ++i) {
for (unsigned int j = 0; j < (yyval.interm.typeList)->size(); ++j) {
if ((*(yyval.interm.typeList))[j].type->getFieldName() == (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName()) {
context->error((*(yyvsp[(2) - (2)].interm.typeList))[i].line, "duplicate field name in structure:", "struct", (*(yyvsp[(2) - (2)].interm.typeList))[i].type->getFieldName().c_str());
(yyval.interm) = (yyvsp[(1) - (2)].interm);
for (size_t i = 0; i < (yyvsp[(2) - (2)].interm).structure->size(); ++i) {
TType* field = (*(yyvsp[(2) - (2)].interm).structure)[i];
for (size_t j = 0; j < (yyval.interm).structure->size(); ++j) {
if ((*(yyval.interm).structure)[j]->getFieldName() == field->getFieldName()) {
context->error((yyvsp[(2) - (2)].interm).line, "duplicate field name in structure:", "struct", field->getFieldName().c_str());
context->recover();
}
}
(yyval.interm.typeList)->push_back((*(yyvsp[(2) - (2)].interm.typeList))[i]);
(yyval.interm).structure->push_back(field);
}
}
break;
......@@ -4008,16 +4009,16 @@ yyreduce:
case 145:
{
(yyval.interm.typeList) = (yyvsp[(2) - (3)].interm.typeList);
(yyval.interm) = (yyvsp[(2) - (3)].interm);
if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm.typeList))[0].type->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
if (context->voidErrorCheck((yyvsp[(1) - (3)].interm.type).line, (*(yyvsp[(2) - (3)].interm).structure)[0]->getFieldName(), (yyvsp[(1) - (3)].interm.type))) {
context->recover();
}
for (unsigned int i = 0; i < (yyval.interm.typeList)->size(); ++i) {
for (unsigned int i = 0; i < (yyval.interm).structure->size(); ++i) {
//
// Careful not to replace already known aspects of type, like array-ness
//
TType* type = (*(yyval.interm.typeList))[i].type;
TType* type = (*(yyval.interm).structure)[i];
type->setBasicType((yyvsp[(1) - (3)].interm.type).type);
type->setNominalSize((yyvsp[(1) - (3)].interm.type).size);
type->setMatrix((yyvsp[(1) - (3)].interm.type).matrix);
......@@ -4045,15 +4046,15 @@ yyreduce:
case 146:
{
(yyval.interm.typeList) = NewPoolTTypeList();
(yyval.interm.typeList)->push_back((yyvsp[(1) - (1)].interm.typeLine));
(yyval.interm).structure = NewPoolTTypeList();
(yyval.interm).structure->push_back((yyvsp[(1) - (1)].interm.field));
}
break;
case 147:
{
(yyval.interm.typeList)->push_back((yyvsp[(3) - (3)].interm.typeLine));
(yyval.interm).structure->push_back((yyvsp[(3) - (3)].interm.field));
}
break;
......@@ -4063,9 +4064,8 @@ yyreduce:
if (context->reservedErrorCheck((yyvsp[(1) - (1)].lex).line, *(yyvsp[(1) - (1)].lex).string))
context->recover();
(yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
(yyval.interm.typeLine).line = (yyvsp[(1) - (1)].lex).line;
(yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (1)].lex).string);
(yyval.interm.field) = new TType(EbtVoid, EbpUndefined);
(yyval.interm.field)->setFieldName(*(yyvsp[(1) - (1)].lex).string);
}
break;
......@@ -4075,14 +4075,13 @@ yyreduce:
if (context->reservedErrorCheck((yyvsp[(1) - (4)].lex).line, *(yyvsp[(1) - (4)].lex).string))
context->recover();
(yyval.interm.typeLine).type = new TType(EbtVoid, EbpUndefined);
(yyval.interm.typeLine).line = (yyvsp[(1) - (4)].lex).line;
(yyval.interm.typeLine).type->setFieldName(*(yyvsp[(1) - (4)].lex).string);
(yyval.interm.field) = new TType(EbtVoid, EbpUndefined);
(yyval.interm.field)->setFieldName(*(yyvsp[(1) - (4)].lex).string);
int size;
if (context->arraySizeErrorCheck((yyvsp[(2) - (4)].lex).line, (yyvsp[(3) - (4)].interm.intermTypedNode), size))
context->recover();
(yyval.interm.typeLine).type->setArraySize(size);
(yyval.interm.field)->setArraySize(size);
}
break;
......
......@@ -172,8 +172,8 @@ typedef union YYSTYPE
TQualifier qualifier;
TFunction* function;
TParameter param;
TTypeLine typeLine;
TTypeList* typeList;
TType* field;
TTypeList* structure;
};
} interm;
......
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