Created
July 17, 2019 15:01
-
-
Save shahsurajk/5b9fb17180714e5b27496f5e5b1eb54c to your computer and use it in GitHub Desktop.
No inline demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun parameterPassedToOtherInlineFunction(lambda1: () -> Unit, noinline lambda2: () -> Boolean){ | |
// normal invoke, this is a normal lambda. | |
lambda1.invoke() | |
// passing the lambda to another function which doesn't inline this lambda | |
// will throw an error if lambda2 is not marked as noinline | |
someNonInlinedLambdaConsumingFunction(lambda2) | |
} | |
fun someNonInlinedLambdaConsumingFunction(lambda: () -> Boolean) : Boolean{ | |
return lambda.invoke() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment