JS: fixed <Type>Array.iterator methods; added -Xtypedarray compiler key
The <Type>Array.iterator used to lack next<Type>() method (KT-16626). The -Xtypedarray compiler key enables translation of primitive arrays to TypedArrays, and primitive array`is`-checks (KT-15358, KT-14007, KT-14614, KT-16056).
This commit is contained in:
@@ -877,6 +877,20 @@ public abstract class KotlinBuiltIns {
|
||||
return descriptor != null && getPrimitiveTypeByArrayClassFqName(getFqName(descriptor)) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PrimitiveType getPrimitiveArrayElementType(@NotNull KotlinType type) {
|
||||
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
if (descriptor == null) return null;
|
||||
return getPrimitiveTypeByArrayClassFqName(getFqName(descriptor));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PrimitiveType getPrimitiveType(@NotNull KotlinType type) {
|
||||
ClassifierDescriptor descriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
if (type.isMarkedNullable() || !(descriptor instanceof ClassDescriptor)) return null;
|
||||
return getPrimitiveTypeByFqName(getFqName(descriptor));
|
||||
}
|
||||
|
||||
public static boolean isPrimitiveType(@NotNull KotlinType type) {
|
||||
return !type.isMarkedNullable() && isPrimitiveTypeOrNullablePrimitiveType(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user