From 012401ab1c98ea6fa578bd27b018037ec55464a2 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Wed, 23 Jun 2021 14:04:27 +0100 Subject: Add support for struct definitions to be within a block 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 --- gcc/rust/backend/rust-compile-stmt.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'gcc/rust/backend') 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; }; -- cgit v1.1