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
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (QNX) - Initial API and implementation
|
* Doug Schaefer (QNX) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Andrew Ferguson (Symbian)
|
* Andrew Ferguson (Symbian)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom;
|
package org.eclipse.cdt.internal.core.pdom.dom;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
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.index.IIndexFileSet;
|
||||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
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.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.IIndexFragment;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexFragmentBindingComparator;
|
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;
|
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 abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding {
|
||||||
public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {};
|
public static final PDOMBinding[] EMPTY_PDOMBINDING_ARRAY = {};
|
||||||
|
@ -306,20 +305,7 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IPDOMBinding
|
||||||
}
|
}
|
||||||
|
|
||||||
final public String[] getQualifiedName() {
|
final public String[] getQualifiedName() {
|
||||||
List<String> result = new ArrayList<String>();
|
return CPPVisitor.getQualifiedName(this);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final public boolean isFileLocal() throws CoreException {
|
final public boolean isFileLocal() throws CoreException {
|
||||||
|
|
|
@ -9,16 +9,11 @@
|
||||||
* Symbian - Initial API and implementation
|
* Symbian - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
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.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
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.PDOMBinding;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
import org.eclipse.cdt.internal.core.pdom.dom.PDOMLinkage;
|
||||||
import org.eclipse.cdt.internal.core.pdom.dom.PDOMNode;
|
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
|
* Mirrors type-hierarchy from DOM interfaces
|
||||||
*/
|
*/
|
||||||
public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
|
public abstract class PDOMCPPBinding extends PDOMBinding implements ICPPBinding {
|
||||||
|
|
||||||
@SuppressWarnings("hiding")
|
@SuppressWarnings("hiding")
|
||||||
protected static final int RECORD_SIZE= PDOMBinding.RECORD_SIZE + 0;
|
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);
|
super(linkage, parent, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
final public char[][] getQualifiedNameCharArray() throws DOMException {
|
final public char[][] getQualifiedNameCharArray() {
|
||||||
List<char[]> result = new ArrayList<char[]>();
|
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isGloballyQualified() throws DOMException {
|
public final boolean isGloballyQualified() throws DOMException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue