Raw FIR: introduce lambda argument expressions
Without it we cannot distinguish lambda argument from just last argument
This commit is contained in:
@@ -312,7 +312,11 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
||||
|
||||
private fun KtCallElement.extractArgumentsTo(container: FirAbstractCall) {
|
||||
for (argument in this.valueArguments) {
|
||||
container.arguments += argument.toFirExpression()
|
||||
val argumentExpression = argument.toFirExpression()
|
||||
container.arguments += when (argument) {
|
||||
is KtLambdaArgument -> FirLambdaArgumentExpressionImpl(session, argument, argumentExpression)
|
||||
else -> argumentExpression
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1244,9 +1248,7 @@ class RawFirBuilder(val session: FirSession, val stubMode: Boolean) {
|
||||
}
|
||||
this.calleeReference = calleeReference
|
||||
firFunctionCalls += this
|
||||
for (argument in expression.valueArguments) {
|
||||
arguments += argument.toFirExpression()
|
||||
}
|
||||
expression.extractArgumentsTo(this)
|
||||
for (typeArgument in expression.typeArguments) {
|
||||
typeArguments += typeArgument.convert<FirTypeProjection>()
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ FILE: lambda.kt
|
||||
|
||||
}
|
||||
|
||||
use#(use@fun <implicit>.<anonymous>(<destruct>: <implicit>): <implicit> {
|
||||
use#(<L> = use@fun <implicit>.<anonymous>(<destruct>: <implicit>): <implicit> {
|
||||
^ {
|
||||
lval x: <implicit> = <destruct>#.component1()
|
||||
lval y: <implicit> = <destruct>#.component2()
|
||||
@@ -33,7 +33,7 @@ FILE: lambda.kt
|
||||
|
||||
}
|
||||
)
|
||||
^foo use#(use@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^foo use#(<L> = use@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^ {
|
||||
when () {
|
||||
==(it#.x#, Int(0)) -> {
|
||||
@@ -50,7 +50,7 @@ FILE: lambda.kt
|
||||
)
|
||||
}
|
||||
public? final? fun bar(): Int {
|
||||
^bar use#(lambda@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^bar use#(<L> = lambda@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^ {
|
||||
when () {
|
||||
==(it#.x#, Int(0)) -> {
|
||||
@@ -68,7 +68,7 @@ FILE: lambda.kt
|
||||
}
|
||||
public? final? fun test(list: List<Int>): kotlin/Unit {
|
||||
lval map: <implicit> = mutableMapOf#<Int, String>()
|
||||
list#.forEach#(forEach@fun <implicit>.<anonymous>(): <implicit> {
|
||||
list#.forEach#(<L> = forEach@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^ {
|
||||
lval <complex-set>: <implicit> = map#.getOrPut#(it#, getOrPut@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^ {
|
||||
|
||||
@@ -26,7 +26,7 @@ FILE: these.kt
|
||||
^extension this#.bar#()
|
||||
}
|
||||
public? final? fun test(some: Some): Int {
|
||||
^test with#(some#, with@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^test with#(some#, <L> = with@fun <implicit>.<anonymous>(): <implicit> {
|
||||
^ {
|
||||
this#.foo#().plus#(this@with.extension#())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user