From 0e3030707bfcd196fd678a25bf28fbdb925914c4 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Tue, 31 Aug 2021 12:22:06 +0100 Subject: Add iterate helper for TypePaths --- gcc/rust/ast/rust-path.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc') diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index 6ccd3a0..8992993 100644 --- a/gcc/rust/ast/rust-path.h +++ b/gcc/rust/ast/rust-path.h @@ -1029,6 +1029,15 @@ public: } Location get_locus () const override final { return locus; } + + void iterate_segments (std::function cb) + { + for (auto it = segments.begin (); it != segments.end (); it++) + { + if (!cb ((*it).get ())) + return; + } + } }; } // namespace AST } // namespace Rust -- cgit v1.1