diff options
author | Yizhe <yizhe@pku.edu.cn> | 2021-02-17 10:26:45 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-02-19 10:34:59 +0000 |
commit | f37f3d3a98239b01ab8101de2f4f617068927c22 (patch) | |
tree | 76f9d278dc3b594af4f57b020cc4791da223657e /gcc | |
parent | 496f773bdaa0be769c3d0e05b3598efa86dcefe1 (diff) | |
download | gcc-f37f3d3a98239b01ab8101de2f4f617068927c22.zip gcc-f37f3d3a98239b01ab8101de2f4f617068927c22.tar.gz gcc-f37f3d3a98239b01ab8101de2f4f617068927c22.tar.bz2 |
Renamed `BaseRules::equals` back to `BaseRules::is_equal`
Initially I thought `equals` is a better name because it fits the java
usage. However there will be another `can_eq` method that adjust types,
and in that case `is_equal` is a more consistent name.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 20 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.h | 14 |
2 files changed, 17 insertions, 17 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc index 75fb827..30d821f 100644 --- a/gcc/rust/typecheck/rust-tyty.cc +++ b/gcc/rust/typecheck/rust-tyty.cc @@ -131,7 +131,7 @@ StructFieldType::unify (BaseType *other) } bool -StructFieldType::equals (const BaseType &other) const +StructFieldType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { @@ -180,7 +180,7 @@ ADTType::unify (BaseType *other) } bool -ADTType::equals (const BaseType &other) const +ADTType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { @@ -195,7 +195,7 @@ ADTType::equals (const BaseType &other) const } for (int i = 0; i < num_fields (); i++) { - if (!get_field (i)->equals (*other2.get_field (i))) + if (!get_field (i)->is_equal (*other2.get_field (i))) { return false; } @@ -251,7 +251,7 @@ TupleType::unify (BaseType *other) } bool -TupleType::equals (const BaseType &other) const +TupleType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { @@ -266,7 +266,7 @@ TupleType::equals (const BaseType &other) const } for (int i = 0; i < num_fields (); i++) { - if (!get_field (i)->equals (*other2.get_field (i))) + if (!get_field (i)->is_equal (*other2.get_field (i))) { return false; } @@ -312,7 +312,7 @@ FnType::unify (BaseType *other) } bool -FnType::equals (const BaseType &other) const +FnType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { @@ -321,7 +321,7 @@ FnType::equals (const BaseType &other) const else { auto other2 = static_cast<const FnType &> (other); - if (!get_return_type ()->equals (*other2.get_return_type ())) + if (!get_return_type ()->is_equal (*other2.get_return_type ())) return false; if (num_params () != other2.num_params ()) return false; @@ -329,7 +329,7 @@ FnType::equals (const BaseType &other) const { auto lhs = param_at (i).second; auto rhs = other2.param_at (i).second; - if (!lhs->equals (*rhs)) + if (!lhs->is_equal (*rhs)) return false; } return true; @@ -369,7 +369,7 @@ ArrayType::unify (BaseType *other) } bool -ArrayType::equals (const BaseType &other) const +ArrayType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { @@ -634,7 +634,7 @@ ReferenceType::unify (BaseType *other) } bool -ReferenceType::equals (const BaseType &other) const +ReferenceType::is_equal (const BaseType &other) const { if (get_kind () != other.get_kind ()) { diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 2be807b..12a3bd5 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -77,7 +77,7 @@ public: ty are considered equal if they're of the same kind, and 1. (For ADTs, arrays, tuples, refs) have the same underlying ty 2. (For functions) have the same signature */ - virtual bool equals (const BaseType &other) const + virtual bool is_equal (const BaseType &other) const { return get_kind () == other.get_kind (); } @@ -208,7 +208,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; std::string get_name () const { return name; } @@ -242,7 +242,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; size_t num_fields () const { return fields.size (); } @@ -288,7 +288,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; size_t num_fields () const { return fields.size (); } @@ -356,7 +356,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; size_t num_params () const { return params.size (); } @@ -410,7 +410,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; size_t get_capacity () const { return capacity; } @@ -632,7 +632,7 @@ public: BaseType *unify (BaseType *other) override; - virtual bool equals (const BaseType &other) const override; + virtual bool is_equal (const BaseType &other) const override; BaseType *clone () final override; |