diff options
author | Eric Anholt <eric@anholt.net> | 2010-03-26 11:57:46 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-26 17:51:41 -0700 |
commit | 48a0e64b7d6a4308f9c691e5844165ec97f8282e (patch) | |
tree | c7b2c617462d6323e8fbacfb5f6f45b26cbd92db | |
parent | 10a685218610e737e23d2d8a243ed6ff6613becd (diff) |
Add support for %= in ast_to_hir.
-rw-r--r-- | ast_to_hir.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index a75177dcc8..6fe7da646b 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -602,7 +602,26 @@ ast_expression::hir(exec_list *instructions, break; } - case ast_mod_assign: + case ast_mod_assign: { + op[0] = this->subexpressions[0]->hir(instructions, state); + op[1] = this->subexpressions[1]->hir(instructions, state); + + error_emitted = op[0]->type->is_error() || op[1]->type->is_error(); + + type = modulus_result_type(op[0]->type, op[1]->type); + + assert(operations[this->oper] == ir_binop_mod); + + struct ir_rvalue *temp_rhs; + temp_rhs = new ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, op[0], temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } case ast_ls_assign: case ast_rs_assign: |