summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-03-09 16:38:02 -0800
committerIan Romanick <ian.d.romanick@intel.com>2010-03-09 16:38:02 -0800
commit6652af36fe8994b1621d882fcc230d320908a2a3 (patch)
treefe094bff4f29d064c0684924cdf75148e806cc41 /ast_to_hir.cpp
parent78b51b0fdd61b58940f9043ef9046217552f2c70 (diff)
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.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index 5811d73586..faa13abd59 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -398,7 +398,7 @@ ast_expression::hir(exec_list *instructions,
make_empty_list(& op_list);
switch (this->oper) {
- case ast_assign:
+ case ast_assign: {
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
@@ -437,8 +437,12 @@ ast_expression::hir(exec_list *instructions,
/* FINISHME: Check that the LHS and RHS have matching types. */
/* FINISHME: For GLSL 1.10, check that the types are not arrays. */
- result = new ir_assignment(op[0], op[1], NULL);
+ ir_instruction *tmp = new ir_assignment(op[0], op[1], NULL);
+ instructions->push_tail(tmp);
+
+ result = op[0];
break;
+ }
case ast_plus:
op[0] = this->subexpressions[0]->hir(instructions, state);