Uast: fix for Lambda in place call identifiers (KT-35432)
This commit is contained in:
+2
@@ -83,6 +83,8 @@ class KotlinUFunctionCallExpression(
|
|||||||
KotlinUIdentifier(
|
KotlinUIdentifier(
|
||||||
calleeExpression.constructorReferenceExpression?.getReferencedNameElement() ?: calleeExpression, this
|
calleeExpression.constructorReferenceExpression?.getReferencedNameElement() ?: calleeExpression, this
|
||||||
)
|
)
|
||||||
|
is KtLambdaExpression ->
|
||||||
|
KotlinUIdentifier(calleeExpression.functionLiteral.lBrace, this)
|
||||||
else -> KotlinUIdentifier(calleeExpression, this)
|
else -> KotlinUIdentifier(calleeExpression, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
java -> USimpleNameReferenceExpression (identifier = java)
|
||||||
|
util -> USimpleNameReferenceExpression (identifier = util)
|
||||||
|
stream -> USimpleNameReferenceExpression (identifier = stream)
|
||||||
|
Stream -> USimpleNameReferenceExpression (identifier = Stream)
|
||||||
|
foo -> UMethod (name = foo)
|
||||||
|
Stream -> USimpleNameReferenceExpression (identifier = Stream)
|
||||||
|
empty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
String -> USimpleNameReferenceExpression (identifier = String)
|
||||||
|
filter -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1))
|
||||||
|
it -> USimpleNameReferenceExpression (identifier = it)
|
||||||
|
isEmpty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
doSelectItem -> UMethod (name = doSelectItem)
|
||||||
|
selectItemFunction -> UParameter (name = selectItemFunction)
|
||||||
|
Unit -> USimpleNameReferenceExpression (identifier = Unit)
|
||||||
|
selectItemFunction -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
baz -> ULocalVariable (name = baz)
|
||||||
|
Local -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
baz -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
lambdaInPlaceCall -> UMethod (name = lambdaInPlaceCall)
|
||||||
+6
@@ -11,3 +11,9 @@ fun doSelectItem(selectItemFunction: () -> Unit) {
|
|||||||
}
|
}
|
||||||
baz()
|
baz()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun lambdaInPlaceCall() {
|
||||||
|
while ({ true }()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,3 +37,10 @@ UFile (package = )
|
|||||||
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
UIdentifier (Identifier (baz))
|
UIdentifier (Identifier (baz))
|
||||||
USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null)
|
USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null)
|
||||||
|
UMethod (name = lambdaInPlaceCall)
|
||||||
|
UBlockExpression
|
||||||
|
UWhileExpression
|
||||||
|
UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0))
|
||||||
|
UIdentifier (Identifier ({))
|
||||||
|
USimpleNameReferenceExpression (identifier = invoke, resolvesTo = null)
|
||||||
|
UBlockExpression
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Stream -> USimpleNameReferenceExpression (identifier = Stream) from KtDotQualifiedExpression
|
||||||
|
stream -> USimpleNameReferenceExpression (identifier = stream) from KtDotQualifiedExpression
|
||||||
|
util -> USimpleNameReferenceExpression (identifier = util) from KtDotQualifiedExpression
|
||||||
|
java -> USimpleNameReferenceExpression (identifier = java) from KtNameReferenceExpression
|
||||||
|
util -> USimpleNameReferenceExpression (identifier = util) from KtNameReferenceExpression
|
||||||
|
stream -> USimpleNameReferenceExpression (identifier = stream) from KtNameReferenceExpression
|
||||||
|
Stream -> USimpleNameReferenceExpression (identifier = Stream) from KtNameReferenceExpression
|
||||||
|
filter -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) from KtDotQualifiedExpression
|
||||||
|
empty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtDotQualifiedExpression
|
||||||
|
Stream -> USimpleNameReferenceExpression (identifier = Stream) from KtNameReferenceExpression
|
||||||
|
empty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtNameReferenceExpression
|
||||||
|
String -> USimpleNameReferenceExpression (identifier = String) from KtNameReferenceExpression
|
||||||
|
filter -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 1)) from KtNameReferenceExpression
|
||||||
|
isEmpty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtDotQualifiedExpression
|
||||||
|
it -> USimpleNameReferenceExpression (identifier = it) from KtNameReferenceExpression
|
||||||
|
isEmpty -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtNameReferenceExpression
|
||||||
|
Unit -> USimpleNameReferenceExpression (identifier = Unit) from KtNameReferenceExpression
|
||||||
|
selectItemFunction -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtNameReferenceExpression
|
||||||
|
Local -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtNameReferenceExpression
|
||||||
|
baz -> UCallExpression (kind = UastCallKind(name='method_call'), argCount = 0)) from KtNameReferenceExpression
|
||||||
@@ -13,4 +13,8 @@ public final class LambdasKt {
|
|||||||
}
|
}
|
||||||
invoke()
|
invoke()
|
||||||
}
|
}
|
||||||
|
public static final fun lambdaInPlaceCall() : void {
|
||||||
|
while (invoke()) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ class KotlinUastIdentifiersTest : AbstractKotlinIdentifiersTest() {
|
|||||||
@Test
|
@Test
|
||||||
fun testAnonymous() = doTest("Anonymous")
|
fun testAnonymous() = doTest("Anonymous")
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testLambdas() = doTest("Lambdas")
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSuperCalls() = doTest("SuperCalls")
|
fun testSuperCalls() = doTest("SuperCalls")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user