| 1 |
// Copyright (C) 2020-2025 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_HIR_TYPE_CHECK_STMT |
| 20 |
#define RUST_HIR_TYPE_CHECK_STMT |
| 21 |
|
| 22 |
#include "rust-hir-type-check-base.h" |
| 23 |
#include "rust-hir-visitor.h" |
| 24 |
|
| 25 |
namespace Rust { |
| 26 |
namespace Resolver { |
| 27 |
|
| 28 |
class TypeCheckStmt : private TypeCheckBase, private HIR::HIRStmtVisitor |
| 29 |
{ |
| 30 |
public: |
| 31 |
static TyTy::BaseType *Resolve (HIR::Stmt &stmt); |
| 32 |
|
| 33 |
void visit (HIR::ExprStmt &stmt) override; |
| 34 |
void visit (HIR::EmptyStmt &stmt) override; |
| 35 |
void visit (HIR::ExternBlock &extern_block) override; |
| 36 |
void visit (HIR::ConstantItem &constant) override; |
| 37 |
void visit (HIR::LetStmt &stmt) override; |
| 38 |
void visit (HIR::TupleStruct &struct_decl) override; |
| 39 |
void visit (HIR::Enum &enum_decl) override; |
| 40 |
void visit (HIR::StructStruct &struct_decl) override; |
| 41 |
void visit (HIR::Union &union_decl) override; |
| 42 |
void visit (HIR::Function &function) override; |
| 43 |
void visit (HIR::Module &module) override; |
| 44 |
void visit (HIR::TypeAlias &type_alias) override; |
| 45 |
void visit (HIR::StaticItem &static_item) override; |
| 46 |
void visit (HIR::Trait &trait) override; |
| 47 |
void visit (HIR::ImplBlock &impl) override; |
| 48 |
void visit (HIR::TypePath &path) override; |
| 49 |
void visit (HIR::QualifiedPathInType &path) override; |
| 50 |
|
| 51 |
// FIXME |
| 52 |
// this seems like it should not be part of this visitor |
| 53 |
void visit (HIR::TypePathSegmentFunction &segment) override |
| 54 |
{ |
| 55 |
rust_unreachable (); |
| 56 |
} |
| 57 |
|
| 58 |
// nothing to do for these |
| 59 |
void visit (HIR::ExternCrate &crate) override {} |
| 60 |
void visit (HIR::UseDeclaration &use_decl) override {} |
| 61 |
|
| 62 |
// nothing to do for these as they are taken care of by the |
| 63 |
// hir-type-check-enumitem.h |
| 64 |
void visit (HIR::EnumItemTuple &) override {} |
| 65 |
void visit (HIR::EnumItemStruct &) override {} |
| 66 |
void visit (HIR::EnumItem &) override {} |
| 67 |
void visit (HIR::EnumItemDiscriminant &) override {} |
| 68 |
|
| 69 |
private: |
| 70 |
TypeCheckStmt () : TypeCheckBase (), infered (nullptr) {} |
| 71 |
|
| 72 |
TyTy::BaseType *infered; |
| 73 |
}; |
| 74 |
|
| 75 |
} // namespace Resolver |
| 76 |
} // namespace Rust |
| 77 |
|
| 78 |
#endif // RUST_HIR_TYPE_CHECK_STMT |