Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353513

Summary: SMAP missing line information for variable declarations
Product: z_Archived Reporter: Justin Spadea <jspadea>
Component: EDTAssignee: Jeff Douglas <jeffdouglas>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Justin Spadea CLA 2011-08-01 12:33:30 EDT
Variable declarations don't have line mappings in the SMAP, making the debugger display "line: not available" instead of the line number. The current position is also not highlighted in the editor.
Comment 1 Justin Spadea CLA 2011-08-01 14:15:20 EDT
Jeff - I updated Egl2MofStatement to add the location annotation to DeclarationExpressions of LocalVariableDeclarationStatements, however the SMAP is mapping the declaration to have 1 more line than it really does. This throws off the stepping.

The reason is that declaration expressions end with a new line, while other expressions do not. This means the current Java line has been incremented so that the SMAP code will say it's 2 lines of Java code instead of 1.

I saw for Context.invoke(Statement) that it decrements lastJavaLineNumber by 1, since it knows statements will have ended with a newline (is that a safe assumption?). The same needs to be done for DeclarationExpressions.

I could have easily added to Context.invoke(Expression):
if (object instanceof DeclarationExpression) {
	lastJavaLineNumber--;
}

But I don't know if that breaks any rules with extensibility by making such an assumption - what if someone extends the generator to *not* have a newline for these types of expressions? Or what if they make another expression template also end with a newline? I've assigned it to you since you'll know how it should be done in an extensible way.

Whatever change made will need to work with the following scenarios:
x int;
x int = 10;
x, y int;
x, y int = 10;
Comment 2 Jeff Douglas CLA 2011-08-05 08:49:24 EDT
fixed
Comment 3 Justin Spadea CLA 2011-09-13 15:48:52 EDT
Verified