Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X a67493f91 -> b018d520e


GROOVY-7647: Incorrect line information for debug (closes #830)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b018d520
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b018d520
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b018d520

Branch: refs/heads/GROOVY_2_4_X
Commit: b018d520e10c1ab030515bee69b6f9c812e9769b
Parents: a67493f
Author: Paul King <pa...@asert.com.au>
Authored: Fri Nov 23 16:29:06 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Fri Dec 7 10:35:09 2018 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/classgen/asm/StatementWriter.java     | 7 +++++++
 .../groovy/classgen/asm/sc/StaticCompilationTest.groovy       | 3 +--
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b018d520/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
index e488d5a..0126e07 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
@@ -94,6 +94,13 @@ public class StatementWriter {
         }
         compileStack.pop();
 
+        // GROOVY-7647
+        if (block.getLastLineNumber() > 0) {
+            MethodVisitor mv = controller.getMethodVisitor();
+            Label blockEnd = new Label(); mv.visitLabel(blockEnd);
+            mv.visitLineNumber(block.getLastLineNumber(), blockEnd);
+        }
+
         controller.getOperandStack().popDownTo(mark);
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/b018d520/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTest.groovy
----------------------------------------------------------------------
diff --git 
a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTest.groovy 
b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTest.groovy
index ceaf7bb..2252b47 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTest.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/StaticCompilationTest.groovy
@@ -19,8 +19,6 @@
 package org.codehaus.groovy.classgen.asm.sc
 
 import org.codehaus.groovy.classgen.asm.AbstractBytecodeTestCase
-import org.codehaus.groovy.control.CompilerConfiguration
-import org.codehaus.groovy.transform.stc.GroovyTypeCheckingExtensionSupport
 
 class StaticCompilationTest extends AbstractBytecodeTestCase {
     void testEmptyMethod() {
@@ -31,6 +29,7 @@ class StaticCompilationTest extends AbstractBytecodeTestCase {
         assert bytecode.hasStrictSequence(
                 ['public m()V',
                         'L0',
+                        'LINENUMBER 3 L0',
                         'RETURN']
         )
     }

Reply via email to