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:
parent
f882d7ca05
commit
cbd7a681f3
3 changed files with 12 additions and 14 deletions
|
@ -30,9 +30,9 @@ import org.eclipse.core.runtime.PlatformObject;
|
|||
* @author aniefer
|
||||
*/
|
||||
public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnknown, Cloneable {
|
||||
private ICPPScope unknownScope = null;
|
||||
protected ICPPInternalUnknown scopeBinding = null;
|
||||
protected IASTName name = null;
|
||||
private ICPPScope unknownScope;
|
||||
protected ICPPInternalUnknown scopeBinding;
|
||||
protected IASTName name;
|
||||
|
||||
public CPPUnknownBinding(ICPPInternalUnknown scopeBinding, IASTName name) {
|
||||
super();
|
||||
|
@ -143,22 +143,24 @@ public class CPPUnknownBinding extends PlatformObject implements ICPPInternalUnk
|
|||
if (s != null && ASTInternal.isFullyCached(s))
|
||||
result = s.getBinding(name, true);
|
||||
} else if (t instanceof ICPPInternalUnknown) {
|
||||
CPPUnknownBinding res = (CPPUnknownBinding) clone();
|
||||
CPPUnknownBinding res = clone();
|
||||
res.scopeBinding = (ICPPInternalUnknown) t;
|
||||
res.unknownScope = null;
|
||||
result = res;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public ILinkage getLinkage() {
|
||||
return Linkage.CPP_LINKAGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
public CPPUnknownBinding clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
return (CPPUnknownBinding) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
return null; // Never happens
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -116,13 +117,6 @@ public class CPPUnknownClass extends CPPUnknownBinding implements ICPPClassType
|
|||
return getUnknownScope();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#clone()
|
||||
*/
|
||||
public Object clone() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||
*/
|
||||
|
|
|
@ -112,7 +112,9 @@ public class CPPUnknownClassInstance extends CPPUnknownClass implements ICPPInte
|
|||
ICPPSpecialization specialization = (ICPPSpecialization) result;
|
||||
result = CPPTemplates.instantiateTemplate((ICPPTemplateDefinition) specialization, newArgs, null);
|
||||
} else {
|
||||
result = new CPPUnknownClassInstance(scopeBinding, name, newArgs);
|
||||
ICPPInternalUnknown newScopeBinding = result instanceof CPPUnknownBinding ?
|
||||
((CPPUnknownBinding) result).scopeBinding : scopeBinding;
|
||||
result = new CPPUnknownClassInstance(newScopeBinding, name, newArgs);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue