aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-11-06 16:32:35 +0100
committerCohenArthur <arthur.cohen@embecosm.com>2024-12-09 14:46:13 +0000
commit3d2f58db04023adb74e5334cef31b67383def449 (patch)
tree6d57b73d7ddf0a4c7181a1d3ddb43f0866c6d1b4 /gcc/rust/hir
parent3630428e54586413957c5b8edb4ee136a830aac2 (diff)
downloadgcc-3d2f58db04023adb74e5334cef31b67383def449.zip
gcc-3d2f58db04023adb74e5334cef31b67383def449.tar.gz
gcc-3d2f58db04023adb74e5334cef31b67383def449.tar.bz2
hir: Start adapting visitors to accept multiple kinds of Paths
gcc/rust/ChangeLog: * ast/rust-item.h: Add new method to specifically get a type-path. * ast/rust-path.cc (LangItemPath::as_string): Implement properly. * hir/rust-ast-lower-type.cc (ASTLowerTypePath::translate): Adapt visitor to use the new LangItemPath. * hir/rust-ast-lower-type.h: Likewise. * resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise. * resolve/rust-ast-resolve-type.h: Likewise.
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.cc9
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-type.cc b/gcc/rust/hir/rust-ast-lower-type.cc
index 553c9c9..5057653 100644
--- a/gcc/rust/hir/rust-ast-lower-type.cc
+++ b/gcc/rust/hir/rust-ast-lower-type.cc
@@ -19,11 +19,20 @@
#include "rust-ast-lower-type.h"
#include "optional.h"
#include "rust-attribute-values.h"
+#include "rust-path.h"
namespace Rust {
namespace HIR {
HIR::TypePath *
+ASTLowerTypePath::translate (AST::Path &type)
+{
+ rust_assert (type.get_path_kind () == AST::Path::Kind::Type);
+
+ return ASTLowerTypePath::translate (static_cast<AST::TypePath &> (type));
+}
+
+HIR::TypePath *
ASTLowerTypePath::translate (AST::TypePath &type)
{
ASTLowerTypePath resolver;
diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h
index 5207ce2..ec73df2 100644
--- a/gcc/rust/hir/rust-ast-lower-type.h
+++ b/gcc/rust/hir/rust-ast-lower-type.h
@@ -31,6 +31,7 @@ protected:
using Rust::HIR::ASTLoweringBase::visit;
public:
+ static HIR::TypePath *translate (AST::Path &type);
static HIR::TypePath *translate (AST::TypePath &type);
void visit (AST::TypePathSegmentFunction &segment) override;