From 45b020487ab06d92ac67da36beb86d31e3d71f63 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Mon, 10 Dec 2007 10:03:50 +0000 Subject: [PATCH] Fixes an exception in name resolution (second try), bug 211457. --- .../cdt/internal/core/dom/parser/cpp/CPPVisitor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 f43648e0796..b284b19729e 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 @@ -705,9 +705,10 @@ public class CPPVisitor { } - public static IScope getContainingScope( IASTNode node ){ - if( node == null ) + public static IScope getContainingScope( final IASTNode inputNode ){ + if( inputNode == null || inputNode instanceof IASTTranslationUnit) return null; + IASTNode node= inputNode; while( node != null ){ if( node instanceof IASTName && !( node instanceof ICPPASTQualifiedName ) ){ return getContainingScope( (IASTName) node ); @@ -814,7 +815,7 @@ public class CPPVisitor { } node = node.getParent(); } - return null; + return new CPPScope.CPPScopeProblem( inputNode, IProblemBinding.SEMANTIC_BAD_SCOPE, inputNode.getRawSignature().toCharArray() ); } public static IScope getContainingScope( IASTName name ){