public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8611] gccrs: TyTy: Refactor FnType deprecated API
@ 2024-01-30 12:01 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-30 12:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:14025f735967c1909f2e722210f8c4e694b9ee51

commit r14-8611-g14025f735967c1909f2e722210f8c4e694b9ee51
Author: Jakub Dupak <dev@jakubdupak.com>
Date:   Thu Dec 14 12:54:11 2023 +0100

    gccrs: TyTy: Refactor FnType deprecated API
    
    gcc/rust/ChangeLog:
    
            * backend/rust-compile-expr.cc (CompileExpr::visit): Use new API.
            * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Use new API.
            * typecheck/rust-tyty-cmp.h: Remove old API.
            * typecheck/rust-tyty.cc (FnPtr::is_equal): Use new API.
            * typecheck/rust-tyty.h: Remove old API.
            * typecheck/rust-unify.cc (UnifyRules::expect_fnptr): Use new API.
    
    Signed-off-by: Jakub Dupak <dev@jakubdupak.com>

Diff:
---
 gcc/rust/backend/rust-compile-expr.cc | 2 +-
 gcc/rust/typecheck/rust-tyty-call.cc  | 2 +-
 gcc/rust/typecheck/rust-tyty-cmp.h    | 6 +++---
 gcc/rust/typecheck/rust-tyty.cc       | 2 +-
 gcc/rust/typecheck/rust-tyty.h        | 3 ---
 gcc/rust/typecheck/rust-unify.cc      | 6 +++---
 6 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index e0917f686602..596b848849ec 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -1198,7 +1198,7 @@ CompileExpr::visit (HIR::CallExpr &expr)
     if (base->get_kind () == TyTy::TypeKind::FNPTR)
       {
 	const TyTy::FnPtr *fn = static_cast<const TyTy::FnPtr *> (base);
-	*result = fn->param_at (index);
+	*result = fn->get_param_type_at (index);
 
 	return true;
       }
diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck/rust-tyty-call.cc
index 31afe046a136..a28780bcac37 100644
--- a/gcc/rust/typecheck/rust-tyty-call.cc
+++ b/gcc/rust/typecheck/rust-tyty-call.cc
@@ -271,7 +271,7 @@ TypeCheckCallExpr::visit (FnPtr &type)
   for (auto &argument : call.get_arguments ())
     {
       location_t arg_locus = argument->get_locus ();
-      BaseType *fnparam = type.param_at (i);
+      BaseType *fnparam = type.get_param_type_at (i);
       auto argument_expr_tyty
 	= Resolver::TypeCheckExpr::Resolve (argument.get ());
       if (argument_expr_tyty->get_kind () == TyTy::TypeKind::ERROR)
diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h
index 6d4bc16bf6e5..98ff1dc664ed 100644
--- a/gcc/rust/typecheck/rust-tyty-cmp.h
+++ b/gcc/rust/typecheck/rust-tyty-cmp.h
@@ -800,8 +800,8 @@ public:
 
     for (size_t i = 0; i < base->num_params (); i++)
       {
-	auto this_param = base->param_at (i);
-	auto other_param = type.param_at (i);
+	auto this_param = base->get_param_type_at (i);
+	auto other_param = type.get_param_type_at (i);
 	if (!this_param->can_eq (other_param, emit_error_flag))
 	  {
 	    BaseCmp::visit (type);
@@ -830,7 +830,7 @@ public:
 
     for (size_t i = 0; i < base->num_params (); i++)
       {
-	auto this_param = base->param_at (i);
+	auto this_param = base->get_param_type_at (i);
 	auto other_param = type.param_at (i).second;
 	if (!this_param->can_eq (other_param, emit_error_flag))
 	  {
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index e9b42ebebee7..f1789f008a0e 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -2123,7 +2123,7 @@ FnPtr::is_equal (const BaseType &other) const
 
   for (size_t i = 0; i < num_params (); i++)
     {
-      if (!param_at (i)->is_equal (*other2.param_at (i)))
+      if (!get_param_type_at (i)->is_equal (*other2.get_param_type_at (i)))
 	return false;
     }
   return true;
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 2ed407ee169b..b04048f400d7 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -926,9 +926,6 @@ public:
 
   size_t num_params () const { return params.size (); }
 
-  // DEPRECATED: Use get_param_type_at
-  BaseType *param_at (size_t idx) const { return get_param_type_at (idx); }
-
   void accept_vis (TyVisitor &vis) override;
   void accept_vis (TyConstVisitor &vis) const override;
 
diff --git a/gcc/rust/typecheck/rust-unify.cc b/gcc/rust/typecheck/rust-unify.cc
index 3027f0997390..8b43380cc592 100644
--- a/gcc/rust/typecheck/rust-unify.cc
+++ b/gcc/rust/typecheck/rust-unify.cc
@@ -1009,8 +1009,8 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype)
 
 	for (size_t i = 0; i < ltype->num_params (); i++)
 	  {
-	    auto a = ltype->param_at (i);
-	    auto b = type.param_at (i);
+	    auto a = ltype->get_param_type_at (i);
+	    auto b = type.get_param_type_at (i);
 
 	    auto unified_param
 	      = UnifyRules::Resolve (TyTy::TyWithLocation (a),
@@ -1058,7 +1058,7 @@ UnifyRules::expect_fnptr (TyTy::FnPtr *ltype, TyTy::BaseType *rtype)
 
 	for (size_t i = 0; i < ltype->num_params (); i++)
 	  {
-	    auto this_param = ltype->param_at (i);
+	    auto this_param = ltype->get_param_type_at (i);
 	    auto other_param = type.param_at (i).second;
 
 	    auto unified_param

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-30 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 12:01 [gcc r14-8611] gccrs: TyTy: Refactor FnType deprecated API Arthur Cohen

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).