https://gcc.gnu.org/g:549fe6d3a01109f6189b1bda9fd4478051062810

commit 549fe6d3a01109f6189b1bda9fd4478051062810
Author: Owen Avery <powerboat9.ga...@gmail.com>
Date:   Sat Oct 26 15:05:43 2024 -0400

    Rename some PathIdentSegment functions
    
    This makes PathIdentSegment more similar to other classes used to
    represent path segments.
    
    gcc/rust/ChangeLog:
    
            * ast/rust-path.h
            (PathIdentSegment::is_super_segment): Rename to...
            (PathIdentSegment::is_super_path_seg): ...here.
            (PathIdentSegment::is_crate_segment): Rename to...
            (PathIdentSegment::is_crate_path_seg): ...here.
            (PathIdentSegment::is_lower_self): Rename to...
            (PathIdentSegment::is_lower_self_seg): ...here.
            (PathIdentSegment::is_big_self): Rename to...
            (PathIdentSegment::is_big_self_seg): ...here.
    
            (PathExprSegment::is_super_path_seg): Handle renames.
            (PathExprSegment::is_crate_path_seg): Likewise.
            (PathExprSegment::is_lower_self_seg): Likewise.
            (TypePathSegment::is_crate_path_seg): Likewise.
            (TypePathSegment::is_super_path_seg): Likewise.
            (TypePathSegment::is_big_self_seg): Likewise.
            (TypePathSegment::is_lower_self_seg): Likewise.
            * ast/rust-ast-collector.cc
            (TokenCollector::visit): Likewise.
    
    Signed-off-by: Owen Avery <powerboat9.ga...@gmail.com>

Diff:
---
 gcc/rust/ast/rust-ast-collector.cc |  8 ++++----
 gcc/rust/ast/rust-path.h           | 31 ++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-collector.cc 
b/gcc/rust/ast/rust-ast-collector.cc
index a1306463e250..8f66742d1196 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -711,19 +711,19 @@ TokenCollector::visit (TypePath &path)
 void
 TokenCollector::visit (PathIdentSegment &segment)
 {
-  if (segment.is_super_segment ())
+  if (segment.is_super_path_seg ())
     {
       push (Rust::Token::make (SUPER, segment.get_locus ()));
     }
-  else if (segment.is_crate_segment ())
+  else if (segment.is_crate_path_seg ())
     {
       push (Rust::Token::make (CRATE, segment.get_locus ()));
     }
-  else if (segment.is_lower_self ())
+  else if (segment.is_lower_self_seg ())
     {
       push (Rust::Token::make (SELF, segment.get_locus ()));
     }
-  else if (segment.is_big_self ())
+  else if (segment.is_big_self_seg ())
     {
       push (Rust::Token::make (SELF_ALIAS, segment.get_locus ()));
     }
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index 5ca2c7f4394a..2df1506923d7 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -55,10 +55,16 @@ public:
 
   location_t get_locus () const { return locus; }
 
-  bool is_super_segment () const { return as_string ().compare ("super") == 0; 
}
-  bool is_crate_segment () const { return as_string ().compare ("crate") == 0; 
}
-  bool is_lower_self () const { return as_string ().compare ("self") == 0; }
-  bool is_big_self () const { return as_string ().compare ("Self") == 0; }
+  bool is_super_path_seg () const
+  {
+    return as_string ().compare ("super") == 0;
+  }
+  bool is_crate_path_seg () const
+  {
+    return as_string ().compare ("crate") == 0;
+  }
+  bool is_lower_self_seg () const { return as_string ().compare ("self") == 0; 
}
+  bool is_big_self_seg () const { return as_string ().compare ("Self") == 0; }
 };
 
 // A binding of an identifier to a type used in generic arguments in paths
@@ -560,17 +566,17 @@ public:
 
   bool is_super_path_seg () const
   {
-    return !has_generic_args () && get_ident_segment ().is_super_segment ();
+    return !has_generic_args () && get_ident_segment ().is_super_path_seg ();
   }
 
   bool is_crate_path_seg () const
   {
-    return !has_generic_args () && get_ident_segment ().is_crate_segment ();
+    return !has_generic_args () && get_ident_segment ().is_crate_path_seg ();
   }
 
   bool is_lower_self_seg () const
   {
-    return !has_generic_args () && get_ident_segment ().is_lower_self ();
+    return !has_generic_args () && get_ident_segment ().is_lower_self_seg ();
   }
 };
 
@@ -950,16 +956,19 @@ public:
 
   bool is_crate_path_seg () const
   {
-    return get_ident_segment ().is_crate_segment ();
+    return get_ident_segment ().is_crate_path_seg ();
   }
   bool is_super_path_seg () const
   {
-    return get_ident_segment ().is_super_segment ();
+    return get_ident_segment ().is_super_path_seg ();
+  }
+  bool is_big_self_seg () const
+  {
+    return get_ident_segment ().is_big_self_seg ();
   }
-  bool is_big_self_seg () const { return get_ident_segment ().is_big_self (); }
   bool is_lower_self_seg () const
   {
-    return get_ident_segment ().is_lower_self ();
+    return get_ident_segment ().is_lower_self_seg ();
   }
 };

Reply via email to