mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Removed redundant data members.
This commit is contained in:
parent
ec5204c969
commit
8a38316b33
1 changed files with 29 additions and 26 deletions
|
@ -32,21 +32,16 @@ import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
*/
|
*/
|
||||||
public class CPPDeferredClassInstance extends CPPInstance implements
|
public class CPPDeferredClassInstance extends CPPInstance implements
|
||||||
ICPPClassType, ICPPDeferredTemplateInstance, ICPPInternalDeferredClassInstance {
|
ICPPClassType, ICPPDeferredTemplateInstance, ICPPInternalDeferredClassInstance {
|
||||||
|
|
||||||
public IType [] arguments = null;
|
|
||||||
public ICPPClassTemplate classTemplate = null;
|
|
||||||
|
|
||||||
public CPPDeferredClassInstance(ICPPClassTemplate orig, IType [] arguments ) {
|
public CPPDeferredClassInstance(ICPPClassTemplate orig, IType[] arguments) {
|
||||||
super( null, orig, null, arguments );
|
super(null, orig, null, arguments);
|
||||||
this.arguments = arguments;
|
|
||||||
this.classTemplate = orig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getBases()
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getBases()
|
||||||
*/
|
*/
|
||||||
public ICPPBase[] getBases() throws DOMException {
|
public ICPPBase[] getBases() throws DOMException {
|
||||||
return ((ICPPClassType) classTemplate).getBases();
|
return ((ICPPClassType) getClassTemplate()).getBases();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -124,20 +119,20 @@ public class CPPDeferredClassInstance extends CPPInstance implements
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
||||||
*/
|
*/
|
||||||
public int getKey() throws DOMException {
|
public int getKey() throws DOMException {
|
||||||
return ((ICPPClassType)classTemplate).getKey();
|
return ((ICPPClassType) getClassTemplate()).getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
|
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getCompositeScope()
|
||||||
*/
|
*/
|
||||||
public IScope getCompositeScope() throws DOMException {
|
public IScope getCompositeScope() throws DOMException {
|
||||||
return ((ICPPClassType)classTemplate).getCompositeScope();
|
return ((ICPPClassType) getClassTemplate()).getCompositeScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#clone()
|
* @see java.lang.Object#clone()
|
||||||
*/
|
*/
|
||||||
public Object clone(){
|
public Object clone() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,34 +141,38 @@ public class CPPDeferredClassInstance extends CPPInstance implements
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public IType instantiate(ObjectMap argMap) {
|
public IType instantiate(ObjectMap argMap) {
|
||||||
|
IType[] arguments = getArguments();
|
||||||
IType [] newArgs = new IType[ arguments.length ];
|
IType[] newArgs = new IType[arguments.length];
|
||||||
int size = arguments.length;
|
int size = arguments.length;
|
||||||
for( int i = 0; i < size; i++ ){
|
for (int i = 0; i < size; i++) {
|
||||||
newArgs[i] = CPPTemplates.instantiateType( arguments[i], argMap );
|
newArgs[i] = CPPTemplates.instantiateType(arguments[i], argMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( argMap.containsKey( classTemplate ) ){
|
ICPPClassTemplate classTemplate = getClassTemplate();
|
||||||
classTemplate = (ICPPClassTemplate) argMap.get( classTemplate );
|
if (argMap.containsKey(classTemplate)) {
|
||||||
|
classTemplate = (ICPPClassTemplate) argMap.get(classTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IType) ((ICPPInternalTemplateInstantiator)classTemplate).instantiate( newArgs );
|
return (IType) ((ICPPInternalTemplateInstantiator)classTemplate).instantiate(newArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||||
*/
|
*/
|
||||||
public boolean isSameType(IType type) {
|
public boolean isSameType(IType type) {
|
||||||
if( type == this )
|
if (type == this)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//allow some fuzziness here.
|
// allow some fuzziness here.
|
||||||
if( type instanceof ICPPDeferredTemplateInstance && type instanceof ICPPClassType ){
|
ICPPClassTemplate classTemplate = getClassTemplate();
|
||||||
ICPPClassTemplate typeClass = (ICPPClassTemplate) ((ICPPDeferredTemplateInstance)type).getSpecializedBinding();
|
if (type instanceof ICPPDeferredTemplateInstance && type instanceof ICPPClassType) {
|
||||||
return (typeClass == classTemplate );
|
ICPPClassTemplate typeClass =
|
||||||
} else if( type instanceof ICPPClassTemplate && classTemplate == type ){
|
(ICPPClassTemplate) ((ICPPDeferredTemplateInstance) type).getSpecializedBinding();
|
||||||
|
return typeClass == classTemplate;
|
||||||
|
} else if (type instanceof ICPPClassTemplate && classTemplate == type) {
|
||||||
return true;
|
return true;
|
||||||
} else if( type instanceof ICPPTemplateInstance && ((ICPPTemplateInstance)type).getTemplateDefinition() == classTemplate ){
|
} else if (type instanceof ICPPTemplateInstance &&
|
||||||
|
((ICPPTemplateInstance)type).getTemplateDefinition() == classTemplate) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,4 +182,8 @@ public class CPPDeferredClassInstance extends CPPInstance implements
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICPPClassTemplate getClassTemplate() {
|
||||||
|
return (ICPPClassTemplate) getSpecializedBinding();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue