Make ast_function_expression subclass of ast_expression
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 21:26:52 +0000 (13:26 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Mar 2010 21:26:52 +0000 (13:26 -0800)
ast.h
ast_to_hir.cpp
glsl_parser.ypp

diff --git a/ast.h b/ast.h
index 3eb8e5f20fdf13d280364d463a392fe36a701c5a..cd5bf6b3f5f1dd92b9902e51d48125ca596d56b1 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -192,6 +192,23 @@ public:
    virtual void print(void) const;
 };
 
+/**
+ * Subclass of expressions for function calls
+ */
+class ast_function_expression : public ast_expression {
+public:
+   ast_function_expression(ast_node *callee)
+      : ast_expression(ast_function_call, (ast_expression *) callee,
+                      NULL, NULL)
+   {
+      /* empty */
+   }
+
+
+   virtual ir_instruction *hir(exec_list *instructions,
+                              struct _mesa_glsl_parse_state *state);
+};
+
 
 /**
  * Number of possible operators for an ast_expression
index 1379ec9801357c2ef4b70adaef9f390b3f580f9e..3c4b69fdc241f37de0630835c1640946136167a2 100644 (file)
@@ -630,21 +630,10 @@ ast_expression::hir(exec_list *instructions,
       break;
 
    case ast_function_call:
-      /* There are three sorts of function calls.
-       *
-       * 1. contstructors - The first subexpression is an ast_type_specifier.
-       * 2. methods - Only the .length() method of array types.
-       * 3. functions - Calls to regular old functions.
-       *
-       * Method calls are actually detected when the ast_field_selection
-       * expression is handled.
+      /* Should *NEVER* get here.  ast_function_call should always be handled
+       * by ast_function_expression::hir.
        */
-#if 0
-      result = _mesa_ast_function_call_to_hir(this->subexpressions[0],
-                                             this->subexpressions[1],
-                                             state);
-      type = result->type;
-#endif
+      assert(0);
       break;
 
    case ast_identifier: {
@@ -721,6 +710,24 @@ ast_expression::hir(exec_list *instructions,
 }
 
 
+ir_instruction *
+ast_function_expression::hir(exec_list *instructions,
+                            struct _mesa_glsl_parse_state *state)
+{
+   /* There are three sorts of function calls.
+    *
+    * 1. contstructors - The first subexpression is an ast_type_specifier.
+    * 2. methods - Only the .length() method of array types.
+    * 3. functions - Calls to regular old functions.
+    *
+    * Method calls are actually detected when the ast_field_selection
+    * expression is handled.
+    */
+   (void) instructions;
+   (void) state;
+   return NULL;
+}
+
 ir_instruction *
 ast_expression_statement::hir(exec_list *instructions,
                              struct _mesa_glsl_parse_state *state)
index debbcea9366cd21a42cf0494e5b8397986f3f3c6..2f337b127c53e58c78acb1e69ef01a0c04a82fe4 100644 (file)
@@ -338,9 +338,7 @@ function_call_header_with_parameters:
 function_call_header:
        function_identifier '('
        {
-          $$ = new ast_expression(ast_function_call,
-                                  (struct ast_expression *) $1,
-                                  NULL, NULL);
+          $$ = new ast_function_expression($1);
        }
        ;