gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check.h: Add prototype
* typecheck/rust-typecheck-context.cc (TypeCheckContextItem::get_defid): implementation
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
TyTy::FnType *get_context_type ();
+ DefId get_defid () const;
+
private:
union Item
{
return static_cast<TyTy::FnType *> (lookup);
}
+DefId
+TypeCheckContextItem::get_defid () const
+{
+ switch (get_type ())
+ {
+ case ITEM:
+ return item.item->get_mappings ().get_defid ();
+
+ case IMPL_ITEM:
+ return item.impl_item.second->get_mappings ().get_defid ();
+
+ case TRAIT_ITEM:
+ return item.trait_item->get_mappings ().get_defid ();
+ }
+
+ return UNKNOWN_DEFID;
+}
+
} // namespace Resolver
} // namespace Rust