Merge pull request #13702 from atorralba/atorralba/kotlin/apply

Kotlin: Support apply
This commit is contained in:
Tony Torralba
2023-07-10 17:39:57 +02:00
committed by GitHub
6 changed files with 43 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/** Provides classes and predicates related to `kotlin`. */
import java
/** A call to Kotlin's `apply` method. */
class KotlinApply extends MethodAccess {
ExtensionMethod m;
KotlinApply() {
this.getMethod() = m and
m.hasQualifiedName("kotlin", "StandardKt", "apply")
}
/** Gets the function block argument of this call. */
LambdaExpr getLambdaArg() {
result = this.getArgument(m.getExtensionReceiverParameterIndex() + 1)
}
/** Gets the receiver argument of this call. */
Argument getReceiver() { result = this.getArgument(m.getExtensionReceiverParameterIndex()) }
}