correct source location info in case whitespace between unary op and magic number

This commit is contained in:
Lars Kühne 2004-07-04 11:24:32 +00:00
parent bbd273b62d
commit bd4ec9a98e
1 changed files with 5 additions and 5 deletions

View File

@ -63,18 +63,18 @@ public class MagicNumberCheck extends Check
{
if (!inIgnoreList(aAST) && !isConstantDefinition(aAST)) {
String text = aAST.getText();
int columnNo = aAST.getColumnNo();
final DetailAST parent = aAST.getParent();
DetailAST reportAST = aAST;
if (parent.getType() == TokenTypes.UNARY_MINUS) {
columnNo--;
reportAST = parent;
text = "-" + text;
}
else if (parent.getType() == TokenTypes.UNARY_PLUS) {
columnNo--;
reportAST = parent;
text = "+" + text;
}
log(aAST.getLineNo(),
columnNo,
log(reportAST.getLineNo(),
reportAST.getColumnNo(),
"magic.number",
text);
}