]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: TyTy: Refactor FnType deprecated API
authorJakub Dupak <dev@jakubdupak.com>
Thu, 14 Dec 2023 11:54:11 +0000 (12:54 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:51 +0000 (12:36 +0100)
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>
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/typecheck/rust-tyty-call.cc
gcc/rust/typecheck/rust-tyty-cmp.h
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-tyty.h
gcc/rust/typecheck/rust-unify.cc

index e0917f686602325a4cdb1d6d54e0f085e7cf29cd..596b848849ecd10c63f671373fd9fa55237a1ee4 100644 (file)
@@ -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;
       }
index 31afe046a136613e557df29be4ec9053b8a8f4c6..a28780bcac37855848c932b4b2525057eb2adbb1 100644 (file)
@@ -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)
index 6d4bc16bf6e5b5c8185a6e510f1d339d3bb07a98..98ff1dc664edaaf31416037e40b8c3e96233d339 100644 (file)
@@ -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))
          {
index e9b42ebebee7eb85dc020e1220d46e55e458c683..f1789f008a0e00888710b96ccee06ab867ff09bb 100644 (file)
@@ -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;
index 2ed407ee169bb23bfb5b63c5608cd44b7ee2ea17..b04048f400d7b54674c9065bc3c1935eadd3d1a9 100644 (file)
@@ -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;
 
index 3027f0997390e70e90d04e9711a50de8a61091f0..8b43380cc59271d8f9eca7c3642b382b6e214af7 100644 (file)
@@ -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