summaryrefslogtreecommitdiff
path: root/glsl_symbol_table.h
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-19 15:37:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-03-19 15:37:01 -0700
commitac4fdc255ba82b96cc867f084f6b781d6e95136b (patch)
treee7352dfd4da6591d342ea9947ce005cfa0bdc49a /glsl_symbol_table.h
parent38395c1aad82abdeecbd66bca8daaa6f431c920c (diff)
Add query to determine whether a name was declared at this scope
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.
Diffstat (limited to 'glsl_symbol_table.h')
-rw-r--r--glsl_symbol_table.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/glsl_symbol_table.h b/glsl_symbol_table.h
index ad3ccf06ef..26b90fdb7c 100644
--- a/glsl_symbol_table.h
+++ b/glsl_symbol_table.h
@@ -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