Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Ferguson2007-04-04 17:23:21 +0000
committerAndrew Ferguson2007-04-04 17:23:21 +0000
commit19a895a652af168f0607803d6f058d17e4bfa59c (patch)
treedaa7b35f4da6a73fb720ddde78ce1e595dc5f2a8
parentca26fe7a9d8c4d6c0db54597b820b820288d4cea (diff)
downloadorg.eclipse.cdt-19a895a652af168f0607803d6f058d17e4bfa59c.tar.gz
org.eclipse.cdt-19a895a652af168f0607803d6f058d17e4bfa59c.tar.xz
org.eclipse.cdt-19a895a652af168f0607803d6f058d17e4bfa59c.zip
180948: fix ClassCastException (follow up)
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateScope.java53
3 files changed, 58 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
index 92ffb676745..80afce2ad74 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
@@ -47,7 +47,7 @@ import org.eclipse.core.runtime.CoreException;
* additionally check that the binding obtained has characteristics as
* expected (type,name,etc..)
*/
-public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBase {
+public abstract class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBase {
public static class SingleProject extends IndexCPPBindingResolutionTest {
public SingleProject() {setStrategy(new SinglePDOMTestStrategy(true));}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
index 3ea74a9cb27..c9278c5b3b9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CPPCompositesFactory.java
@@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.core.index.IIndex;
@@ -86,8 +87,10 @@ public class CPPCompositesFactory extends AbstractCompositeFactory implements IC
namespaces = getNamespaces(rscope.getScopeBinding());
}
return new CompositeCPPNamespaceScope(this, namespaces);
+ } else if(rscope instanceof ICPPTemplateScope) {
+ return new CompositeCPPTemplateScope(this, (ICPPTemplateScope) rscope);
} else {
- throw new CompositingNotImplementedError();
+ throw new CompositingNotImplementedError(rscope.getClass().getName());
}
} catch(CoreException ce) {
CCorePlugin.log(ce);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateScope.java
new file mode 100644
index 00000000000..ddbf5d0c164
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPTemplateScope.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Symbian Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Ferguson (Symbian) - Initial implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.core.index.composite.cpp;
+
+import org.eclipse.cdt.core.dom.ast.DOMException;
+import org.eclipse.cdt.core.dom.ast.IASTName;
+import org.eclipse.cdt.core.dom.ast.IBinding;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
+import org.eclipse.cdt.core.index.IIndexBinding;
+import org.eclipse.cdt.internal.core.index.IIndexFragmentBinding;
+import org.eclipse.cdt.internal.core.index.composite.CompositeScope;
+import org.eclipse.cdt.internal.core.index.composite.ICompositesFactory;
+
+public class CompositeCPPTemplateScope extends CompositeScope implements ICPPTemplateScope {
+ public CompositeCPPTemplateScope(ICompositesFactory cf,
+ ICPPTemplateScope rbinding) {
+ super(cf, (IIndexFragmentBinding) rbinding);
+ }
+
+ public ICPPTemplateDefinition getTemplateDefinition() throws DOMException {
+ ICPPTemplateDefinition preresult= ((ICPPTemplateScope) rbinding).getTemplateDefinition();
+ return (ICPPTemplateDefinition) processUncertainBinding(preresult);
+ }
+
+ public IBinding[] find(String name, boolean prefixLookup)
+ throws DOMException {
+ IBinding[] preresult = ((ICPPTemplateScope)rbinding).find(name, prefixLookup);
+ return processUncertainBindings(preresult);
+ }
+
+ public IBinding[] find(String name) throws DOMException {
+ IBinding[] preresult = ((ICPPTemplateScope)rbinding).find(name);
+ return processUncertainBindings(preresult);
+ }
+
+ public IBinding getBinding(IASTName name, boolean resolve) throws DOMException {
+ IBinding binding = ((ICPPTemplateScope)rbinding).getBinding(name, resolve);
+ return processUncertainBinding(binding);
+ }
+
+ public IIndexBinding getScopeBinding() {
+ return cf.getCompositeBinding(rbinding);
+ }
+}

Back to the top