Beispiel #1
0
            public override bool spansEqual(ReadOnlySpan <T> span1, ReadOnlySpan <T> span2)
            {
                if (span1.Length != span2.Length)
                {
                    return(false);
                }

                if (!s_typeHasSpecialStrictEq)
                {
                    for (int i = 0; i < span1.Length; i++)
                    {
                        if (span1[i] != span2[i])
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < span1.Length; i++)
                    {
                        if (!ASObject.AS_strictEq(span1[i], span2[i]))
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }
Beispiel #2
0
 public override int lastIndexOf(ReadOnlySpan <T> span, T item)
 {
     if (item == null ||
         !s_typeHasSpecialStrictEq ||
         !ClassTagSet.specialStrictEquality.contains(item.AS_class.tag))
     {
         for (int i = span.Length - 1; i >= 0; i--)
         {
             if (span[i] == item)
             {
                 return(i);
             }
         }
     }
     else if (ASObject.AS_isNumeric(item))
     {
         double itemVal = ASObject.AS_toNumber(item);
         for (int i = span.Length - 1; i >= 0; i--)
         {
             if (ASObject.AS_isNumeric(span[i]) && ASObject.AS_toNumber(span[i]) == itemVal)
             {
                 return(i);
             }
         }
     }
     else if (item is ASString)
     {
         string itemVal = ASObject.AS_coerceString(item);
         for (int i = span.Length - 1; i >= 0; i--)
         {
             if (span[i] is ASString && ASObject.AS_coerceString(span[i]) == itemVal)
             {
                 return(i);
             }
         }
     }
     else
     {
         for (int i = span.Length - 1; i >= 0; i--)
         {
             if (ASObject.AS_strictEq(span[i], item))
             {
                 return(i);
             }
         }
     }
     return(-1);
 }
Beispiel #3
0
 public override bool Equals(T x, T y) => s_typeHasSpecialStrictEq ? x == y : ASObject.AS_strictEq(x, y);