mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Add ExtensionMethod class
This commit is contained in:
@@ -1059,3 +1059,7 @@ ktBreakContinueTarget(
|
||||
unique int id: @breakcontinuestmt ref,
|
||||
int target: @ktloopstmt ref
|
||||
)
|
||||
|
||||
ktExtensionFunctions(
|
||||
unique int id: @method ref
|
||||
)
|
||||
|
||||
@@ -670,3 +670,13 @@ class Field extends Member, ExprParent, @field, Variable {
|
||||
class InstanceField extends Field {
|
||||
InstanceField() { not this.isStatic() }
|
||||
}
|
||||
|
||||
/** A Kotlin extension function. */
|
||||
class ExtensionMethod extends Method {
|
||||
ExtensionMethod() { ktExtensionFunctions(this) }
|
||||
|
||||
/** Gets the type being extended by this method. */
|
||||
Type getExtendedType() { result = getParameter(-1).getType() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExtensionMethod" }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
methods
|
||||
| methods2.kt:4:1:5:1 | fooBarTopLevelMethod |
|
||||
| methods2.kt:7:1:10:1 | <init> |
|
||||
| methods2.kt:7:1:10:1 | equals |
|
||||
@@ -17,3 +18,6 @@
|
||||
| methods.kt:5:1:13:1 | toString |
|
||||
| methods.kt:6:5:7:5 | classMethod |
|
||||
| methods.kt:9:5:12:5 | anotherClassMethod |
|
||||
extensions
|
||||
| methods3.kt:3:1:3:39 | fooBarTopLevelMethod | file://:0:0:0:0 | int |
|
||||
| methods3.kt:6:5:6:43 | fooBarTopLevelMethod | file://:0:0:0:0 | int |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import java
|
||||
|
||||
from Method m
|
||||
select m
|
||||
query predicate methods(Method m) { any() }
|
||||
|
||||
query predicate extensions(ExtensionMethod m, Type t) { m.getExtendedType() = t }
|
||||
|
||||
Reference in New Issue
Block a user