This will make void-01.glsl test fail, so I may regret this later.
However, this will make supporting functions that return void or
functions that have a void parameter list easier to handle.
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.
Use separate namespaces for types, variables, and functions
This will allow types and their constructors to be easily stored in
the same symbol table. This does add a potential problem that a
shader could declare a variable and a function with the same name.
This appears to be forbidden by the GLSL spec.
This implementation was wrong anyway because it did not respect
scoping rules. This will need to be revisited soon. The most likely
result is that the grammar is going to need some significant re-work
to be able to use a IDENTIFIER in all the places where a TYPE_NAME is
currently used.
Add a constructor that uses an ast_struct_specifier and one that uses
a type name. This saves a (trivial) bit of code, but it also ensures
some of the class invariants (i.e., type_name != NULL) are met.
For built-in types, type_name would be NULL. This ensures that
type_name is set even for the built-in types. This simplifies code in
a few places and centralizes the name setting code.
Change type of function_identifier to silence bison warning
When the implementation of function_call_header and
function_identifier were changed a few commits ago, the types of the
production changed. This just updates the types specified for the
productions to match reality.
Add assignment side-effect to the instruction stream
The actual assignment is a side-effect of the assignment expression.
Add it to the instruction stream and return the LHS of the assignment
as its rvalue.
IR visitor: Add initial version of ir_visitor classes
The ir_visitor class is the abstract base class for all visitors.
ir_print_visitor contains the beginnings of a concrete visitor class
that will print out an IR sequence in a Lisp / Scheme-like syntax.