From 2d509b3211aaf1f9bec2d0af7b43da558d547c62 Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Tue, 26 May 2015 18:31:19 +0300 Subject: [PATCH] Write correct lineNumbers for properties with comments --- .../org/jetbrains/kotlin/backend/common/CodegenUtil.java | 3 +-- idea/testData/debugger/tinyApp/outs/fieldWatchpoints.out | 6 +++--- .../debugger/tinyApp/outs/withoutBodyProperties.out | 9 ++++----- .../multipleBreakpoints/withoutBodyProperties.kt | 9 ++++----- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java index 3d4400a8798..92e576a916b 100644 --- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java +++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java @@ -224,7 +224,6 @@ public class CodegenUtil { } } Document document = file.getViewProvider().getDocument(); - TextRange textRange = statement.getTextRange(); - return document != null ? document.getLineNumber(markEndOffset ? textRange.getEndOffset() : textRange.getStartOffset()) + 1 : null; + return document != null ? document.getLineNumber(markEndOffset ? statement.getTextRange().getEndOffset() : statement.getTextOffset()) + 1 : null; } } diff --git a/idea/testData/debugger/tinyApp/outs/fieldWatchpoints.out b/idea/testData/debugger/tinyApp/outs/fieldWatchpoints.out index aa1bde9a489..a1c1179a1e0 100644 --- a/idea/testData/debugger/tinyApp/outs/fieldWatchpoints.out +++ b/idea/testData/debugger/tinyApp/outs/fieldWatchpoints.out @@ -32,11 +32,11 @@ fieldWatchpoints.kt:62 fieldWatchpoints.kt:45 fieldWatchpoints.kt:48 fieldWatchpoints.kt:62 -fieldWatchpoints.kt:44 +fieldWatchpoints.kt:45 fieldWatchpoints.kt:51 -fieldWatchpoints.kt:47 +fieldWatchpoints.kt:48 fieldWatchpoints.kt:52 -fieldWatchpoints.kt:47 +fieldWatchpoints.kt:48 fieldWatchpoints.kt:54 fieldWatchpoints.kt:63 Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' diff --git a/idea/testData/debugger/tinyApp/outs/withoutBodyProperties.out b/idea/testData/debugger/tinyApp/outs/withoutBodyProperties.out index a5283e2b7cc..679135eeca3 100644 --- a/idea/testData/debugger/tinyApp/outs/withoutBodyProperties.out +++ b/idea/testData/debugger/tinyApp/outs/withoutBodyProperties.out @@ -3,8 +3,8 @@ LineBreakpoint created at withoutBodyProperties.kt:13 LineBreakpoint created at withoutBodyProperties.kt:18 LineBreakpoint created at withoutBodyProperties.kt:23 LineBreakpoint created at withoutBodyProperties.kt:28 -LineBreakpoint created at withoutBodyProperties.kt:39 -LineBreakpoint created at withoutBodyProperties.kt:46 +LineBreakpoint created at withoutBodyProperties.kt:36 +LineBreakpoint created at withoutBodyProperties.kt:43 !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! withoutBodyProperties.WithoutBodyPropertiesPackage Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' withoutBodyProperties.kt:8 @@ -17,10 +17,9 @@ withoutBodyProperties.kt:23 Compile bytecode for 1 + 4 withoutBodyProperties.kt:28 Compile bytecode for 1 + 5 -withoutBodyProperties.kt:39 +withoutBodyProperties.kt:36 Compile bytecode for i -withoutBodyProperties.kt:39 -withoutBodyProperties.kt:46 +withoutBodyProperties.kt:43 Compile bytecode for 1 + 6 Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' diff --git a/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyProperties.kt b/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyProperties.kt index 4378fe56b2c..60de03c92fc 100644 --- a/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyProperties.kt +++ b/idea/testData/debugger/tinyApp/src/evaluate/multipleBreakpoints/withoutBodyProperties.kt @@ -31,10 +31,7 @@ class A { init { // EXPRESSION: i // RESULT: 1: I - - // EXPRESSION: i - // RESULT: 2: I - for (i in 1..2) { + for (i in 1..1) { //Breakpoint! val a = 1 } @@ -44,6 +41,8 @@ class A { // RESULT: 7: I //Breakpoint! val prop = 1 + + fun test()= prop } fun main(args: Array) { @@ -53,5 +52,5 @@ fun main(args: Array) { aWoBody aWoBody2 - A().prop + A().test() } \ No newline at end of file