aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-08-31 12:22:06 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-08-31 12:22:06 +0100
commit0e3030707bfcd196fd678a25bf28fbdb925914c4 (patch)
treec1a77c3ae3d0e8bb47e6cee9159100558c7ac7a2
parent82e1061579796adaa39ab34da77b6c8c6ea82539 (diff)
downloadgcc-0e3030707bfcd196fd678a25bf28fbdb925914c4.zip
gcc-0e3030707bfcd196fd678a25bf28fbdb925914c4.tar.gz
gcc-0e3030707bfcd196fd678a25bf28fbdb925914c4.tar.bz2
Add iterate helper for TypePaths
-rw-r--r--gcc/rust/ast/rust-path.h9
1 files changed, 9 insertions, 0 deletions
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<bool (TypePathSegment *)> cb)
+ {
+ for (auto it = segments.begin (); it != segments.end (); it++)
+ {
+ if (!cb ((*it).get ()))
+ return;
+ }
+ }
};
} // namespace AST
} // namespace Rust