From ac4fdc255ba82b96cc867f084f6b781d6e95136b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 19 Mar 2010 15:37:01 -0700 Subject: [PATCH] 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. --- glsl_symbol_table.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/glsl_symbol_table.h b/glsl_symbol_table.h index ad3ccf06efe..26b90fdb7c6 100644 --- a/glsl_symbol_table.h +++ b/glsl_symbol_table.h @@ -65,6 +65,14 @@ public: _mesa_symbol_table_pop_scope(table); } + /** + * 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 * -- 2.30.2