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