Zebediah Figura : d3dcompiler: Get rid of the superfluous "variable" rule.

Alexandre Julliard julliard at winehq.org
Fri Aug 9 14:49:32 CDT 2019


Module: wine
Branch: master
Commit: f9f1e99099a03fff4e29991f8aebf2b84f2bcc99
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f9f1e99099a03fff4e29991f8aebf2b84f2bcc99

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Fri Aug  9 09:52:44 2019 -0500

d3dcompiler: Get rid of the superfluous "variable" rule.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dcompiler_43/hlsl.y | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 4ece669..ba0fd5c 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -913,7 +913,6 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr
     BOOL boolval;
     char *name;
     DWORD modifiers;
-    struct hlsl_ir_var *var;
     struct hlsl_ir_node *instr;
     struct list *list;
     struct parse_function function;
@@ -1049,7 +1048,6 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr
 %type <list> parameters
 %type <list> param_list
 %type <instr> expr
-%type <var> variable
 %type <intval> array
 %type <list> statement
 %type <list> statement_list
@@ -1910,10 +1908,19 @@ primary_expr:             C_FLOAT
                                 c->v.value.b[0] = $1;
                                 $$ = &c->node;
                             }
-                        | variable
+                        | VAR_IDENTIFIER
                             {
-                                struct hlsl_ir_deref *deref = new_var_deref($1);
-                                if (deref)
+                                struct hlsl_ir_deref *deref;
+                                struct hlsl_ir_var *var;
+
+                                if (!(var = get_variable(hlsl_ctx.cur_scope, $1)))
+                                {
+                                    hlsl_message("Line %d: variable '%s' not declared\n",
+                                            hlsl_ctx.line_no, $1);
+                                    set_parse_status(&hlsl_ctx.status, PARSE_ERR);
+                                    return 1;
+                                }
+                                if ((deref = new_var_deref(var)))
                                 {
                                     $$ = &deref->node;
                                     set_location(&$$->loc, &@1);
@@ -1926,20 +1933,6 @@ primary_expr:             C_FLOAT
                                 $$ = $2;
                             }
 
-variable:                 VAR_IDENTIFIER
-                            {
-                                struct hlsl_ir_var *var;
-                                var = get_variable(hlsl_ctx.cur_scope, $1);
-                                if (!var)
-                                {
-                                    hlsl_message("Line %d: variable '%s' not declared\n",
-                                            hlsl_ctx.line_no, $1);
-                                    set_parse_status(&hlsl_ctx.status, PARSE_ERR);
-                                    return 1;
-                                }
-                                $$ = var;
-                            }
-
 postfix_expr:             primary_expr
                             {
                                 $$ = $1;




More information about the wine-cvs mailing list