From 81bf0973b8900345fcd74b01f4a3ce90ace9f106 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 12 Jan 2011 03:39:21 -0500 Subject: [PATCH] Added some FIXMEs. --- mojoshader_compiler.c | 4 +++- mojoshader_parser_hlsl.lemon | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mojoshader_compiler.c b/mojoshader_compiler.c index ea14ff51..ae7d57f0 100644 --- a/mojoshader_compiler.c +++ b/mojoshader_compiler.c @@ -2795,6 +2795,8 @@ static const MOJOSHADER_astDataType *type_check_ast(Context *ctx, void *_ast) dt->structure.member_count = count; ast->structdecl.datatype = dt; + // !!! FIXME: this shouldn't push for anonymous structs: "struct { int x; } myvar;" + // !!! FIXME: but right now, the grammar is wrong and requires a name for the struct. push_usertype(ctx, ast->structdecl.name, ast->structdecl.datatype); return ast->structdecl.datatype; } // case @@ -4021,7 +4023,7 @@ static void parse_source(Context *ctx, const char *filename, case TOKEN_HLSL_USERTYPE: data.string = stringcache_len(ctx->strcache, token, tokenlen); - data.datatype = get_usertype(ctx, data.string); + data.datatype = get_usertype(ctx, data.string); // !!! FIXME: do we need this? It's kind of useless during parsing. assert(data.datatype != NULL); break; diff --git a/mojoshader_parser_hlsl.lemon b/mojoshader_parser_hlsl.lemon index 3308c379..6de3c6e2 100644 --- a/mojoshader_parser_hlsl.lemon +++ b/mojoshader_parser_hlsl.lemon @@ -175,6 +175,7 @@ interpolation_mod(A) ::= SAMPLE. { A = MOJOSHADER_AST_INTERPMOD_SAMPLE; } %destructor variable_declaration { delete_variable_declaration(ctx, $$); } variable_declaration(A) ::= variable_attribute_list(B) datatype(C) variable_declaration_details_list(D) SEMICOLON. { REVERSE_LINKED_LIST(MOJOSHADER_astVariableDeclaration, D); A = D; A->attributes = B; A->datatype = C; } variable_declaration(A) ::= datatype(B) variable_declaration_details_list(C) SEMICOLON. { REVERSE_LINKED_LIST(MOJOSHADER_astVariableDeclaration, C); A = C; A->datatype = B; } +// !!! FIXME: this expects "struct Identifier {} varname" ... that "Identifier" is wrong. variable_declaration(A) ::= struct_declaration(B) variable_declaration_details_list(C) SEMICOLON. { REVERSE_LINKED_LIST(MOJOSHADER_astVariableDeclaration, C); A = C; A->anonymous_datatype = B; } %type variable_attribute_list { int }