1 // Copyright (C) 2020-2023 Free Software Foundation, Inc.
2
3 // This file is part of GCC.
4
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
8 // version.
9
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 // for more details.
14
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
18
19 #ifndef RUST_COMPILE_STMT
20 #define RUST_COMPILE_STMT
21
22 #include "rust-compile-base.h"
23
24 namespace Rust {
25 namespace Compile {
26
27 class CompileStmt : private HIRCompileBase, protected HIR::HIRStmtVisitor
28 {
29 public:
30 static tree Compile (HIR::Stmt *stmt, Context *ctx);
31
32 void visit (HIR::ExprStmtWithBlock &stmt) override;
33 void visit (HIR::ExprStmtWithoutBlock &stmt) override;
34 void visit (HIR::LetStmt &stmt) override;
35
36 // Empty visit for unused Stmt HIR nodes.
37 void visit (HIR::TupleStruct &) override {}
38 void visit (HIR::EnumItem &) override {}
39 void visit (HIR::EnumItemTuple &) override {}
40 void visit (HIR::EnumItemStruct &) override {}
41 void visit (HIR::EnumItemDiscriminant &) override {}
42 void visit (HIR::TypePathSegmentFunction &) override {}
43 void visit (HIR::TypePath &) override {}
44 void visit (HIR::QualifiedPathInType &) override {}
45 void visit (HIR::Module &) override {}
46 void visit (HIR::ExternCrate &) override {}
47 void visit (HIR::UseDeclaration &) override {}
48 void visit (HIR::Function &) override {}
49 void visit (HIR::TypeAlias &) override {}
50 void visit (HIR::StructStruct &) override {}
51 void visit (HIR::Enum &) override {}
52 void visit (HIR::Union &) override {}
53 void visit (HIR::ConstantItem &) override {}
54 void visit (HIR::StaticItem &) override {}
55 void visit (HIR::Trait &) override {}
56 void visit (HIR::ImplBlock &) override {}
57 void visit (HIR::ExternBlock &) override {}
58 void visit (HIR::EmptyStmt &) override {}
59
60 private:
61 CompileStmt (Context *ctx);
62
63 tree translated;
64 };
65
66 } // namespace Compile
67 } // namespace Rust
68
69 #endif // RUST_COMPILE_STMT