[FIR] Bind return expression to function symbol instead of function itself

This commit is contained in:
Dmitriy Novozhilov
2021-03-01 17:57:02 +03:00
committed by TeamCityServer
parent 245bc7c8e2
commit 714c2a8f93
12 changed files with 82 additions and 5 deletions
@@ -0,0 +1,20 @@
class ASTNode
class Wrap(val message: String)
typealias WrappingStrategy = (childElement: ASTNode) -> Wrap?
fun getWrappingStrategy(): WrappingStrategy {
return wrap@{ childElement ->
Wrap("OK").let {
return@wrap it
}
}
}
fun getWrapAfterAnnotation(childElement: ASTNode): Wrap? {
return Wrap("OK")
}
fun box(): String {
return getWrappingStrategy().invoke(ASTNode())?.message ?: "fail"
}