Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Re: [cdt-patch] CModelBuilder adds line numbers + JUnit test

> 
> So what you are saying is leave the line information in CElement and just 
> change the interfaces around.  Or am I mistaken?
> 

Yes, the class CElement contains a lot of usefull methods that are not related
to ICElement and should not be in the public ICElement interface.

> Word from Hoda is that there is still some code lying around expecting the 
> line information to be sitting in CElement.  Changing the implementation 
> of CElement might be too major of a change for this stage of 1.1, unless 
> we have broken something else in 1.1.  Hoda can comment more.
> 

CElement did not change, a few methods were added to ICElement, namely
ICElement.getStartLine() and ICElement.getEndLine(). IMHO, they do not belong in ICElement,
offsets and lines information are provided through the ISourceRange interface.
For example, ICProject extends ICElement and it should not have to provide
a getStartLine() or getEndLine().


The way SourceManipulationInfo is implemented:

	protected ISourceRange getSourceRange() {
		return new SourceRange(getElement().getStartPos(),
						getElement().getLength(),
						getElement().getIdStartPos(),
						getElement().getIdLength(), 
						getElement().getStartLine(),
						getElement().getEndLine());
	}
 

There is no change needed, we are not breaking 1.1.  The only problem was
that the new parser did not set the information of the lines but only the offsets.

the old parser was doing:
	CElement.setPos(...);
	CElement.setLines(...);

The new one was only doing:
	CElement.setPos(...);

I beleive it is corrected, in CVS, by johnC, to also do
	CElement.setLines(...);

If this is done, things will work fine.




Back to the top