Line numbers for traits
This commit is contained in:
@@ -1406,7 +1406,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull FunctionDescriptor inheritedFun) {
|
||||
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull final FunctionDescriptor inheritedFun) {
|
||||
functionCodegen.generateMethod(
|
||||
DelegationToTraitImpl(descriptorToDeclaration(traitFun), traitFun),
|
||||
inheritedFun,
|
||||
@@ -1415,6 +1415,13 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
DeclarationDescriptor containingDeclaration = traitFun.getContainingDeclaration();
|
||||
if (!DescriptorUtils.isTrait(containingDeclaration)) return;
|
||||
|
||||
DeclarationDescriptor declarationInheritedFun = inheritedFun.getContainingDeclaration();
|
||||
PsiElement classForInheritedFun = descriptorToDeclaration(declarationInheritedFun);
|
||||
if (classForInheritedFun instanceof JetDeclaration) {
|
||||
codegen.markLineNumber((JetElement) classForInheritedFun, false);
|
||||
}
|
||||
|
||||
ClassDescriptor containingTrait = (ClassDescriptor) containingDeclaration;
|
||||
Type traitImplType = typeMapper.mapTraitImpl(containingTrait);
|
||||
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
LineBreakpoint created at traits.kt:5
|
||||
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! traits.TraitsPackage
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
traits.kt:5
|
||||
traits.kt:6
|
||||
traits.kt:41
|
||||
traits.kt:27
|
||||
traits.kt:41
|
||||
traits.kt:6
|
||||
traits.kt:7
|
||||
traits.kt:41
|
||||
traits.kt:31
|
||||
traits.kt:41
|
||||
traits.kt:7
|
||||
traits.kt:8
|
||||
traits.kt:43
|
||||
traits.kt:8
|
||||
traits.kt:9
|
||||
traits.kt:47
|
||||
traits.kt:9
|
||||
traits.kt:11
|
||||
traits.kt:19
|
||||
traits.kt:11
|
||||
traits.kt:27
|
||||
traits.kt:11
|
||||
traits.kt:19
|
||||
traits.kt:20
|
||||
traits.kt:11
|
||||
traits.kt:31
|
||||
traits.kt:11
|
||||
traits.kt:20
|
||||
traits.kt:21
|
||||
traits.kt:13
|
||||
traits.kt:34
|
||||
traits.kt:13
|
||||
traits.kt:21
|
||||
traits.kt:22
|
||||
traits.kt:17
|
||||
traits.kt:38
|
||||
traits.kt:17
|
||||
traits.kt:22
|
||||
traits.kt:23
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -0,0 +1,50 @@
|
||||
package traits
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
//Breakpoint!
|
||||
val impl = MyInterfaceImpl()
|
||||
impl.inInterface()
|
||||
impl.propInInterface
|
||||
impl.inInterfaceOverride()
|
||||
impl.propInInterfaceOverride
|
||||
|
||||
val o = object: MyInterface {
|
||||
override fun inInterfaceOverride(): Int {
|
||||
return super.inInterfaceOverride()
|
||||
}
|
||||
|
||||
override val propInInterfaceOverride: Int
|
||||
get() = super.propInInterfaceOverride
|
||||
}
|
||||
o.inInterface()
|
||||
o.propInInterface
|
||||
o.inInterfaceOverride()
|
||||
o.propInInterfaceOverride
|
||||
}
|
||||
|
||||
interface MyInterface {
|
||||
fun inInterface(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
val propInInterface: Int
|
||||
get() = 1
|
||||
|
||||
fun inInterfaceOverride(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
val propInInterfaceOverride: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
class MyInterfaceImpl: MyInterface {
|
||||
override fun inInterfaceOverride(): Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override val propInInterfaceOverride: Int
|
||||
get() = 1
|
||||
}
|
||||
|
||||
// STEP_INTO: 38
|
||||
@@ -265,6 +265,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
||||
doStepIntoTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("traits.kt")
|
||||
public void testTraits() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepInto/traits.kt");
|
||||
doStepIntoTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("whenExpr.kt")
|
||||
public void testWhenExpr() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepInto/whenExpr.kt");
|
||||
|
||||
Reference in New Issue
Block a user