Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2007-12-07 07:29:13 -0500
committerMarkus Schorn2007-12-07 07:29:13 -0500
commit2ab2cd05f4bdb7ea256c3558dd72c3206c0d28a8 (patch)
tree90b16e0d7c463b544234501a5544ae2c869fa3d9
parentf8ea187ea2593a18b839b809bf3cd50ce3979158 (diff)
downloadorg.eclipse.cdt-2ab2cd05f4bdb7ea256c3558dd72c3206c0d28a8.tar.gz
org.eclipse.cdt-2ab2cd05f4bdb7ea256c3558dd72c3206c0d28a8.tar.xz
org.eclipse.cdt-2ab2cd05f4bdb7ea256c3558dd72c3206c0d28a8.zip
Fixes 2 exceptions in name resolution, bug 211457.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguity.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java15
2 files changed, 14 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguity.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguity.java
index 6499fb1f48..6cbf1ad301 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguity.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTAmbiguity.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation 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:
- * IBM - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * IBM - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
@@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
-import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
public abstract class CASTAmbiguity extends CASTNode {
@@ -73,7 +72,7 @@ public abstract class CASTAmbiguity extends CASTNode {
IBinding b = names[j].resolveBinding();
if( b == null || b instanceof IProblemBinding )
++issues[i];
- IScope scope = CPPVisitor.getContainingScope( names[j] );
+ IScope scope = CVisitor.getContainingScope( names[j] );
if( scope != null )
{
try {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
index 410d6976dd..2336ea92cf 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
@@ -817,6 +817,15 @@ public class CPPVisitor {
}
public static IScope getContainingScope( IASTName name ){
+ IScope scope= getContainingScopeOrNull(name);
+ if (scope == null) {
+ return new CPPScope.CPPScopeProblem( name, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray() );
+ }
+
+ return scope;
+ }
+
+ private static IScope getContainingScopeOrNull(IASTName name) {
IASTNode parent = name.getParent();
try {
if( parent instanceof ICPPASTTemplateId ){
@@ -882,11 +891,7 @@ public class CPPVisitor {
}
type = CPPSemantics.getUltimateType( type, false );
if( type instanceof ICPPClassType ){
- IScope scope= ((ICPPClassType) type).getCompositeScope();
- if (scope == null) {
- scope= new CPPScope.CPPScopeProblem(fieldReference, IProblemBinding.SEMANTIC_BAD_SCOPE, name.toCharArray() );
- }
- return scope;
+ return ((ICPPClassType) type).getCompositeScope();
}
} else if( parent instanceof IASTGotoStatement || parent instanceof IASTLabelStatement ){
while( !(parent instanceof IASTFunctionDefinition) ){

Back to the top