mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 20:35:38 +02:00
Bug Fixing
This commit is contained in:
parent
e2ea942fe5
commit
f50273233f
3 changed files with 26 additions and 33 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-06-15 Hoda Amer
|
||||
Fix for PR 63207: ITranslationUnit.getElementAtOffset(i) does not factor in multiple namespace decl
|
||||
|
||||
2004-06-14 Hoda Amer
|
||||
Fix for PR 63243: [Outline View] Missing user defined type if declare variable along with the C++ elem (struct, enum, union)
|
||||
|
||||
|
|
|
@ -436,37 +436,16 @@ public class CModelBuilder {
|
|||
String nsName = (nsDef.getName() == null )
|
||||
? "" //$NON-NLS-1$
|
||||
: nsDef.getName().toString();
|
||||
|
||||
// check if there is another namespace with the same name for the same parent
|
||||
boolean alreadyThere = false;
|
||||
Namespace oldElement = null;
|
||||
|
||||
List siblings = parent.getChildrenOfType(ICElement.C_NAMESPACE);
|
||||
if(siblings.size() > 0){
|
||||
Iterator i = siblings.iterator();
|
||||
while (i.hasNext()){
|
||||
Namespace n = (Namespace)i.next();
|
||||
if(n.getElementName().equals(nsName)){
|
||||
alreadyThere = true;
|
||||
oldElement = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( (alreadyThere) && (oldElement != null)) {
|
||||
return oldElement;
|
||||
} else {
|
||||
// this is the first namespace
|
||||
Namespace element = new Namespace (parent, nsName );
|
||||
// add to parent
|
||||
parent.addChild(element);
|
||||
element.setIdPos(nsDef.getNameOffset(),
|
||||
(nsName.length() == 0) ? type.length() : (nsDef.getNameEndOffset() - nsDef.getNameOffset()));
|
||||
element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset());
|
||||
element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() );
|
||||
element.setTypeName(type);
|
||||
this.newElements.put(element, element.getElementInfo());
|
||||
return element;
|
||||
}
|
||||
Namespace element = new Namespace (parent, nsName );
|
||||
// add to parent
|
||||
parent.addChild(element);
|
||||
element.setIdPos(nsDef.getNameOffset(),
|
||||
(nsName.length() == 0) ? type.length() : (nsDef.getNameEndOffset() - nsDef.getNameOffset()));
|
||||
element.setPos(nsDef.getStartingOffset(), nsDef.getEndingOffset() - nsDef.getStartingOffset());
|
||||
element.setLines( nsDef.getStartingLine(), nsDef.getEndingLine() );
|
||||
element.setTypeName(type);
|
||||
this.newElements.put(element, element.getElementInfo());
|
||||
return element;
|
||||
}
|
||||
|
||||
private Enumeration createEnumeration(Parent parent, IASTEnumerationSpecifier enumSpecifier) throws CModelException{
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.core.model;
|
|||
* Rational Software - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.INamespace;
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class Namespace extends SourceManipulation implements INamespace{
|
|||
super(parent, name, CElement.C_NAMESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Returns the typeName.
|
||||
* @return String
|
||||
*/
|
||||
|
@ -29,12 +30,22 @@ public class Namespace extends SourceManipulation implements INamespace{
|
|||
return typeName;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Sets the typeName.
|
||||
* @param typeName The typeName to set
|
||||
*/
|
||||
public void setTypeName(String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
public boolean equals(Object other) {
|
||||
// TODO Auto-generated method stub
|
||||
return (super.equals(other)
|
||||
&& (this.getStartPos() == ((Namespace)other).getStartPos())
|
||||
&& (this.getLength() == ((Namespace)other).getLength())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue