Implement for/iter postfix templates

#KT-4710 In Progress
This commit is contained in:
Denis Zharkov
2016-07-11 16:03:46 +03:00
committed by Nikolay Krasko
parent b702886f0d
commit 1b391123e6
12 changed files with 90 additions and 1 deletions
@@ -60,6 +60,7 @@ fun KotlinType.isBoolean(): Boolean = KotlinBuiltIns.isBoolean(this)
fun KotlinType.isPrimitiveNumberType(): Boolean = KotlinBuiltIns.isPrimitiveType(this) && !isBoolean()
fun KotlinType.isBooleanOrNullableBoolean(): Boolean = KotlinBuiltIns.isBooleanOrNullableBoolean(this)
fun KotlinType.isThrowable(): Boolean = isConstructedFromClassWithGivenFqName(KotlinBuiltIns.FQ_NAMES.throwable) && !isMarkedNullable
fun KotlinType.isIterator(): Boolean = isConstructedFromClassWithGivenFqName(KotlinBuiltIns.FQ_NAMES.iterator) && !isMarkedNullable
fun KotlinType.isConstructedFromClassWithGivenFqName(fqName: FqName) =
(constructor.declarationDescriptor as? ClassDescriptor)?.fqNameUnsafe == fqName.toUnsafe()