Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2008-03-25 08:51:40 +0000
committerSergey Prigogin2008-03-25 08:51:40 +0000
commitcbd7a681f3041c4d10b4c2a2217564b1c110493f (patch)
tree05c78cd5adb67e4c8a1f1781e25518871378e25f /core/org.eclipse.cdt.core/parser
parentf882d7ca05594df4c37bb320e6a99c4723536bf7 (diff)
downloadorg.eclipse.cdt-cbd7a681f3041c4d10b4c2a2217564b1c110493f.tar.gz
org.eclipse.cdt-cbd7a681f3041c4d10b4c2a2217564b1c110493f.tar.xz
org.eclipse.cdt-cbd7a681f3041c4d10b4c2a2217564b1c110493f.zip
More cleanup of template resolution code.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownBinding.java14
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClassInstance.java4
3 files changed, 12 insertions, 14 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownBinding.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownBinding.java
index 4e1ddf7c2a4..51b75cf32e9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownBinding.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownBinding.java
@@ -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
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java
index 7d5bdfc601f..ab8890cae99 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClass.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sergey Prigogin (Google)
*******************************************************************************/
/*
@@ -117,13 +118,6 @@ public class CPPUnknownClass extends CPPUnknownBinding implements ICPPClassType
}
/* (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)
*/
public boolean isSameType(IType type) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClassInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClassInstance.java
index 2f447c5b64a..9a8553f5966 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClassInstance.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPUnknownClassInstance.java
@@ -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;
}

Back to the top