Browse Source

glsl: Add an is_declaration field to ast_struct_specifier.

Will be used in a later commit to differentiate between a structure type
declaration and a variable declaration of a struct type. I.e., the
difference between

   struct S { float x; }; (is_declaration = true)

and

   S s;                   (is_declaration = false)

Also note that is_declaration = true for

   struct S { float x; } s;

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
tags/mesa-9.2-rc1
Matt Turner 12 years ago
parent
commit
8d45caaeba
2 changed files with 4 additions and 1 deletions
  1. 3
    1
      src/glsl/ast.h
  2. 1
    0
      src/glsl/glsl_parser_extras.cpp

+ 3
- 1
src/glsl/ast.h View File

* be modified. Zeros the inherited ast_node's fields. * be modified. Zeros the inherited ast_node's fields.
*/ */
ast_struct_specifier(const ast_struct_specifier& that): ast_struct_specifier(const ast_struct_specifier& that):
ast_node(), name(that.name), declarations(that.declarations)
ast_node(), name(that.name), declarations(that.declarations),
is_declaration(that.is_declaration)
{ {
/* empty */ /* empty */
} }
const char *name; const char *name;
/* List of ast_declarator_list * */ /* List of ast_declarator_list * */
exec_list declarations; exec_list declarations;
bool is_declaration;
}; };





+ 1
- 0
src/glsl/glsl_parser_extras.cpp View File

} }
name = identifier; name = identifier;
this->declarations.push_degenerate_list_at_head(&declarator_list->link); this->declarations.push_degenerate_list_at_head(&declarator_list->link);
is_declaration = true;
} }


extern "C" { extern "C" {

Loading…
Cancel
Save