Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[hibachi-dev] SourceRange for an AdaVariable

Hibachi Devs,

While working with Hibachi's underlying object model I noticed something that might be a bug. I wanted to run it by the devs list to see if it was indeed a bug before I reported it as such.

What I am seeing is that the SourceRange instance is re-used for all IAdaVariables that are declared in a list. For example, if I have the following Ada code:

procedure P1 (I : in Integer; O1, O2 : out Integer)

the SourceRange would be the same for O1 and O2 (not only are the values the same but the instance is the same).

I did find what is likely the cause of this. In the AdaASTParser class (package: org.eclipse.hibachi.model.internal) the method parseVariableDeclaration has the following snippets:

// Use the same source range for all variable declarations from
// the same list
ISourceRange range = ParserHelper.getElementRange(m_lineTracker, sourceAst);

and then later does this:

IAdaVariable[] ret = new IAdaVariable[identifiers.size()];
for (int i = 0; i < identifiers.size(); ++i)
{
ret[i] = new AdaVariable(parentMember.getCompilationUnit(), parentName, (String)identifiers.get(i), false, flags, range, typeReference);
}
return ret;

So it would appear that this was done on purpose. But this doesn't seem to be correct - or at least I would prefer that the source ranges are different. So is this a bug or just me not understanding what the SourceRange should be?

thanks,
todd


Back to the top