Beispiel #1
0
 protected private override void convertSpanImpl(ReadOnlySpan <T?> src, Span <double> dst)
 {
     for (int i = 0; i < src.Length; i++)
     {
         dst[i] = ASObject.AS_toNumber((ASObject?)(object?)src[i]);
     }
 }
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 double convert(T?value) => ASObject.AS_toNumber((ASObject?)(object?)value);