@@ -434,7 +434,7 @@ protected void visitConstructorOrMethod(final MethodNode node, final boolean isC
434
434
}
435
435
436
436
private void visitStdMethod (final MethodNode node , final boolean isConstructor , final Parameter [] parameters , final Statement code ) {
437
- controller .getCompileStack ().init (node .getVariableScope (), parameters );
437
+ Label l0 = controller .getCompileStack ().init (node .getVariableScope (), parameters );
438
438
controller .getCallSiteWriter ().makeSiteEntry ();
439
439
440
440
MethodVisitor mv = controller .getMethodVisitor ();
@@ -450,6 +450,15 @@ private void visitStdMethod(final MethodNode node, final boolean isConstructor,
450
450
}
451
451
}
452
452
if (!hasCallToSuper ) {
453
+ // GRECLIPSE add -- GROOVY-9373
454
+ if (code != null ) {
455
+ int line = code .getLineNumber ();
456
+ if (line > 0 ) {
457
+ mv .visitLineNumber (line , l0 );
458
+ controller .setLineNumber (line );
459
+ }
460
+ }
461
+ // GRECLIPSE end
453
462
// add call to "super()"
454
463
mv .visitVarInsn (ALOAD , 0 );
455
464
mv .visitMethodInsn (INVOKESPECIAL , controller .getInternalBaseClassName (), "<init>" , "()V" , false );
@@ -467,6 +476,14 @@ private void visitStdMethod(final MethodNode node, final boolean isConstructor,
467
476
code .visit (this );
468
477
}
469
478
if (!checkIfLastStatementIsReturnOrThrow (code )) {
479
+ if (code != null ) {
480
+ // GROOVY-7647, GROOVY-9373
481
+ int line = code .getLastLineNumber ();
482
+ if (line > controller .getLineNumber ()) {
483
+ Label label = new Label (); mv .visitLabel (label );
484
+ mv .visitLineNumber (line , label ); controller .setLineNumber (line );
485
+ }
486
+ }
470
487
// GRECLIPSE end
471
488
if (node .isVoidMethod ()) {
472
489
mv .visitInsn (RETURN );
0 commit comments