Replace inlineOption(ONLY_LOCAL_RETURN) with crossinline in testData
This commit is contained in:
+2
-2
@@ -10,7 +10,7 @@ abstract class A<R> {
|
|||||||
abstract fun getParam() : R
|
abstract fun getParam() : R
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>() {
|
val s = object : A<R>() {
|
||||||
|
|
||||||
override fun getO(): R {
|
override fun getO(): R {
|
||||||
@@ -27,7 +27,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>() {
|
val s = object : A<R>() {
|
||||||
|
|
||||||
val p = param;
|
val p = param;
|
||||||
|
|||||||
compiler/testData/codegen/boxInline/anonymousObject/anonymousObjectOnDeclarationSiteSuperParams.2.kt
Vendored
+2
-2
@@ -8,7 +8,7 @@ abstract class A<R>(val param : R) {
|
|||||||
abstract fun getK() : R
|
abstract fun getK() : R
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>(param) {
|
val s = object : A<R>(param) {
|
||||||
|
|
||||||
override fun getO(): R {
|
override fun getO(): R {
|
||||||
@@ -21,7 +21,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) param: () -> R) : A<R> {
|
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, crossinline param: () -> R) : A<R> {
|
||||||
val s = object : A<R>(param()) {
|
val s = object : A<R>(param()) {
|
||||||
val o1 = jobO()
|
val o1 = jobO()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
|
inline fun bar(crossinline y: () -> String) = {
|
||||||
call(y)
|
call(y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
|
inline fun bar(crossinline y: () -> String) = {
|
||||||
{ { call(y) }() }()
|
{ { call(y) }() }()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,6 +7,6 @@ fun box(): String {
|
|||||||
return if (bar1 == "123" && bar2 == "1234") "OK" else "fail: $bar1 $bar2"
|
return if (bar1 == "123" && bar2 == "1234") "OK" else "fail: $bar1 $bar2"
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun bar2(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
|
inline fun bar2(crossinline y: () -> String) = {
|
||||||
{ { call(y) }() }()
|
{ { call(y) }() }()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
|
inline fun bar(crossinline y: () -> String) = {
|
||||||
{ { call(y) }() }()
|
{ { call(y) }() }()
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = {{ f() }()}()
|
public inline fun <T> call(crossinline f: () -> T): T = {{ f() }()}()
|
||||||
+2
-2
@@ -4,13 +4,13 @@ internal interface A<T> {
|
|||||||
fun run(): T;
|
fun run(): T;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = object : A<String> {
|
internal inline fun bar(crossinline y: () -> String) = object : A<String> {
|
||||||
override fun run() : String {
|
override fun run() : String {
|
||||||
return call(y)
|
return call(y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = object : A<T> {
|
public inline fun <T> call(crossinline f: () -> T): T = object : A<T> {
|
||||||
override fun run() : T {
|
override fun run() : T {
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -42,7 +42,7 @@ inline fun testAllInline(f: () -> String) : String {
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testHtmlNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
htmlNoInline() {
|
htmlNoInline() {
|
||||||
@@ -82,7 +82,7 @@ inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testBodyNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
html {
|
html {
|
||||||
@@ -122,7 +122,7 @@ inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testBodyHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testBodyHtmlNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
htmlNoInline {
|
htmlNoInline {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job()})
|
return notInline({k; job()})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -29,4 +29,4 @@ public fun Input.copyTo(output: Output, size: Int): Long {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public inline fun with2<T>(receiver : T, inlineOptions(ONLY_LOCAL_RETURN) body : T.() -> Unit) : Unit = {receiver.body()}()
|
public inline fun with2<T>(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package zzz
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun calc(inlineOptions(ONLY_LOCAL_RETURN) lambda: () -> Int): Int {
|
inline fun calc(crossinline lambda: () -> Int): Int {
|
||||||
return doCalc { lambda() }
|
return doCalc { lambda() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ fun test11(param: String): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test2(crossinline param: () -> String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
noInlineFun("stub") { a ->
|
noInlineFun("stub") { a ->
|
||||||
concat(param()) {
|
concat(param()) {
|
||||||
@@ -35,7 +35,7 @@ inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test22(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test22(crossinline param: () -> String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
{{result = param()}()}()
|
{{result = param()}()}()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> call(inlineOptions(ONLY_LOCAL_RETURN) f: () -> R) : R {
|
inline fun <R> call(crossinline f: () -> R) : R {
|
||||||
return {f()} ()
|
return {f()} ()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ fun testSameCaptured() : String {
|
|||||||
return if (result == 12) "OK" else "fail ${result}"
|
return if (result == 12) "OK" else "fail ${result}"
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testSameCaptured(inlineOptions(ONLY_LOCAL_RETURN) lambdaWithResultCaptured: () -> Unit) : String {
|
inline fun testSameCaptured(crossinline lambdaWithResultCaptured: () -> Unit) : String {
|
||||||
var result = 1;
|
var result = 1;
|
||||||
result = doWork({result+=11; lambdaWithResultCaptured(); result})
|
result = doWork({result+=11; lambdaWithResultCaptured(); result})
|
||||||
return if (result == 12) "OK" else "fail ${result}"
|
return if (result == 12) "OK" else "fail ${result}"
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job()})
|
return notInline({k; job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) job2: () -> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R, crossinline job2: () -> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job(); job2()})
|
return notInline({k; job(); job2()})
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
import test.*
|
import test.*
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun test1(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test1(crossinline param: () -> String): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
inlineFun("1") { c ->
|
inlineFun("1") { c ->
|
||||||
{
|
{
|
||||||
@@ -20,7 +20,7 @@ inline fun test1(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test2(crossinline param: () -> String): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
inlineFun("2") { a ->
|
inlineFun("2") { a ->
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test3(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test3(crossinline param: () -> String): String {
|
||||||
var result = "fail"
|
var result = "fail"
|
||||||
inlineFun("2") { d ->
|
inlineFun("2") { d ->
|
||||||
inlineFun("1") { c ->
|
inlineFun("1") { c ->
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
inline fun <reified R> foo() = bar<R>() {"OK"}
|
inline fun <reified R> foo() = bar<R>() {"OK"}
|
||||||
inline fun <reified E> bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
|
inline fun <reified E> bar(crossinline y: () -> String) = {
|
||||||
null is E
|
null is E
|
||||||
run(y)
|
run(y)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
inline fun <reified R, T> bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) tasksFactory: () -> T) = {
|
inline fun <reified R, T> bar(crossinline tasksFactory: () -> T) = {
|
||||||
null is R
|
null is R
|
||||||
run(tasksFactory)
|
run(tasksFactory)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return {
|
return {
|
||||||
init()
|
init()
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return init()
|
return init()
|
||||||
}
|
}
|
||||||
//NO_CHECK_LAMBDA_INLINING
|
//NO_CHECK_LAMBDA_INLINING
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return init()
|
return init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return object {
|
return object {
|
||||||
fun run () {
|
fun run () {
|
||||||
init()
|
init()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return init()
|
return init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return init()
|
return init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package builders
|
package builders
|
||||||
|
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
return init()
|
return init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
package builders
|
package builders
|
||||||
//TODO there is a bug in asm it's skips linenumber on same line on reading bytecode
|
//TODO there is a bug in asm it's skips linenumber on same line on reading bytecode
|
||||||
inline fun call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) init: () -> Unit) {
|
inline fun call(crossinline init: () -> Unit) {
|
||||||
"1"; return init()
|
"1"; return init()
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) p: () -> String): String {
|
inline fun test(crossinline p: () -> String): String {
|
||||||
var res = "Fail"
|
var res = "Fail"
|
||||||
|
|
||||||
call {
|
call {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import kotlin.InlineOption.*
|
|||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
|
|
||||||
inline fun inlineFoo(inlineOptions(ONLY_LOCAL_RETURN) s: () -> Unit) {
|
inline fun inlineFoo(crossinline s: () -> Unit) {
|
||||||
{
|
{
|
||||||
s()
|
s()
|
||||||
}()
|
}()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import kotlin.InlineOption.*
|
|||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
|
|
||||||
inline fun inlineFoo(inlineOptions(ONLY_LOCAL_RETURN) s: () -> Unit) {
|
inline fun inlineFoo(crossinline s: () -> Unit) {
|
||||||
val localObject = object {
|
val localObject = object {
|
||||||
fun run() {
|
fun run() {
|
||||||
s()
|
s()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package inlineFun1
|
package inlineFun1
|
||||||
|
|
||||||
inline fun myFun(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> Int): Int {
|
inline fun myFun(crossinline f: () -> Int): Int {
|
||||||
val o = object {
|
val o = object {
|
||||||
fun test() = 1
|
fun test() = 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package foo
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@ abstract class A<R> {
|
|||||||
abstract fun getParam() : R
|
abstract fun getParam() : R
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>() {
|
val s = object : A<R>() {
|
||||||
|
|
||||||
override fun getO(): R {
|
override fun getO(): R {
|
||||||
@@ -33,7 +33,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>() {
|
val s = object : A<R>() {
|
||||||
|
|
||||||
val p = param;
|
val p = param;
|
||||||
|
|||||||
+2
-2
@@ -13,7 +13,7 @@ abstract class A<R>(val param : R) {
|
|||||||
abstract fun getK() : R
|
abstract fun getK() : R
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, param: R) : A<R> {
|
inline fun <R> doWork(crossinline jobO: ()-> R, crossinline jobK: ()-> R, param: R) : A<R> {
|
||||||
val s = object : A<R>(param) {
|
val s = object : A<R>(param) {
|
||||||
|
|
||||||
override fun getO(): R {
|
override fun getO(): R {
|
||||||
@@ -26,7 +26,7 @@ inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptio
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWorkInConstructor(inlineOptions(ONLY_LOCAL_RETURN) jobO: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) jobK: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) param: () -> R) : A<R> {
|
inline fun <R> doWorkInConstructor(crossinline jobO: ()-> R, crossinline jobK: ()-> R, crossinline param: () -> R) : A<R> {
|
||||||
val s = object : A<R>(param()) {
|
val s = object : A<R>(param()) {
|
||||||
val o1 = jobO()
|
val o1 = jobO()
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -47,7 +47,7 @@ inline fun testAllInline(f: () -> String) : String {
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testHtmlNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
htmlNoInline() {
|
htmlNoInline() {
|
||||||
@@ -87,7 +87,7 @@ inline fun testHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testBodyNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
html {
|
html {
|
||||||
@@ -127,7 +127,7 @@ inline fun testBodyNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) :
|
|||||||
return result.toString()!!
|
return result.toString()!!
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testBodyHtmlNoInline(inlineOptions(ONLY_LOCAL_RETURN) f: () -> String) : String {
|
inline fun testBodyHtmlNoInline(crossinline f: () -> String) : String {
|
||||||
val args = array("1", "2", "3")
|
val args = array("1", "2", "3")
|
||||||
val result =
|
val result =
|
||||||
htmlNoInline {
|
htmlNoInline {
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
return notInline({job()})
|
return notInline({job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job()})
|
return notInline({k; job()})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -30,7 +30,7 @@ fun test11(param: String): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test2(crossinline param: () -> String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
noInlineFun("stub") { a ->
|
noInlineFun("stub") { a ->
|
||||||
concat(param()) {
|
concat(param()) {
|
||||||
@@ -41,7 +41,7 @@ inline fun test2(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun test22(inlineOptions(ONLY_LOCAL_RETURN) param: () -> String): String {
|
inline fun test22(crossinline param: () -> String): String {
|
||||||
var result = "fail1"
|
var result = "fail1"
|
||||||
{{result = param()}()}()
|
{{result = param()}()}()
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,6 +7,6 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> call(inlineOptions(ONLY_LOCAL_RETURN) f: () -> R) : R {
|
inline fun <R> call(crossinline f: () -> R) : R {
|
||||||
return {f()} ()
|
return {f()} ()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ fun testSameCaptured() : String {
|
|||||||
return if (result == 12) "OK" else "fail ${result}"
|
return if (result == 12) "OK" else "fail ${result}"
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun testSameCaptured(inlineOptions(ONLY_LOCAL_RETURN) lambdaWithResultCaptured: () -> Unit) : String {
|
inline fun testSameCaptured(crossinline lambdaWithResultCaptured: () -> Unit) : String {
|
||||||
var result = 1;
|
var result = 1;
|
||||||
result = doWork({result+=11; lambdaWithResultCaptured(); result})
|
result = doWork({result+=11; lambdaWithResultCaptured(); result})
|
||||||
return if (result == 12) "OK" else "fail ${result}"
|
return if (result == 12) "OK" else "fail ${result}"
|
||||||
|
|||||||
+2
-2
@@ -7,12 +7,12 @@ package test
|
|||||||
|
|
||||||
import kotlin.InlineOption.*
|
import kotlin.InlineOption.*
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job()})
|
return notInline({k; job()})
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <R> doWork(inlineOptions(ONLY_LOCAL_RETURN) job: ()-> R, inlineOptions(ONLY_LOCAL_RETURN) job2: () -> R) : R {
|
inline fun <R> doWork(crossinline job: ()-> R, crossinline job2: () -> R) : R {
|
||||||
val k = 10;
|
val k = 10;
|
||||||
return notInline({k; job(); job2()})
|
return notInline({k; job(); job2()})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,4 +33,4 @@ public fun Input.copyTo(output: Output, size: Int): Int {
|
|||||||
return output.doOutput(this.data())
|
return output.doOutput(this.data())
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun with2<T>(receiver : T, inlineOptions(ONLY_LOCAL_RETURN) body : T.() -> Unit) : Unit = {receiver.body()}()
|
public inline fun with2<T>(receiver : T, crossinline body : T.() -> Unit) : Unit = {receiver.body()}()
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
inline
|
inline
|
||||||
public fun apply<T, R>(x: T, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) fn: (T)->R): R {
|
public fun apply<T, R>(x: T, crossinline fn: (T)->R): R {
|
||||||
val result = object {
|
val result = object {
|
||||||
val x = fn(x)
|
val x = fn(x)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user