d3dcompiler: Pass the complete location to add_func_parameter().

This commit is contained in:
Matteo Bruni 2012-07-16 20:39:20 +02:00 committed by Alexandre Julliard
parent be350b0bb3
commit 7ebab8c4f7
3 changed files with 14 additions and 8 deletions

View File

@ -882,7 +882,8 @@ static inline struct hlsl_ir_constructor *constructor_from_node(const struct hls
BOOL add_declaration(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
struct hlsl_ir_var *get_variable(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
void free_declaration(struct hlsl_ir_var *decl) DECLSPEC_HIDDEN;
BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsigned int line) DECLSPEC_HIDDEN;
BOOL add_func_parameter(struct list *list, struct parse_parameter *param,
const struct source_location *loc) DECLSPEC_HIDDEN;
struct hlsl_type *new_hlsl_type(const char *name, enum hlsl_type_class type_class,
enum hlsl_base_type base_type, unsigned dimx, unsigned dimy) DECLSPEC_HIDDEN;
struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int array_size) DECLSPEC_HIDDEN;

View File

@ -430,9 +430,12 @@ parameters: scope_start
param_list: parameter
{
struct source_location loc;
$$ = d3dcompiler_alloc(sizeof(*$$));
list_init($$);
if (!add_func_parameter($$, &$1, hlsl_ctx.line_no))
set_location(&loc, &@1);
if (!add_func_parameter($$, &$1, &loc))
{
ERR("Error adding function parameter %s.\n", $1.name);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
@ -441,12 +444,14 @@ param_list: parameter
}
| param_list ',' parameter
{
struct source_location loc;
$$ = $1;
if (!add_func_parameter($$, &$3, hlsl_ctx.line_no))
set_location(&loc, &@3);
if (!add_func_parameter($$, &$3, &loc))
{
hlsl_message("Line %u: duplicate parameter %s.\n",
hlsl_ctx.line_no, $3.name);
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
"duplicate parameter %s", $3.name);
return 1;
}
}

View File

@ -805,7 +805,7 @@ void free_declaration(struct hlsl_ir_var *decl)
d3dcompiler_free(decl);
}
BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsigned int line)
BOOL add_func_parameter(struct list *list, struct parse_parameter *param, const struct source_location *loc)
{
struct hlsl_ir_var *decl = d3dcompiler_alloc(sizeof(*decl));
@ -816,7 +816,7 @@ BOOL add_func_parameter(struct list *list, struct parse_parameter *param, unsign
}
decl->node.type = HLSL_IR_VAR;
decl->node.data_type = param->type;
decl->node.loc.line = line;
decl->node.loc = *loc;
decl->name = param->name;
decl->semantic = param->semantic;
decl->modifiers = param->modifiers;