diff --git a/compiler/frontend/builtins/jet/.kotlin_class_names b/compiler/frontend/builtins/jet/.kotlin_class_names index 14c2f9fcff6..cc20324b6db 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_class_names and b/compiler/frontend/builtins/jet/.kotlin_class_names differ diff --git a/compiler/frontend/builtins/jet/.kotlin_name_table b/compiler/frontend/builtins/jet/.kotlin_name_table index 66fd80f2114..20ce8ec5116 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_name_table and b/compiler/frontend/builtins/jet/.kotlin_name_table differ diff --git a/compiler/frontend/builtins/jet/.kotlin_package b/compiler/frontend/builtins/jet/.kotlin_package index 60c8fca1d67..297ac989735 100644 Binary files a/compiler/frontend/builtins/jet/.kotlin_package and b/compiler/frontend/builtins/jet/.kotlin_package differ diff --git a/compiler/frontend/builtins/jet/tailRecursive.kotlin_class b/compiler/frontend/builtins/jet/tailRecursive.kotlin_class new file mode 100644 index 00000000000..0610f78b6b1 --- /dev/null +++ b/compiler/frontend/builtins/jet/tailRecursive.kotlin_class @@ -0,0 +1,4 @@ +†Î2 +j + Æ0B +Î \ No newline at end of file diff --git a/compiler/frontend/builtins/jet/volatile.kotlin_class b/compiler/frontend/builtins/jet/volatile.kotlin_class index 0610f78b6b1..f1256e1a72e 100644 --- a/compiler/frontend/builtins/jet/volatile.kotlin_class +++ b/compiler/frontend/builtins/jet/volatile.kotlin_class @@ -1,4 +1,4 @@ -†Î2 +†Ï2 j Æ0B -Î \ No newline at end of file +Ï \ No newline at end of file diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 7a90cd99dbc..6c53bd95ae8 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -1640,6 +1640,10 @@ public final annotation class suppress : jet.Annotation { /*primary*/ public constructor suppress(/*0*/ vararg names: jet.String /*jet.Array*/) } +public final annotation class tailRecursive : jet.Annotation { + /*primary*/ public constructor tailRecursive() +} + public final annotation class volatile : jet.Annotation { /*primary*/ public constructor volatile() } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java index 95e101a2619..dcff67a2730 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java @@ -401,6 +401,11 @@ public class KotlinBuiltIns { return getBuiltInClassByName("volatile"); } + @NotNull + public ClassDescriptor getTailRecursiveAnnotationClass() { + return getBuiltInClassByName("tailRecursive"); + } + @NotNull public ClassDescriptor getDeprecatedAnnotation() { return getBuiltInClassByName("deprecated"); @@ -955,6 +960,10 @@ public class KotlinBuiltIns { return containsAnnotation(declarationDescriptor, getDeprecatedAnnotation()); } + public boolean isTailRecursive(@NotNull DeclarationDescriptor declarationDescriptor) { + return containsAnnotation(declarationDescriptor, getTailRecursiveAnnotationClass()); + } + static boolean containsAnnotation(DeclarationDescriptor descriptor, ClassDescriptor annotationClass) { List annotations = descriptor.getOriginal().getAnnotations(); if (annotations != null) { diff --git a/idea/builtinsSrc/jet/Library.kt b/idea/builtinsSrc/jet/Library.kt index 0f22c9ea6b8..391fb2b24a8 100644 --- a/idea/builtinsSrc/jet/Library.kt +++ b/idea/builtinsSrc/jet/Library.kt @@ -7,6 +7,7 @@ public annotation class atomic : Annotation public annotation class data : Annotation public annotation class deprecated(value: String) : Annotation public annotation class suppress(vararg names: String) +public annotation class tailRecursive : Annotation public annotation class noinline public annotation class inline(public val strategy: InlineStrategy = InlineStrategy.AS_FUNCTION) diff --git a/runtime/src/jet/tailRecursive.java b/runtime/src/jet/tailRecursive.java new file mode 100644 index 00000000000..4bd8b400f7e --- /dev/null +++ b/runtime/src/jet/tailRecursive.java @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package jet; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD}) +public @interface tailRecursive { +}