1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Plain C: search for locals, bug 151334.

This commit is contained in:
Markus Schorn 2008-12-09 13:59:49 +00:00
parent d5d62baf17
commit ff783be167
2 changed files with 3 additions and 4 deletions

View file

@ -46,7 +46,7 @@ public class CASTCompoundStatement extends ASTNode implements IASTCompoundStatem
public IScope getScope() { public IScope getScope() {
if( scope == null ) if( scope == null )
scope = new CScope( this, EScopeKind.eClassType); scope = new CScope(this, EScopeKind.eLocal);
return scope; return scope;
} }

View file

@ -18,13 +18,12 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextSelection;
import org.eclipse.cdt.core.dom.ast.DOMException; import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.EScopeKind;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding; import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope; import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
import org.eclipse.cdt.core.index.IIndex; import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ILanguage; import org.eclipse.cdt.core.model.ILanguage;
@ -66,7 +65,7 @@ public class PDOMSearchTextSelectionQuery extends PDOMSearchQuery {
scope = binding.getScope(); scope = binding.getScope();
} catch (DOMException e) { } catch (DOMException e) {
} }
if (scope instanceof ICPPBlockScope || scope instanceof ICFunctionScope) { if (scope != null && scope.getKind() == EScopeKind.eLocal) {
createLocalMatches(ast, binding); createLocalMatches(ast, binding);
return Status.OK_STATUS; return Status.OK_STATUS;
} }