Skip to content

Commit

Permalink
Minor tweaks in case I expose semantic analysis phase to the public A…
Browse files Browse the repository at this point in the history
…PI later.
  • Loading branch information
icculus committed Feb 23, 2011
1 parent 0c6edb8 commit 7b758ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mojoshader.h
Expand Up @@ -1734,6 +1734,10 @@ const MOJOSHADER_astData *MOJOSHADER_parseAst(const char *srcprofile,
MOJOSHADER_malloc m, MOJOSHADER_free f,
void *d);


/* !!! FIXME: expose semantic analysis to the public API? */


/*
* Call this to dispose of AST parsing results when you are done with them.
* This will call the MOJOSHADER_free function you provided to
Expand Down
10 changes: 9 additions & 1 deletion utils/mojoshader-compiler.c
Expand Up @@ -171,8 +171,16 @@ static void print_ast_datatype(FILE *io, const MOJOSHADER_astDataType *dt)
fprintf(io, "%s", dt->user.name);
return;

// this should only appear if we did semantic analysis on the AST,
// so we only print the return value here.
case MOJOSHADER_AST_DATATYPE_FUNCTION:
if (!dt->function.retval)
fprintf(io, "void");
else
print_ast_datatype(io, dt->function.retval);
return;

//case MOJOSHADER_AST_DATATYPE_NONE:
//case MOJOSHADER_AST_DATATYPE_FUNCTION:
default:
assert(0 && "Unexpected datatype.");
return;
Expand Down

0 comments on commit 7b758ff

Please sign in to comment.