Extract Function: Add support for member extension functions
This commit is contained in:
+1
-1
@@ -307,7 +307,7 @@ private fun suggestParameterType(
|
||||
|
||||
private fun isMemberExtensionFunction(resolvedCall: ResolvedCall<*>, ref: KtSimpleNameExpression): Boolean {
|
||||
// TODO temporary hack because we couldn't correctly extract member extension function with two explicit receivers
|
||||
if (ref.parent !is KtCallExpression || ref.parent.parent !is KtQualifiedExpression) return false
|
||||
if (ref.parent !is KtCallExpression) return false
|
||||
|
||||
val resultingDescriptor = resolvedCall.resultingDescriptor
|
||||
return resultingDescriptor is FunctionDescriptor && resolvedCall.extensionReceiver != ReceiverValue.NO_RECEIVER && resolvedCall.dispatchReceiver != ReceiverValue.NO_RECEIVER
|
||||
|
||||
@@ -19,23 +19,35 @@ Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socke
|
||||
extensionMemberFunction.kt:13
|
||||
Compile bytecode for extClass.testPublic()
|
||||
extensionMemberFunction.kt:19
|
||||
Compile bytecode for testPublic()
|
||||
extensionMemberFunction.kt:25
|
||||
Compile bytecode for extClass.testPrivate()
|
||||
extensionMemberFunction.kt:31
|
||||
Compile bytecode for testPrivate()
|
||||
extensionMemberFunction.kt:41
|
||||
Compile bytecode for testPublic()
|
||||
extensionMemberFunction.kt:46
|
||||
Compile bytecode for this.testPublic()
|
||||
extensionMemberFunction.kt:51
|
||||
Compile bytecode for testPrivate()
|
||||
extensionMemberFunction.kt:56
|
||||
Compile bytecode for this.testPrivate()
|
||||
extensionMemberFunction.kt:70
|
||||
Compile bytecode for extClass.testCompPublic()
|
||||
extensionMemberFunction.kt:76
|
||||
Compile bytecode for testCompPublic()
|
||||
extensionMemberFunction.kt:82
|
||||
Compile bytecode for extClass.testCompPrivate()
|
||||
extensionMemberFunction.kt:88
|
||||
Compile bytecode for testCompPrivate()
|
||||
extensionMemberFunction.kt:98
|
||||
Compile bytecode for testCompPublic()
|
||||
extensionMemberFunction.kt:103
|
||||
Compile bytecode for this.testCompPublic()
|
||||
extensionMemberFunction.kt:108
|
||||
Compile bytecode for testCompPrivate()
|
||||
extensionMemberFunction.kt:113
|
||||
Compile bytecode for this.testCompPrivate()
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+12
-12
@@ -14,7 +14,7 @@ class MemberClass {
|
||||
|
||||
with(extClass) {
|
||||
// EXPRESSION: testPublic()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testPublic
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testPublic()
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class MemberClass {
|
||||
|
||||
with(extClass) {
|
||||
// EXPRESSION: testPrivate()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testPrivate
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testPrivate()
|
||||
}
|
||||
@@ -36,22 +36,22 @@ class MemberClass {
|
||||
|
||||
fun ExtClass.testExtMember() {
|
||||
// EXPRESSION: testPublic()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testPublic
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testPublic()
|
||||
|
||||
// EXPRESSION: this.testPublic()
|
||||
// RESULT: A receiver of type extensionMemberFunction.ExtClass is required
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
this.testPublic()
|
||||
|
||||
// EXPRESSION: testPrivate()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testPrivate
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testPrivate()
|
||||
|
||||
// EXPRESSION: this.testPrivate()
|
||||
// RESULT: A receiver of type extensionMemberFunction.ExtClass is required
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
this.testPrivate()
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class MemberClass {
|
||||
|
||||
with(extClass) {
|
||||
// EXPRESSION: testCompPublic()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testCompPublic
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testCompPublic()
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class MemberClass {
|
||||
|
||||
with(extClass) {
|
||||
// EXPRESSION: testCompPrivate()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testCompPrivate
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testCompPrivate()
|
||||
}
|
||||
@@ -93,22 +93,22 @@ class MemberClass {
|
||||
|
||||
fun ExtClass.testExtCompanion() {
|
||||
// EXPRESSION: testCompPublic()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testCompPublic
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testCompPublic()
|
||||
|
||||
// EXPRESSION: this.testCompPublic()
|
||||
// RESULT: A receiver of type extensionMemberFunction.ExtClass is required
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
this.testCompPublic()
|
||||
|
||||
// EXPRESSION: testCompPrivate()
|
||||
// RESULT: Following declarations are unavailable in debug scope: testCompPrivate
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
testCompPrivate()
|
||||
|
||||
// EXPRESSION: this.testCompPrivate()
|
||||
// RESULT: A receiver of type extensionMemberFunction.ExtClass is required
|
||||
// RESULT: 1: I
|
||||
//Breakpoint!
|
||||
this.testCompPrivate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user