aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-stmt.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-23 13:14:49 +0000
committerGitHub <noreply@github.com>2021-06-23 13:14:49 +0000
commit4e5baf7e679a890c22804d16b99fc6794486825b (patch)
treef08c021b2e536fa1c2677ddbedf9bd432033d47d /gcc/rust/backend/rust-compile-stmt.h
parentce545f5318b3ff494caed8108f746ad045dfeab6 (diff)
parent012401ab1c98ea6fa578bd27b018037ec55464a2 (diff)
downloadgcc-4e5baf7e679a890c22804d16b99fc6794486825b.zip
gcc-4e5baf7e679a890c22804d16b99fc6794486825b.tar.gz
gcc-4e5baf7e679a890c22804d16b99fc6794486825b.tar.bz2
Merge #520
520: Add support for struct definitions to be within a block r=philberty a=philberty We still have bugs handling unit-structs but this allows for Tuple Structs and normal named field structs to be declared within a block and referenced lexically. This allows rust statements to follow the correct grammar. Fixes #519 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-stmt.h')
-rw-r--r--gcc/rust/backend/rust-compile-stmt.h11
1 files changed, 1 insertions, 10 deletions
diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h
index 5f37e07..73f6f22 100644
--- a/gcc/rust/backend/rust-compile-stmt.h
+++ b/gcc/rust/backend/rust-compile-stmt.h
@@ -35,27 +35,21 @@ public:
{
CompileStmt compiler (ctx);
stmt->accept_vis (compiler);
- rust_assert (compiler.ok);
return compiler.translated;
}
void visit (HIR::ExprStmtWithBlock &stmt) override
{
- ok = true;
translated = CompileExpr::Compile (stmt.get_expr (), ctx);
}
void visit (HIR::ExprStmtWithoutBlock &stmt) override
{
- ok = true;
translated = CompileExpr::Compile (stmt.get_expr (), ctx);
}
void visit (HIR::LetStmt &stmt) override
{
- // marks that the statement has been looked at
- ok = true;
-
// nothing to do
if (!stmt.has_init_expr ())
return;
@@ -96,11 +90,8 @@ public:
}
private:
- CompileStmt (Context *ctx)
- : HIRCompileBase (ctx), ok (false), translated (nullptr)
- {}
+ CompileStmt (Context *ctx) : HIRCompileBase (ctx), translated (nullptr) {}
- bool ok;
Bexpression *translated;
};