Minor tweaks in case I expose semantic analysis phase to the public API later.
--- a/mojoshader.h Tue Feb 22 02:51:33 2011 -0500
+++ b/mojoshader.h Wed Feb 23 16:45:06 2011 -0500
@@ -1734,6 +1734,10 @@
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
--- a/utils/mojoshader-compiler.c Tue Feb 22 02:51:33 2011 -0500
+++ b/utils/mojoshader-compiler.c Wed Feb 23 16:45:06 2011 -0500
@@ -171,8 +171,16 @@
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;