aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-block.h
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2021-02-07 12:40:19 +0800
committerSimplyTheOther <simplytheother@gmail.com>2021-02-07 12:40:19 +0800
commit94be91d6159101caa7c560b188bd6c02d8d86d17 (patch)
treeb3c32de54db1a850079f79d3dfb4c4000dec9d90 /gcc/rust/backend/rust-compile-block.h
parent27eef5b7a065e8ea05ac575c4b364bb5dbc44e46 (diff)
parentdb7134353447921136a321b8fd78cea78f2c344e (diff)
downloadgcc-94be91d6159101caa7c560b188bd6c02d8d86d17.zip
gcc-94be91d6159101caa7c560b188bd6c02d8d86d17.tar.gz
gcc-94be91d6159101caa7c560b188bd6c02d8d86d17.tar.bz2
Merge branch 'master' of https://github.com/redbrain/gccrs
Diffstat (limited to 'gcc/rust/backend/rust-compile-block.h')
-rw-r--r--gcc/rust/backend/rust-compile-block.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/gcc/rust/backend/rust-compile-block.h b/gcc/rust/backend/rust-compile-block.h
index b17fb05..879e32d 100644
--- a/gcc/rust/backend/rust-compile-block.h
+++ b/gcc/rust/backend/rust-compile-block.h
@@ -28,35 +28,35 @@ namespace Compile {
class CompileBlock : public HIRCompileBase
{
public:
- static Bblock *compile (HIR::BlockExpr *expr, Context *ctx)
+ static Bblock *compile (HIR::BlockExpr *expr, Context *ctx, Bvariable *result)
{
- CompileBlock compiler (ctx);
+ CompileBlock compiler (ctx, result);
expr->accept_vis (compiler);
return compiler.translated;
}
- ~CompileBlock () {}
-
void visit (HIR::BlockExpr &expr);
private:
- CompileBlock (Context *ctx) : HIRCompileBase (ctx), translated (nullptr) {}
+ CompileBlock (Context *ctx, Bvariable *result)
+ : HIRCompileBase (ctx), translated (nullptr), result (result)
+ {}
Bblock *translated;
+ Bvariable *result;
};
class CompileConditionalBlocks : public HIRCompileBase
{
public:
- static Bstatement *compile (HIR::IfExpr *expr, Context *ctx)
+ static Bstatement *compile (HIR::IfExpr *expr, Context *ctx,
+ Bvariable *result)
{
- CompileConditionalBlocks resolver (ctx);
+ CompileConditionalBlocks resolver (ctx, result);
expr->accept_vis (resolver);
return resolver.translated;
}
- ~CompileConditionalBlocks () {}
-
void visit (HIR::IfExpr &expr);
void visit (HIR::IfExprConseqElse &expr);
@@ -64,46 +64,47 @@ public:
void visit (HIR::IfExprConseqIf &expr);
private:
- CompileConditionalBlocks (Context *ctx)
- : HIRCompileBase (ctx), translated (nullptr)
+ CompileConditionalBlocks (Context *ctx, Bvariable *result)
+ : HIRCompileBase (ctx), translated (nullptr), result (result)
{}
Bstatement *translated;
+ Bvariable *result;
};
class CompileExprWithBlock : public HIRCompileBase
{
public:
- static Bstatement *compile (HIR::ExprWithBlock *expr, Context *ctx)
+ static Bstatement *compile (HIR::ExprWithBlock *expr, Context *ctx,
+ Bvariable *result)
{
- CompileExprWithBlock resolver (ctx);
+ CompileExprWithBlock resolver (ctx, result);
expr->accept_vis (resolver);
return resolver.translated;
}
- ~CompileExprWithBlock () {}
-
void visit (HIR::IfExpr &expr)
{
- translated = CompileConditionalBlocks::compile (&expr, ctx);
+ translated = CompileConditionalBlocks::compile (&expr, ctx, result);
}
void visit (HIR::IfExprConseqElse &expr)
{
- translated = CompileConditionalBlocks::compile (&expr, ctx);
+ translated = CompileConditionalBlocks::compile (&expr, ctx, result);
}
void visit (HIR::IfExprConseqIf &expr)
{
- translated = CompileConditionalBlocks::compile (&expr, ctx);
+ translated = CompileConditionalBlocks::compile (&expr, ctx, result);
}
private:
- CompileExprWithBlock (Context *ctx)
- : HIRCompileBase (ctx), translated (nullptr)
+ CompileExprWithBlock (Context *ctx, Bvariable *result)
+ : HIRCompileBase (ctx), translated (nullptr), result (result)
{}
Bstatement *translated;
+ Bvariable *result;
};
} // namespace Compile