Throw away our dummy usertypes from the parse phase.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 11 Jan 2011 20:39:09 -0500
changeset 971 58dcafbc908b
parent 970 108ca3392d46
child 972 993c4d6e21a8
Throw away our dummy usertypes from the parse phase. They are incorrect, and need to be correctly built during semantic analysis.
mojoshader_compiler.c
--- a/mojoshader_compiler.c	Tue Jan 11 03:37:38 2011 -0500
+++ b/mojoshader_compiler.c	Tue Jan 11 20:39:09 2011 -0500
@@ -3037,6 +3037,8 @@
 
     // !!! FIXME: check if (parser == NULL)...
 
+    SymbolScope *start_scope = ctx->usertypes.scope;
+
     #if DEBUG_COMPILER_PARSER
     ParseHLSLTrace(stdout, "COMPILER: ");
     #endif
@@ -3165,6 +3167,10 @@
             pop_scope(ctx);
     } while (tokenval != TOKEN_EOI);
 
+    // Clean out extra usertypes; they are dummies until semantic analysis.
+    while (ctx->usertypes.scope != start_scope)
+        pop_symbol(ctx, &ctx->usertypes);
+
     ParseHLSLFree(parser, ctx->free, ctx->malloc_data);
     preprocessor_end(pp);
 } // parse_source