diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-01-29 18:11:28 +0000 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2025-02-02 18:29:35 +0000 |
commit | b57ab7aaa7a9472ec7204a5d5c539f05c93e121f (patch) | |
tree | 3fde4bd3430c6c8b96302f7e1ed1db421425c97e /gcc/rust/ast/rust-ast-builder.cc | |
parent | e42c64242b8f25dcf30aee35ee059bdd8873561f (diff) | |
download | gcc-b57ab7aaa7a9472ec7204a5d5c539f05c93e121f.zip gcc-b57ab7aaa7a9472ec7204a5d5c539f05c93e121f.tar.gz gcc-b57ab7aaa7a9472ec7204a5d5c539f05c93e121f.tar.bz2 |
ast-builder: Add new functions to create type paths.
gcc/rust/ChangeLog:
* ast/rust-ast-builder.cc (Builder::type_path): New functions.
* ast/rust-ast-builder.h: Declare them.
Diffstat (limited to 'gcc/rust/ast/rust-ast-builder.cc')
-rw-r--r-- | gcc/rust/ast/rust-ast-builder.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-ast-builder.cc b/gcc/rust/ast/rust-ast-builder.cc index b3ee387ef..4afe329 100644 --- a/gcc/rust/ast/rust-ast-builder.cc +++ b/gcc/rust/ast/rust-ast-builder.cc @@ -159,12 +159,31 @@ Builder::single_generic_type_path (LangItem::Kind lang_item, } TypePath +Builder::type_path (std::vector<std::unique_ptr<TypePathSegment>> &&segments, + bool opening_scope) const +{ + return TypePath (std::move (segments), loc, opening_scope); +} + +TypePath +Builder::type_path (std::vector<std::string> &&segments, + bool opening_scope) const +{ + auto type_segments = std::vector<std::unique_ptr<TypePathSegment>> (); + + for (auto &&segment : segments) + type_segments.emplace_back (type_path_segment (segment)); + + return TypePath (std::move (type_segments), loc, opening_scope); +} + +TypePath Builder::type_path (std::unique_ptr<TypePathSegment> &&segment) const { auto segments = std::vector<std::unique_ptr<TypePathSegment>> (); segments.emplace_back (std::move (segment)); - return TypePath (std::move (segments), loc); + return type_path (std::move (segments)); } TypePath |