Add [tailRecursive] annotation to built-ins
This commit is contained in:
committed by
Andrey Breslav
parent
d2a31d88cd
commit
b62e5e3ef5
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
��2
|
||||
j
|
||||
�0B
|
||||
�
|
||||
@@ -1,4 +1,4 @@
|
||||
��2
|
||||
†Ο2
|
||||
j
|
||||
Ζ0B
|
||||
�
|
||||
Ο
|
||||
@@ -1640,6 +1640,10 @@ public final annotation class suppress : jet.Annotation {
|
||||
/*primary*/ public constructor suppress(/*0*/ vararg names: jet.String /*jet.Array<jet.String>*/)
|
||||
}
|
||||
|
||||
public final annotation class tailRecursive : jet.Annotation {
|
||||
/*primary*/ public constructor tailRecursive()
|
||||
}
|
||||
|
||||
public final annotation class volatile : jet.Annotation {
|
||||
/*primary*/ public constructor volatile()
|
||||
}
|
||||
|
||||
@@ -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<AnnotationDescriptor> annotations = descriptor.getOriginal().getAnnotations();
|
||||
if (annotations != null) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
Reference in New Issue
Block a user