Revert "Remove ExtensionMethodAccess to see extension method flows"

This reverts commit 9df4f2074379ba4668054a2a66eaaaaf5cb9b6c8.
This commit is contained in:
Tamas Vajk
2022-03-31 14:05:06 +02:00
committed by Ian Lynagh
parent a9711b8c88
commit 38ab7acf3e
4 changed files with 4 additions and 14 deletions

View File

@@ -550,13 +550,12 @@ private module ControlFlowGraphImpl {
or
index = 0 and result = this.(RValue).getQualifier() and not result instanceof TypeAccess
or
exists(Call e | e = this | // and not e instanceof ExtensionMethodAccess |
exists(Call e | e = this and not e instanceof ExtensionMethodAccess |
index = -1 and result = e.getQualifier() and not result instanceof TypeAccess
or
result = e.getArgument(index)
)
or
/*
exists(ExtensionMethodAccess e | e = this |
// the actual qualifier of the expression method access
index = -1 and result.(Expr).isNthChildOf(this, index) and not result instanceof TypeAccess
@@ -568,7 +567,6 @@ private module ControlFlowGraphImpl {
result = e.getArgument(index - 1)
)
or
*/
exists(StringTemplateExpr e | e = this | result = e.getComponent(index))
or
index = 0 and result = this.(ClassExpr).getExpr()

View File

@@ -1987,7 +1987,6 @@ class MethodAccess extends Expr, Call, @methodaccess {
/**
* An invocation of a Kotlin `ExtensionMethod`.
*/
/*
class ExtensionMethodAccess extends MethodAccess {
ExtensionMethodAccess() { this.getMethod() instanceof ExtensionMethod }
@@ -1999,7 +1998,6 @@ class ExtensionMethodAccess extends MethodAccess {
override Expr getArgument(int index) { result = super.getArgument(index + 1) and index >= 0 }
}
*/
/** A type access is a (possibly qualified) reference to a type. */
class TypeAccess extends Expr, Annotatable, @typeaccess {

View File

@@ -111,18 +111,16 @@ class Parameter extends Element, @param, LocalScopeVariable {
(
exists(int idx |
(
idx = i //and not call instanceof ExtensionMethodAccess
// or
// idx = i - 1 and call instanceof ExtensionMethodAccess
idx = i and not call instanceof ExtensionMethodAccess
or
idx = i - 1 and call instanceof ExtensionMethodAccess
) and
result = call.getArgument(idx)
)
/*
or
i = 0 and
call instanceof ExtensionMethodAccess and
result = call.getQualifier()
*/
) and
call.getCallee().getSourceDeclaration().getAParameter() = this
)

View File

@@ -1,6 +1,2 @@
| test.kt:20:29:20:31 | new C(...) | test.kt:23:22:23:28 | self1(...) |
| test.kt:20:29:20:31 | new C(...) | test.kt:26:22:26:28 | self2(...) |
| test.kt:20:29:20:31 | new C(...) | test.kt:29:18:29:29 | fn1(...) |
| test.kt:20:29:20:31 | new C(...) | test.kt:32:18:32:29 | fn2(...) |
| test.kt:20:29:20:31 | new C(...) | test.kt:35:18:35:31 | call1(...) |
| test.kt:20:29:20:31 | new C(...) | test.kt:38:22:38:28 | call2(...) |