summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-14 15:38:52 -0700
committerEric Anholt <eric@anholt.net>2010-04-14 15:38:52 -0700
commit8558459512594216c5aed0bb8d2b0efcbc8b921c (patch)
treeeb8a5210bd9a6e35b5c737378e7754f688773e58 /ast_to_hir.cpp
parent3b8d2cd77901f7ec91d1b9d1a67536aea9aedca1 (diff)
Return the rvalue of a variable decl to fix while (bool b = condition) {}
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index aa9a3a1a04..4e1c819177 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1358,7 +1358,7 @@ ast_declarator_list::hir(exec_list *instructions,
struct simple_node *ptr;
const struct glsl_type *decl_type;
const char *type_name = NULL;
-
+ ir_rvalue *result = NULL;
/* FINISHME: Handle vertex shader "invariant" declarations that do not
* FINISHME: include a type. These re-declare built-in variables to be
@@ -1619,8 +1619,8 @@ ast_declarator_list::hir(exec_list *instructions,
bool temp = var->read_only;
if (this->type->qualifier.constant)
var->read_only = false;
- (void) do_assignment(instructions, state, lhs, rhs,
- this->get_location());
+ result = do_assignment(instructions, state, lhs, rhs,
+ this->get_location());
var->read_only = temp;
}
}
@@ -1650,9 +1650,17 @@ ast_declarator_list::hir(exec_list *instructions,
assert(added_variable);
}
- /* Variable declarations do not have r-values.
+
+ /* Generally, variable declarations do not have r-values. However,
+ * one is used for the declaration in
+ *
+ * while (bool b = some_condition()) {
+ * ...
+ * }
+ *
+ * so we return the rvalue from the last seen declaration here.
*/
- return NULL;
+ return result;
}