public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: resolve: Add SimplePathSeg -> CanonicalPath resolver
@ 2022-06-08 12:40 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:40 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:821c7947bfd6787fdaaba8dca2f9468661666dcc

commit 821c7947bfd6787fdaaba8dca2f9468661666dcc
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Apr 26 10:03:41 2022 +0200

    ast: resolve: Add SimplePathSeg -> CanonicalPath resolver

Diff:
---
 gcc/rust/ast/rust-ast.h                  |  1 +
 gcc/rust/resolve/rust-ast-resolve-path.h | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 666fd7cb00f..fb8982a780f 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -349,6 +349,7 @@ public:
 
   Location get_locus () const { return locus; }
   NodeId get_node_id () const { return node_id; }
+  const std::string &get_segment_name () const { return segment_name; }
 
   // TODO: visitor pattern?
 };
diff --git a/gcc/rust/resolve/rust-ast-resolve-path.h b/gcc/rust/resolve/rust-ast-resolve-path.h
index 7a4413b8ca1..60793d331ab 100644
--- a/gcc/rust/resolve/rust-ast-resolve-path.h
+++ b/gcc/rust/resolve/rust-ast-resolve-path.h
@@ -37,12 +37,23 @@ private:
 
   void resolve_path (AST::PathInExpression *expr);
   void resolve_path (AST::QualifiedPathInExpression *expr);
+  void resolve_path (AST::SimplePath *expr);
 
   void resolve_segments (CanonicalPath prefix, size_t offs,
 			 std::vector<AST::PathExprSegment> &segs,
 			 NodeId expr_node_id, Location expr_locus);
 };
 
+class ResolveSimplePathSegmentToCanonicalPath
+{
+public:
+  static CanonicalPath resolve (AST::SimplePathSegment &seg)
+  {
+    // FIXME: Since this is so simple, maybe it can simply be a tiny function?
+    return CanonicalPath::new_seg (seg.get_node_id (), seg.get_segment_name ());
+  }
+};
+
 } // namespace Resolver
 } // namespace Rust


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:40 [gcc/devel/rust/master] ast: resolve: Add SimplePathSeg -> CanonicalPath resolver Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).