18 if (
a.IsLibrary() &&
b.IsLibrary()) {
21 return url_a.
Equals(url_b);
22 }
else if (
a.IsClass() &&
b.IsClass()) {
25 return name_a.
Equals(name_b);
26 }
else if (
a.IsFunction() &&
b.IsFunction()) {
27 const auto& func_a = Function::Cast(
a);
28 const auto& func_b = Function::Cast(
b);
29 if (func_a.IsNonImplicitClosureFunction() ||
30 func_b.IsNonImplicitClosureFunction()) {
31 return a.ptr() ==
b.ptr();
35 if (!name_a.
Equals(name_b)) {
40 return IsMatch(owner_a, owner_b);
41 }
else if (
a.IsField() &&
b.IsField()) {
44 if (!name_a.
Equals(name_b)) {
49 return IsMatch(owner_a, owner_b);
50 }
else if (
a.IsTypeParameter() &&
b.IsTypeParameter()) {
51 if (TypeParameter::Cast(
a).index() != TypeParameter::Cast(
b).index() ||
52 TypeParameter::Cast(
a).
base() != TypeParameter::Cast(
b).
base()) {
55 return TypeParameter::Cast(
a).parameterized_class_id() ==
56 TypeParameter::Cast(
b).parameterized_class_id();
58 return a.ptr() ==
b.ptr();
62 if (
key.IsLibrary()) {
64 }
else if (
key.IsClass()) {
66 }
else if (
key.IsFunction()) {
69 }
else if (
key.IsField()) {
72 }
else if (
key.IsTypeParameter()) {
73 return TypeParameter::Cast(
key).Hash();
74 }
else if (
key.IsNamespace()) {
85 ASSERT(!(obj.IsString() || obj.IsAbstractType()));
98 ASSERT(!(
a.IsString() ||
a.IsAbstractType()));
99 ASSERT(!(
b.IsString() ||
b.IsAbstractType()));
100 return a.ptr() ==
b.ptr();
105 return a.Matches(Instance::Cast(
b));
111 return Instance::Cast(
key).CanonicalizeHash();
CanonicalInstanceKey(const Instance &key)
bool Matches(const Instance &obj) const
static bool IsMatch(const Object &a, const Object &b)
static ObjectPtr NewKey(const CanonicalInstanceKey &obj)
static uword Hash(const Object &key)
static ObjectPtr NewKey(const RegExpKey &key)
virtual bool CanonicalizeEquals(const Instance &other) const
virtual uint32_t CanonicalizeHash() const
static RegExpPtr CreateRegExp(Thread *thread, const String &pattern, RegExpFlags flags)
bool Equals(const String &str) const
static Thread * Current()
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)