From ff6a28b64c1a5a9127a19d28afee320e1c6d2b64 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Thu, 18 May 2017 14:25:49 +0300 Subject: [PATCH] Add util method to BuildIns is `kotlin.Function` type. --- .../src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java index e3b468dc903..23266871a5a 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java @@ -275,6 +275,8 @@ public abstract class KotlinBuiltIns { public final FqNameUnsafe _enum = fqNameUnsafe("Enum"); + public final FqNameUnsafe functionSupertype = fqNameUnsafe("Function"); + public final FqName throwable = fqName("Throwable"); @@ -1094,6 +1096,10 @@ public abstract class KotlinBuiltIns { return false; } + public static boolean isNotNullOrNullableFunctionSupertype(@NotNull KotlinType type) { + return isConstructedFromGivenClass(type, FQ_NAMES.functionSupertype); + } + public static FqName getPrimitiveFqName(@NotNull PrimitiveType primitiveType) { return BUILT_INS_PACKAGE_FQ_NAME.child(primitiveType.getTypeName()); }