Drop inlineOptions and fix forgotten usages
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2015 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 org.jetbrains.kotlin.resolve.inline;
|
|
||||||
|
|
||||||
public enum InlineOption {
|
|
||||||
LOCAL_CONTINUE_AND_BREAK,
|
|
||||||
ONLY_LOCAL_RETURN
|
|
||||||
}
|
|
||||||
@@ -61,29 +61,8 @@ public class InlineUtil {
|
|||||||
return InlineStrategy.valueOf(((EnumValue) argument).getValue().getName().asString());
|
return InlineStrategy.valueOf(((EnumValue) argument).getValue().getName().asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasOnlyLocalContinueAndBreak(@NotNull ValueParameterDescriptor descriptor) {
|
|
||||||
return hasInlineOption(descriptor, InlineOption.LOCAL_CONTINUE_AND_BREAK);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasOnlyLocalReturn(@NotNull ValueParameterDescriptor descriptor) {
|
public static boolean hasOnlyLocalReturn(@NotNull ValueParameterDescriptor descriptor) {
|
||||||
return hasInlineOption(descriptor, InlineOption.ONLY_LOCAL_RETURN)
|
return descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.crossinline) != null;
|
||||||
|| descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.crossinline) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean hasInlineOption(@NotNull ValueParameterDescriptor descriptor, @NotNull InlineOption option) {
|
|
||||||
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.inlineOptions);
|
|
||||||
if (annotation != null) {
|
|
||||||
ConstantValue<?> argument = firstOrNull(annotation.getAllValueArguments().values());
|
|
||||||
if (argument instanceof ArrayValue) {
|
|
||||||
for (ConstantValue<?> value : ((ArrayValue) argument).getValue()) {
|
|
||||||
if (value instanceof EnumValue && ((EnumValue) value).getValue().getName().asString().equals(option.name())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkNonLocalReturnUsage(
|
public static boolean checkNonLocalReturnUsage(
|
||||||
|
|||||||
-22
@@ -591,22 +591,6 @@ public interface Function</*0*/ out R> {
|
|||||||
/*primary*/ public constructor HiddenDeclaration()
|
/*primary*/ public constructor HiddenDeclaration()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final enum class InlineOption : kotlin.Enum<kotlin.InlineOption> {
|
|
||||||
enum entry LOCAL_CONTINUE_AND_BREAK
|
|
||||||
|
|
||||||
enum entry ONLY_LOCAL_RETURN
|
|
||||||
|
|
||||||
/*primary*/ private constructor InlineOption()
|
|
||||||
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
|
||||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: kotlin.InlineOption): kotlin.Int
|
|
||||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
|
||||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
|
||||||
|
|
||||||
// Static members
|
|
||||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): kotlin.InlineOption
|
|
||||||
public final /*synthesized*/ fun values(): kotlin.Array<kotlin.InlineOption>
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int> {
|
public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int> {
|
||||||
/*primary*/ private constructor Int()
|
/*primary*/ private constructor Int()
|
||||||
public final fun and(/*0*/ other: kotlin.Int): kotlin.Int
|
public final fun and(/*0*/ other: kotlin.Int): kotlin.Int
|
||||||
@@ -1268,12 +1252,6 @@ public object Unit {
|
|||||||
/*primary*/ public constructor inline()
|
/*primary*/ public constructor inline()
|
||||||
}
|
}
|
||||||
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.MustBeDocumented() @kotlin.annotation.annotation() public final class inlineOptions : kotlin.Annotation {
|
|
||||||
/*primary*/ public constructor inlineOptions(/*0*/ vararg value: kotlin.InlineOption /*kotlin.Array<out kotlin.InlineOption>*/)
|
|
||||||
public final val value: kotlin.Array<out kotlin.InlineOption>
|
|
||||||
public final fun <get-value>(): kotlin.Array<out kotlin.InlineOption>
|
|
||||||
}
|
|
||||||
|
|
||||||
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.MustBeDocumented() @kotlin.annotation.annotation() public final class noinline : kotlin.Annotation {
|
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) @kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.MustBeDocumented() @kotlin.annotation.annotation() public final class noinline : kotlin.Annotation {
|
||||||
/*primary*/ public constructor noinline()
|
/*primary*/ public constructor noinline()
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
abstract class A<R> {
|
abstract class A<R> {
|
||||||
abstract fun getO() : R
|
abstract fun getO() : R
|
||||||
|
|||||||
compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.2.kt
Vendored
-1
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
abstract class A<R>(val param : R) {
|
abstract class A<R>(val param : R) {
|
||||||
abstract fun getO() : R
|
abstract fun getO() : R
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun testAllInline(f: () -> String) : String {
|
inline fun testAllInline(f: () -> String) : String {
|
||||||
val args = arrayOf("1", "2", "3")
|
val args = arrayOf("1", "2", "3")
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
public class Data()
|
public class Data()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package zzz
|
package zzz
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun calc(crossinline lambda: () -> Int): Int {
|
inline fun calc(crossinline lambda: () -> Int): Int {
|
||||||
return doCalc { lambda() }
|
return doCalc { lambda() }
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test1(param: String): String {
|
fun test1(param: String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> call(crossinline f: () -> R) : R {
|
inline fun <R> call(crossinline f: () -> R) : R {
|
||||||
return {f()} ()
|
return {f()} ()
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun testSameCaptured() : String {
|
fun testSameCaptured() : String {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
|
|||||||
-1
@@ -1,6 +1,5 @@
|
|||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun test1(crossinline param: () -> String): String {
|
inline fun test1(crossinline param: () -> String): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun test(): String {
|
inline fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun test(): String {
|
inline fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test()
|
return test()
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return test{"OK"}
|
return test{"OK"}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import builders.*
|
import builders.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun test(): String {
|
inline fun test(): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun<reified T> createArray(n: Int, crossinline block: () -> T): Array<T> {
|
inline fun<reified T> createArray(n: Int, crossinline block: () -> T): Array<T> {
|
||||||
return Array<T>(n) { block() }
|
return Array<T>(n) { block() }
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun<reified T> createArray(n: Int, crossinline block: () -> T): Array<T> {
|
inline fun<reified T> createArray(n: Int, crossinline block: () -> T): Array<T> {
|
||||||
return Array<T>(n) { block() }
|
return Array<T>(n) { block() }
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun<reified T1, reified T2> createArray(n: Int, crossinline block: () -> Pair<T1, T2>): Pair<Array<T1>, Array<T2>> {
|
inline fun<reified T1, reified T2> createArray(n: Int, crossinline block: () -> Pair<T1, T2>): Pair<Array<T1>, Array<T2>> {
|
||||||
return Pair(Array(n) { block().first }, Array(n) { block().second })
|
return Pair(Array(n) { block().first }, Array(n) { block().second })
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ val a: Enum<E> = E.ENTRY
|
|||||||
val b: Enum<RetentionPolicy> = RetentionPolicy.RUNTIME
|
val b: Enum<RetentionPolicy> = RetentionPolicy.RUNTIME
|
||||||
|
|
||||||
// Test deserialized resolve
|
// Test deserialized resolve
|
||||||
val c: Enum<InlineOption> = InlineOption.ONLY_LOCAL_RETURN
|
val c: Enum<AnnotationTarget> = AnnotationTarget.CLASS
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package
|
|||||||
|
|
||||||
public val a: kotlin.Enum<E>
|
public val a: kotlin.Enum<E>
|
||||||
public val b: kotlin.Enum<java.lang.annotation.RetentionPolicy>
|
public val b: kotlin.Enum<java.lang.annotation.RetentionPolicy>
|
||||||
public val c: kotlin.Enum<kotlin.InlineOption>
|
public val c: kotlin.Enum<kotlin.annotation.AnnotationTarget>
|
||||||
|
|
||||||
public final enum class E : kotlin.Enum<E> {
|
public final enum class E : kotlin.Enum<E> {
|
||||||
enum entry ENTRY
|
enum entry ENTRY
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||||
val s = object {
|
val s = object {
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||||
val s = object {
|
val s = object {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> onlyLocal(crossinline p: () -> R) {
|
inline fun <R> onlyLocal(crossinline p: () -> R) {
|
||||||
inlineAll(p)
|
inlineAll(p)
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunWithAnnotation(crossinline p: () -> R) {
|
inline fun <R> inlineFunWithAnnotation(crossinline p: () -> R) {
|
||||||
inlineFun {
|
inlineFun {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.ONLY_LOCAL_RETURN
|
|
||||||
|
|
||||||
inline fun testSameCaptured(lambdaWithResultCaptured: () -> Unit) : String {
|
inline fun testSameCaptured(lambdaWithResultCaptured: () -> Unit) : String {
|
||||||
doWork({<!NON_LOCAL_RETURN_NOT_ALLOWED!>lambdaWithResultCaptured<!>()})
|
doWork({<!NON_LOCAL_RETURN_NOT_ALLOWED!>lambdaWithResultCaptured<!>()})
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||||
<!NOT_YET_SUPPORTED_IN_INLINE!>fun a() {
|
<!NOT_YET_SUPPORTED_IN_INLINE!>fun a() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> inlineFunOnlyLocal(crossinline p: () -> R) {
|
||||||
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
<!NOT_YET_SUPPORTED_IN_INLINE!>class A {
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun <R> fun1(p: () -> R) {
|
fun <R> fun1(p: () -> R) {
|
||||||
inlineFun {
|
inlineFun {
|
||||||
|
|||||||
Vendored
-1
@@ -1,5 +1,4 @@
|
|||||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
class Z {
|
class Z {
|
||||||
inline fun <R> inlineFun(crossinline p: () -> R) {
|
inline fun <R> inlineFun(crossinline p: () -> R) {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> toOnlyLocal(crossinline p: () -> R) {
|
inline fun <R> toOnlyLocal(crossinline p: () -> R) {
|
||||||
p()
|
p()
|
||||||
|
|||||||
@@ -32,21 +32,13 @@ public annotation class noinline
|
|||||||
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/inline-functions.html) for more information.
|
* See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/inline-functions.html) for more information.
|
||||||
*
|
*
|
||||||
* @see noinline
|
* @see noinline
|
||||||
* @see inlineOptions
|
* @see crossinline
|
||||||
*/
|
*/
|
||||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@MustBeDocumented
|
@MustBeDocumented
|
||||||
public annotation class inline
|
public annotation class inline
|
||||||
|
|
||||||
/**
|
|
||||||
* @suppress
|
|
||||||
*/
|
|
||||||
@Target(AnnotationTarget.VALUE_PARAMETER)
|
|
||||||
@Retention(AnnotationRetention.RUNTIME)
|
|
||||||
@MustBeDocumented
|
|
||||||
public annotation class inlineOptions(vararg val value: InlineOption)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forbids use of non-local control flow statements within lambdas passed as arguments for this parameter.
|
* Forbids use of non-local control flow statements within lambdas passed as arguments for this parameter.
|
||||||
*/
|
*/
|
||||||
@@ -54,24 +46,3 @@ public annotation class inlineOptions(vararg val value: InlineOption)
|
|||||||
@Retention(AnnotationRetention.RUNTIME)
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
@MustBeDocumented
|
@MustBeDocumented
|
||||||
public annotation class crossinline
|
public annotation class crossinline
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies the control flow statements which are allowed to be used for non-local control flow transfer in a lambda
|
|
||||||
* passed as a parameter to an inline function.
|
|
||||||
*/
|
|
||||||
public enum class InlineOption {
|
|
||||||
/**
|
|
||||||
* This option hasn't been implemented yet.
|
|
||||||
*/
|
|
||||||
LOCAL_CONTINUE_AND_BREAK,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If this option is specified, lambdas may not use non-local return statements (statements which return from
|
|
||||||
* their calling function or one of its enclosing functions). This option must be specified if the lambda
|
|
||||||
* is not invoked directly by the receiving function but instead used in a different execution context
|
|
||||||
* (for example, from an object contained in the receiving function).
|
|
||||||
*
|
|
||||||
* By default, lambdas are allowed to use non-local returns.
|
|
||||||
*/
|
|
||||||
ONLY_LOCAL_RETURN
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ public class KotlinBuiltIns {
|
|||||||
public final FqName inline = fqName("inline");
|
public final FqName inline = fqName("inline");
|
||||||
public final FqName noinline = fqName("noinline");
|
public final FqName noinline = fqName("noinline");
|
||||||
public final FqName crossinline = fqName("crossinline");
|
public final FqName crossinline = fqName("crossinline");
|
||||||
public final FqName inlineOptions = fqName("inlineOptions");
|
|
||||||
public final FqName extension = fqName("Extension");
|
public final FqName extension = fqName("Extension");
|
||||||
public final FqName target = annotationName("Target");
|
public final FqName target = annotationName("Target");
|
||||||
public final FqName annotation = annotationName("annotation");
|
public final FqName annotation = annotationName("annotation");
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
import kotlin.InlineOption.ONLY_LOCAL_RETURN
|
|
||||||
|
|
||||||
// Note:
|
// Note:
|
||||||
// Right now we don't want to have neither 'volatile' nor 'synchronized' at runtime,
|
// Right now we don't want to have neither 'volatile' nor 'synchronized' at runtime,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
|
|||||||
-1
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
abstract class A<R> {
|
abstract class A<R> {
|
||||||
abstract fun getO() : R
|
abstract fun getO() : R
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
abstract class A<R>(val param : R) {
|
abstract class A<R>(val param : R) {
|
||||||
abstract fun getO() : R
|
abstract fun getO() : R
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun testAllInline(f: () -> String) : String {
|
inline fun testAllInline(f: () -> String) : String {
|
||||||
val args = arrayOf("1", "2", "3")
|
val args = arrayOf("1", "2", "3")
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
|
|||||||
Vendored
-1
@@ -6,7 +6,6 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun test1(param: String): String {
|
fun test1(param: String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
|
|||||||
Vendored
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> call(crossinline f: () -> R) : R {
|
inline fun <R> call(crossinline f: () -> R) : R {
|
||||||
return {f()} ()
|
return {f()} ()
|
||||||
|
|||||||
-1
@@ -6,7 +6,6 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
fun testSameCaptured() : String {
|
fun testSameCaptured() : String {
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import kotlin.InlineOption.*
|
|
||||||
|
|
||||||
public class Data()
|
public class Data()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user