mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed inconsistency between different implementations of getQualifiedName method.
This commit is contained in:
parent
d3692fa235
commit
f9e746d814
2 changed files with 9 additions and 42 deletions
|
@ -6,16 +6,14 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||
|
@ -30,6 +28,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPEnumeration;
|
|||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownBinding;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBindingComparator;
|
||||
|
@ -40,7 +39,7 @@ import org.eclipse.cdt.internal.core.pdom.db.IString;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Base class for bindings in the pdom.
|
||||
* Base class for bindings in the PDOM.
|
||||
*/
|
||||
public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding {
|
||||
public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {};
|
||||
|
@ -306,20 +305,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
|||
}
|
||||
|
||||
final public String[] getQualifiedName() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
try {
|
||||
PDOMNode node = this;
|
||||
while (node != null) {
|
||||
if (node instanceof PDOMBinding) {
|
||||
result.add(0, ((PDOMBinding)node).getName());
|
||||
}
|
||||
node = node.getParentNode();
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
} catch (CoreException ce) {
|
||||
CCorePlugin.log(ce);
|
||||
return null;
|
||||
}
|
||||
return CPPVisitor.getQualifiedName(this);
|
||||
}
|
||||
|
||||
final public boolean isFileLocal() throws CoreException {
|
||||
|
|
|
@ -9,16 +9,11 @@
|
|||
* Symbian - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMBinding;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
||||
|
@ -28,7 +23,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Mirrors type-hierarchy from DOM interfaces
|
||||
*/
|
||||
public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
protected static final int RECORD_SIZE= PDOMBinding.RECORD_SIZE + 0;
|
||||
|
||||
|
@ -40,21 +34,8 @@ public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding
|
|||
super(linkage, parent, name);
|
||||
}
|
||||
|
||||
final public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||
List<char[]> result = new ArrayList<char[]>();
|
||||
try {
|
||||
PDOMNode node = this;
|
||||
while (node != null) {
|
||||
if (node instanceof PDOMBinding && !(node instanceof ICPPTemplateInstance)) {
|
||||
result.add(0, ((PDOMBinding) node).getName().toCharArray());
|
||||
}
|
||||
node = node.getParentNode();
|
||||
}
|
||||
return result.toArray(new char[result.size()][]);
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
return null;
|
||||
}
|
||||
final public char[][] getQualifiedNameCharArray() {
|
||||
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||
}
|
||||
|
||||
public final boolean isGloballyQualified() throws DOMException {
|
||||
|
|
Loading…
Add table
Reference in a new issue