Simplified constructor for identifier expressions
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 21:25:56 +0000 (13:25 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 21:25:56 +0000 (13:25 -0800)
ast.h
glsl_parser.ypp

diff --git a/ast.h b/ast.h
index 363169209266fa63c7a122650be9b5d3e2c8b6bb..3eb8e5f20fdf13d280364d463a392fe36a701c5a 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -150,6 +150,15 @@ public:
    ast_expression(int oper, ast_expression *,
                  ast_expression *, ast_expression *);
 
+   ast_expression(const char *identifier) :
+      oper(ast_identifier)
+   {
+      subexpressions[0] = NULL;
+      subexpressions[1] = NULL;
+      subexpressions[2] = NULL;
+      primary_expression.identifier = (char *) identifier;
+   }
+
    static const char *operator_string(enum ast_operators op);
 
    virtual ir_instruction *hir(exec_list *instructions,
index c755725458112335aaae221486995c368228f689..debbcea9366cd21a42cf0494e5b8397986f3f3c6 100644 (file)
@@ -351,19 +351,11 @@ function_identifier:
        }
        | IDENTIFIER
        {
-          ast_expression *expr =
-             new ast_expression(ast_identifier, NULL, NULL, NULL);
-          expr->primary_expression.identifier = $1;
-
-          $$ = (struct ast_node *) expr;
+          $$ = new ast_expression($1);
        }
        | FIELD_SELECTION
        {
-          ast_expression *expr =
-             new ast_expression(ast_identifier, NULL, NULL, NULL);
-          expr->primary_expression.identifier = $1;
-
-          $$ = (struct ast_node *) expr;
+          $$ = new ast_expression($1);
        }
        ;