forked from qt-creator/qt-creator
Fix AST for GLSL DeclarationStatement
DeclarationStatement wraps a single declaration, not a list.
This commit is contained in:
@@ -2528,7 +2528,7 @@ case $rule_number: {
|
|||||||
declaration_statement ::= declaration ;
|
declaration_statement ::= declaration ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
ast(1) = makeAstNode<DeclarationStatementAST>(sym(1).declaration_list);
|
ast(1) = makeAstNode<DeclarationStatementAST>(sym(1).declaration);
|
||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ void CaseLabelStatementAST::accept0(Visitor *visitor)
|
|||||||
void DeclarationStatementAST::accept0(Visitor *visitor)
|
void DeclarationStatementAST::accept0(Visitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this))
|
if (visitor->visit(this))
|
||||||
accept(decls, visitor);
|
accept(decl, visitor);
|
||||||
visitor->endVisit(this);
|
visitor->endVisit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -642,15 +642,15 @@ public: // attributes
|
|||||||
class GLSL_EXPORT DeclarationStatementAST: public StatementAST
|
class GLSL_EXPORT DeclarationStatementAST: public StatementAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeclarationStatementAST(List<DeclarationAST *> *_decls)
|
DeclarationStatementAST(DeclarationAST *_decl)
|
||||||
: StatementAST(Kind_DeclarationStatement), decls(finish(_decls)) {}
|
: StatementAST(Kind_DeclarationStatement), decl(_decl) {}
|
||||||
|
|
||||||
virtual DeclarationStatementAST *asDeclarationStatement() { return this; }
|
virtual DeclarationStatementAST *asDeclarationStatement() { return this; }
|
||||||
|
|
||||||
virtual void accept0(Visitor *visitor);
|
virtual void accept0(Visitor *visitor);
|
||||||
|
|
||||||
public: // attributes
|
public: // attributes
|
||||||
List<DeclarationAST *> *decls;
|
DeclarationAST *decl;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GLSL_EXPORT TypeAST: public AST
|
class GLSL_EXPORT TypeAST: public AST
|
||||||
|
|||||||
@@ -1865,7 +1865,7 @@ case 260: {
|
|||||||
#line 2529 "./glsl.g"
|
#line 2529 "./glsl.g"
|
||||||
|
|
||||||
case 261: {
|
case 261: {
|
||||||
ast(1) = makeAstNode<DeclarationStatementAST>(sym(1).declaration_list);
|
ast(1) = makeAstNode<DeclarationStatementAST>(sym(1).declaration);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
#line 2536 "./glsl.g"
|
#line 2536 "./glsl.g"
|
||||||
|
|||||||
@@ -281,10 +281,7 @@ bool Semantic::visit(CaseLabelStatementAST *ast)
|
|||||||
|
|
||||||
bool Semantic::visit(DeclarationStatementAST *ast)
|
bool Semantic::visit(DeclarationStatementAST *ast)
|
||||||
{
|
{
|
||||||
for (List<DeclarationAST *> *it = ast->decls; it; it = it->next) {
|
declaration(ast->decl);
|
||||||
DeclarationAST *decl = it->value;
|
|
||||||
declaration(decl);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user