public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] ast: resolve: Add SimplePathSeg -> CanonicalPath resolver Date: Wed, 8 Jun 2022 12:40:20 +0000 (GMT) [thread overview] Message-ID: <20220608124020.40DA9381ECB6@sourceware.org> (raw) 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
reply other threads:[~2022-06-08 12:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220608124020.40DA9381ECB6@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).