Module: wine Branch: master Commit: 1252930bc0a2b12604bc8e5ae350e985b36e6514 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1252930bc0a2b12604bc8e5ae3...
Author: Matteo Bruni mbruni@codeweavers.com Date: Mon Jul 16 20:39:21 2012 +0200
d3dcompiler: Variables and functions can't have the same name.
---
dlls/d3dcompiler_43/hlsl.y | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y index b421402..eedf357 100644 --- a/dlls/d3dcompiler_43/hlsl.y +++ b/dlls/d3dcompiler_43/hlsl.y @@ -132,8 +132,17 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local) "modifier '%s' invalid for local variables", debug_modifiers(invalid)); } } + else + { + if (find_function(decl->name)) + { + hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR, + "redefinition of '%s'", decl->name); + return FALSE; + } + } ret = add_declaration(hlsl_ctx.cur_scope, decl, local); - if (ret == FALSE) + if (!ret) { struct hlsl_ir_var *old = get_variable(hlsl_ctx.cur_scope, decl->name);
@@ -381,6 +390,13 @@ func_declaration: func_prototype compound_statement
func_prototype: var_modifiers type var_identifier '(' parameters ')' semantic { + if (get_variable(hlsl_ctx.globals, $3)) + { + hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column, + HLSL_LEVEL_ERROR, "redefinition of '%s'\n", $3); + return 1; + } + $$ = new_func_decl($3, $2, $5); if (!$$) {