aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPhilip Herron <herron.philip@googlemail.com>2023-01-12 16:40:30 +0000
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:20 +0200
commitc1b1bbbc64524b508c0150c66163b27be508dbcf (patch)
treefe051747b3d2b7cf23a20b0b73f2cb0307853a21 /gcc/rust
parent8d1d08cdbcf40897282d9ed20ccf70bf2c93427c (diff)
downloadgcc-c1b1bbbc64524b508c0150c66163b27be508dbcf.zip
gcc-c1b1bbbc64524b508c0150c66163b27be508dbcf.tar.gz
gcc-c1b1bbbc64524b508c0150c66163b27be508dbcf.tar.bz2
gccrs: Move TypePredicateItem impl out of the header
This moves the implementation code out of the header and into its respective cc file. Signed-off-by: Philip Herron <herron.philip@googlemail.com> gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeBoundPredicateItem::error): refactor (TypeBoundPredicateItem::is_error): likewise (TypeBoundPredicateItem::get_parent): likewise * typecheck/rust-tyty.h: Move the implementation for the above
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/typecheck/rust-tyty-bounds.cc24
-rw-r--r--gcc/rust/typecheck/rust-tyty.h16
2 files changed, 28 insertions, 12 deletions
diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc
index 30f7b0d..e7eb9a7 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -364,6 +364,30 @@ TypeBoundPredicate::lookup_associated_item (const std::string &search) const
return TypeBoundPredicateItem (this, trait_item_ref);
}
+TypeBoundPredicateItem::TypeBoundPredicateItem (
+ const TypeBoundPredicate *parent,
+ const Resolver::TraitItemReference *trait_item_ref)
+ : parent (parent), trait_item_ref (trait_item_ref)
+{}
+
+TypeBoundPredicateItem
+TypeBoundPredicateItem::error ()
+{
+ return TypeBoundPredicateItem (nullptr, nullptr);
+}
+
+bool
+TypeBoundPredicateItem::is_error () const
+{
+ return parent == nullptr || trait_item_ref == nullptr;
+}
+
+const TypeBoundPredicate *
+TypeBoundPredicateItem::get_parent () const
+{
+ return parent;
+}
+
TypeBoundPredicateItem
TypeBoundPredicate::lookup_associated_item (
const Resolver::TraitItemReference *ref) const
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 20a243f..7d32ed5 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -82,19 +82,11 @@ class TypeBoundPredicateItem
{
public:
TypeBoundPredicateItem (const TypeBoundPredicate *parent,
- const Resolver::TraitItemReference *trait_item_ref)
- : parent (parent), trait_item_ref (trait_item_ref)
- {}
+ const Resolver::TraitItemReference *trait_item_ref);
- static TypeBoundPredicateItem error ()
- {
- return TypeBoundPredicateItem (nullptr, nullptr);
- }
+ static TypeBoundPredicateItem error ();
- bool is_error () const
- {
- return parent == nullptr || trait_item_ref == nullptr;
- }
+ bool is_error () const;
BaseType *get_tyty_for_receiver (const TyTy::BaseType *receiver);
@@ -102,7 +94,7 @@ public:
bool needs_implementation () const;
- const TypeBoundPredicate *get_parent () const { return parent; }
+ const TypeBoundPredicate *get_parent () const;
Location get_locus () const;