]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
TyTy: Refactor FnType deprecated API
authorJakub Dupak <dev@jakubdupak.com>
Thu, 14 Dec 2023 11:54:11 +0000 (12:54 +0100)
committerCohenArthur <arthur.cohen@embecosm.com>
Wed, 27 Dec 2023 19:03:20 +0000 (19:03 +0000)
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 c511cf1074f9f24f9693292d27797fba6265d6c2..6116dc9c8c1453fb4532d309f700881b5aabf67e 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 6fce40cb65de5cd46caf67f1f4a6766a8cf035aa..b984988f53006f1a2e308cda0124fb487b2aff4c 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 cfec6b63fe138584eee3fb512f77acbd614173c2..db2bb2dd26f2fbccb1777ea52b22e3cdff2906c8 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 64db06dd078558af8a97eb377e471cb046129e17..554d5c652e4961940a86d200403956c99b413ac7 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 c9eb12cda9e9a414ae7be90d313fb5c248af370c..95bc8cab1a6d42a6a330c608e88689a381c20b2b 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 6c0c6f9cfcf31db05374c780e6adbacbf3764da5..86637261f7158fe9836d0c2e4946d37f9299da07 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