mirror of
https://github.com/github/codeql.git
synced 2026-03-05 15:16:47 +01:00
Kotlin: Support apply
This commit is contained in:
21
java/ql/lib/semmle/code/java/frameworks/kotlin/Kotlin.qll
Normal file
21
java/ql/lib/semmle/code/java/frameworks/kotlin/Kotlin.qll
Normal 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()) }
|
||||
}
|
||||
Reference in New Issue
Block a user