aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-11-08 01:36:59 +0000
committerPhilip Herron <philip.herron@embecosm.com>2021-11-16 14:19:22 +0000
commita7fb60bb626f7b936bf117636db777a5f0df30c9 (patch)
tree300c1dac1d15aff0eec5cd1e0a0f549e6fd20e78 /gcc/rust/backend/rust-compile-expr.h
parent432add899f4e436d0d30b89ef87fe19e71b36955 (diff)
downloadgcc-a7fb60bb626f7b936bf117636db777a5f0df30c9.zip
gcc-a7fb60bb626f7b936bf117636db777a5f0df30c9.tar.gz
gcc-a7fb60bb626f7b936bf117636db777a5f0df30c9.tar.bz2
Add support compound assignment operator overloads
Fixes #249
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h17
1 files changed, 1 insertions, 16 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 8ed84c7..bdcc5b6 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -388,22 +388,7 @@ public:
ctx->add_statement (assignment);
}
- void visit (HIR::CompoundAssignmentExpr &expr) override
- {
- fncontext fn = ctx->peek_fn ();
- auto lvalue = CompileExpr::Compile (expr.get_left_expr ().get (), ctx);
- auto rvalue = CompileExpr::Compile (expr.get_right_expr ().get (), ctx);
-
- auto op = expr.get_expr_type ();
- auto operator_expr = ctx->get_backend ()->arithmetic_or_logical_expression (
- op, lvalue, rvalue, expr.get_locus ());
-
- Bstatement *assignment
- = ctx->get_backend ()->assignment_statement (fn.fndecl, lvalue,
- operator_expr,
- expr.get_locus ());
- ctx->add_statement (assignment);
- }
+ void visit (HIR::CompoundAssignmentExpr &expr) override;
void visit (HIR::ArrayIndexExpr &expr) override
{