Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed a misunderstanding about how the AST of a for-loop initializer …
…works.
  • Loading branch information
icculus committed Mar 3, 2011
1 parent f175b48 commit 21ce2f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions mojoshader.h
Expand Up @@ -1492,8 +1492,8 @@ typedef struct MOJOSHADER_astForStatement
MOJOSHADER_astNodeInfo ast;
MOJOSHADER_astStatement *next;
int unroll; /* # times to unroll, 0 to loop, < 0 == compiler's choice. */
MOJOSHADER_astVariableDeclaration *var_decl;
MOJOSHADER_astExpression *initializer;
MOJOSHADER_astVariableDeclaration *var_decl; /* either this ... */
MOJOSHADER_astExpression *initializer; /* ... or this will used. */
MOJOSHADER_astExpression *looptest;
MOJOSHADER_astExpression *counter;
MOJOSHADER_astStatement *statement;
Expand Down
6 changes: 1 addition & 5 deletions utils/mojoshader-compiler.c
Expand Up @@ -451,11 +451,7 @@ static void print_ast(FILE *io, const int substmt, const void *_ast)
print_unroll_attr(io, ast->forstmt.unroll);
fprintf(io, "for (");
print_ast(io, 1, ast->forstmt.var_decl);
if (ast->forstmt.initializer != NULL)
{
fprintf(io, " = ");
print_ast(io, 1, ast->forstmt.initializer);
} // if
print_ast(io, 1, ast->forstmt.initializer);
fprintf(io, "; ");
print_ast(io, 1, ast->forstmt.looptest);
fprintf(io, "; ");
Expand Down

0 comments on commit 21ce2f6

Please sign in to comment.