1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

More cleanup of template resolution code.

This commit is contained in:
Sergey Prigogin 2008-03-25 08:51:40 +00:00
parent f882d7ca05
commit cbd7a681f3
3 changed files with 12 additions and 14 deletions

View file

@ -30,9 +30,9 @@ import org.eclipse.core.runtime.PlatformObject;
* @author aniefer * @author aniefer
*/ */
public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnknown, Cloneable { public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnknown, Cloneable {
private ICPPScope unknownScope = null; private ICPPScope unknownScope;
protected ICPPInternalUnknown scopeBinding = null; protected ICPPInternalUnknown scopeBinding;
protected IASTName name = null; protected IASTName name;
public CPPUnknownBinding(ICPPInternalUnknown scopeBinding, IASTName name) { public CPPUnknownBinding(ICPPInternalUnknown scopeBinding, IASTName name) {
super(); super();
@ -143,22 +143,24 @@ public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnk
if (s != null && ASTInternal.isFullyCached(s)) if (s != null && ASTInternal.isFullyCached(s))
result = s.getBinding(name, true); result = s.getBinding(name, true);
} else if (t instanceof ICPPInternalUnknown) { } else if (t instanceof ICPPInternalUnknown) {
CPPUnknownBinding res = (CPPUnknownBinding) clone(); CPPUnknownBinding res = clone();
res.scopeBinding = (ICPPInternalUnknown) t; res.scopeBinding = (ICPPInternalUnknown) t;
res.unknownScope = null;
result = res; result = res;
} }
} }
return result; return result;
} }
public ILinkage getLinkage() { public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE; return Linkage.CPP_LINKAGE;
} }
@Override @Override
public Object clone() { public CPPUnknownBinding clone() {
try { try {
return super.clone(); return (CPPUnknownBinding) super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
return null; // Never happens return null; // Never happens
} }

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
/* /*
@ -116,13 +117,6 @@ public class CPPUnknownClass extends CPPUnknownBinding implements ICPPClassType
return getUnknownScope(); return getUnknownScope();
} }
/* (non-Javadoc)
* @see java.lang.Object#clone()
*/
public Object clone() {
return this;
}
/* (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)
*/ */

View file

@ -112,7 +112,9 @@ public class CPPUnknownClassInstance extends CPPUnknownClass implements ICPPInte
ICPPSpecialization specialization = (ICPPSpecialization) result; ICPPSpecialization specialization = (ICPPSpecialization) result;
result = CPPTemplates.instantiateTemplate((ICPPTemplateDefinition) specialization, newArgs, null); result = CPPTemplates.instantiateTemplate((ICPPTemplateDefinition) specialization, newArgs, null);
} else { } else {
result = new CPPUnknownClassInstance(scopeBinding, name, newArgs); ICPPInternalUnknown newScopeBinding = result instanceof CPPUnknownBinding ?
((CPPUnknownBinding) result).scopeBinding : scopeBinding;
result = new CPPUnknownClassInstance(newScopeBinding, name, newArgs);
} }
return result; return result;
} }