diff options
author | Philip Herron <philip.herron@embecosm.com> | 2020-12-21 18:32:15 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2020-12-23 13:04:50 +0000 |
commit | aa2fbb5e48f6218035d7bde1336345cebf120d3e (patch) | |
tree | e69dd540813c69f43fc05a76d33395a896791292 /gcc/rust/backend/rust-compile-expr.h | |
parent | b021811ab700156e1e3d56200d585b3180264f4f (diff) | |
download | gcc-aa2fbb5e48f6218035d7bde1336345cebf120d3e.zip gcc-aa2fbb5e48f6218035d7bde1336345cebf120d3e.tar.gz gcc-aa2fbb5e48f6218035d7bde1336345cebf120d3e.tar.bz2 |
Bring conditionals back since the HIR change.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index 7808af2..854fe5e 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -22,6 +22,7 @@ #include "rust-compile-base.h" #include "rust-compile-tyty.h" #include "rust-compile-resolve-path.h" +#include "rust-compile-block.h" namespace Rust { namespace Compile { @@ -273,6 +274,31 @@ public: expr.get_locus ()); } + void visit (HIR::IfExpr &expr) + { + auto stmt = CompileConditionalBlocks::compile (&expr, ctx); + ctx->add_statement (stmt); + } + + void visit (HIR::IfExprConseqElse &expr) + { + auto stmt = CompileConditionalBlocks::compile (&expr, ctx); + ctx->add_statement (stmt); + } + + void visit (HIR::IfExprConseqIf &expr) + { + auto stmt = CompileConditionalBlocks::compile (&expr, ctx); + ctx->add_statement (stmt); + } + + void visit (HIR::BlockExpr &expr) + { + auto code_block = CompileBlock::compile (&expr, ctx); + auto block_stmt = ctx->get_backend ()->block_statement (code_block); + ctx->add_statement (block_stmt); + } + private: CompileExpr (Context *ctx) : HIRCompileBase (ctx), translated (nullptr) {} |