Add query to determine whether a name was declared at this scope
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 19 Mar 2010 22:37:01 +0000 (15:37 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 19 Mar 2010 22:37:01 +0000 (15:37 -0700)
This will be used to prevent a variable and a function with the same
name from being declared.  As a side effect, the calls to
add_{type,name,function} should never fail.

glsl_symbol_table.h

index ad3ccf0..26b90fd 100644 (file)
@@ -66,6 +66,14 @@ public:
    }
 
    /**
+    * Determine whether a name was declared at the current scope
+    */
+   bool name_declared_this_scope(const char *name)
+   {
+      return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
+   }
+
+   /**
     * \name Methods to add symbols to the table
     *
     * There is some temptation to rename all these functions to \c add_symbol