glsl: Move constant expression handling from calls to signatures.
[mesa.git] / src / glsl / ast_to_hir.cpp
index 75d7e9d5793079b5c5917c87323a6e13edb0628c..6210eb12de9e8cd1225015e241d20e25a23b90e6 100644 (file)
@@ -1692,14 +1692,14 @@ ast_expression::hir(exec_list *instructions,
       ir_variable *var = 
         state->symbols->get_variable(this->primary_expression.identifier);
 
-      result = new(ctx) ir_dereference_variable(var);
-
       if (var != NULL) {
         var->used = true;
+        result = new(ctx) ir_dereference_variable(var);
       } else {
         _mesa_glsl_error(& loc, state, "`%s' undeclared",
                          this->primary_expression.identifier);
 
+        result = ir_rvalue::error_value(ctx);
         error_emitted = true;
       }
       break;