| Summary: | SMAP missing line information for variable declarations | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Justin Spadea <jspadea> |
| Component: | EDT | Assignee: | Jeff Douglas <jeffdouglas> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Justin Spadea
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;
fixed Verified |