mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Cosmetics.
This commit is contained in:
parent
59efb5abcf
commit
d7d38fd21f
4 changed files with 29 additions and 46 deletions
|
@ -1329,7 +1329,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
} catch (OffsetLimitReachedException e) {
|
} catch (OffsetLimitReachedException e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
codeBranchNesting= Math.min(getCodeBranchNesting()+1, codeBranchNesting);
|
codeBranchNesting= Math.min(getCodeBranchNesting() + 1, codeBranchNesting);
|
||||||
|
|
||||||
// we could be at the start of inactive code so restart the loop
|
// we could be at the start of inactive code so restart the loop
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -34,19 +34,19 @@ public class CASTProblem extends ASTProblem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitProblems ){
|
if (action.shouldVisitProblems) {
|
||||||
switch( action.visit( this ) ){
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( action.shouldVisitProblems ){
|
if (action.shouldVisitProblems) {
|
||||||
switch( action.leave( this ) ){
|
switch (action.leave(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class CASTProblemDeclaration extends CASTProblemOwner implements IASTProb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.accept(action); // visits the problem
|
super.accept(action); // Visit the problem.
|
||||||
|
|
||||||
if (action.shouldVisitDeclarations) {
|
if (action.shouldVisitDeclarations) {
|
||||||
switch (action.leave(this)) {
|
switch (action.leave(this)) {
|
||||||
|
|
|
@ -109,8 +109,8 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
IndexFilter.C_DECLARED_OR_IMPLICIT
|
IndexFilter.C_DECLARED_OR_IMPLICIT
|
||||||
};
|
};
|
||||||
|
|
||||||
private IASTNode physicalNode = null;
|
private IASTNode physicalNode;
|
||||||
private boolean isCached = false;
|
private boolean isCached;
|
||||||
|
|
||||||
private final CharArrayObjectMap<?> mapsToNameOrBinding[] = { CharArrayObjectMap.EMPTY_MAP, CharArrayObjectMap.EMPTY_MAP };
|
private final CharArrayObjectMap<?> mapsToNameOrBinding[] = { CharArrayObjectMap.EMPTY_MAP, CharArrayObjectMap.EMPTY_MAP };
|
||||||
private final EScopeKind kind;
|
private final EScopeKind kind;
|
||||||
|
@ -125,9 +125,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
return kind;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getParent()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IScope getParent() {
|
public IScope getParent() {
|
||||||
return CVisitor.getContainingScope(physicalNode);
|
return CVisitor.getContainingScope(physicalNode);
|
||||||
|
@ -135,12 +132,13 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
|
|
||||||
protected static class CollectNamesAction extends ASTVisitor {
|
protected static class CollectNamesAction extends ASTVisitor {
|
||||||
private final char[] name;
|
private final char[] name;
|
||||||
private IASTName[] result = null;
|
private IASTName[] result;
|
||||||
|
|
||||||
CollectNamesAction(char[] n) {
|
CollectNamesAction(char[] n) {
|
||||||
name = n;
|
name = n;
|
||||||
shouldVisitNames = true;
|
shouldVisitNames = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int visit(IASTName n) {
|
public int visit(IASTName n) {
|
||||||
ASTNodeProperty prop = n.getPropertyInParent();
|
ASTNodeProperty prop = n.getPropertyInParent();
|
||||||
|
@ -166,9 +164,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IBinding[] find(String name) {
|
public IBinding[] find(String name) {
|
||||||
return CVisitor.findBindings(this, name);
|
return CVisitor.findBindings(this, name);
|
||||||
|
@ -188,9 +183,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getPhysicalNode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode getPhysicalNode() {
|
public IASTNode getPhysicalNode() {
|
||||||
return physicalNode;
|
return physicalNode;
|
||||||
|
@ -240,6 +232,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
|
|
||||||
return NAMESPACE_TYPE_OTHER;
|
return NAMESPACE_TYPE_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final IBinding getBinding(IASTName name, boolean resolve) {
|
public final IBinding getBinding(IASTName name, boolean resolve) {
|
||||||
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
return getBinding(name, resolve, IIndexFileSet.EMPTY);
|
||||||
|
@ -280,7 +273,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
|
|
||||||
IBinding result= null;
|
IBinding result= null;
|
||||||
if (resolve && physicalNode instanceof IASTTranslationUnit) {
|
if (resolve && physicalNode instanceof IASTTranslationUnit) {
|
||||||
final IASTTranslationUnit tu = (IASTTranslationUnit)physicalNode;
|
final IASTTranslationUnit tu = (IASTTranslationUnit) physicalNode;
|
||||||
IIndex index= tu.getIndex();
|
IIndex index= tu.getIndex();
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -289,8 +282,8 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
bindings= fileSet.filterFileLocalBindings(bindings);
|
bindings= fileSet.filterFileLocalBindings(bindings);
|
||||||
}
|
}
|
||||||
result= processIndexResults(name, bindings);
|
result= processIndexResults(name, bindings);
|
||||||
} catch(CoreException ce) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(ce);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,9 +322,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use {@link #getBindings(ScopeLookupData)} instead
|
* @deprecated Use {@link #getBindings(ScopeLookupData)} instead
|
||||||
*/
|
*/
|
||||||
|
@ -341,9 +331,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
return getBindings(new ScopeLookupData(name, resolve, prefixLookup));
|
return getBindings(new ScopeLookupData(name, resolve, prefixLookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.c.ICScope#getBinding(org.eclipse.cdt.core.dom.ast.IASTName, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public final IBinding[] getBindings(ScopeLookupData lookup) {
|
public final IBinding[] getBindings(ScopeLookupData lookup) {
|
||||||
char[] c = lookup.getLookupKey();
|
char[] c = lookup.getLookupKey();
|
||||||
|
@ -503,7 +490,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
nodes = dtor.getParameterDeclarations();
|
nodes = dtor.getParameterDeclarations();
|
||||||
} else if (scopeNode instanceof IASTForStatement) {
|
} else if (scopeNode instanceof IASTForStatement) {
|
||||||
final IASTForStatement forStmt = (IASTForStatement) scopeNode;
|
final IASTForStatement forStmt = (IASTForStatement) scopeNode;
|
||||||
nodes= new IASTNode[] {forStmt.getInitializerStatement()};
|
nodes= new IASTNode[] { forStmt.getInitializerStatement() };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodes != null) {
|
if (nodes != null) {
|
||||||
|
@ -517,8 +504,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
node = null;
|
node = null;
|
||||||
if (nodes[0].getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER
|
if (nodes[0].getPropertyInParent() == ICASTKnRFunctionDeclarator.FUNCTION_PARAMETER
|
||||||
|| nodes[0].getPropertyInParent() == IASTStandardFunctionDeclarator.FUNCTION_PARAMETER) {
|
|| nodes[0].getPropertyInParent() == IASTStandardFunctionDeclarator.FUNCTION_PARAMETER) {
|
||||||
// function body, we were looking at parameters, now
|
// Function body, we were looking at parameters, now check the body itself.
|
||||||
// check the body itself
|
|
||||||
IASTCompoundStatement compound = null;
|
IASTCompoundStatement compound = null;
|
||||||
if (scopeNode instanceof IASTCompoundStatement) {
|
if (scopeNode instanceof IASTCompoundStatement) {
|
||||||
compound = (IASTCompoundStatement) scopeNode;
|
compound = (IASTCompoundStatement) scopeNode;
|
||||||
|
@ -604,7 +590,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
tempName = ((ICASTCompositeTypeSpecifier)declSpec).getName();
|
tempName = ((ICASTCompositeTypeSpecifier)declSpec).getName();
|
||||||
ASTInternal.addName(this, tempName);
|
ASTInternal.addName(this, tempName);
|
||||||
|
|
||||||
//also have to check for any nested structs
|
// Also have to check for any nested structs.
|
||||||
IASTDeclaration[] nested = ((ICASTCompositeTypeSpecifier)declSpec).getMembers();
|
IASTDeclaration[] nested = ((ICASTCompositeTypeSpecifier)declSpec).getMembers();
|
||||||
for (IASTDeclaration element : nested) {
|
for (IASTDeclaration element : nested) {
|
||||||
if (element instanceof IASTSimpleDeclaration) {
|
if (element instanceof IASTSimpleDeclaration) {
|
||||||
|
@ -619,7 +605,7 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
tempName = enumeration.getName();
|
tempName = enumeration.getName();
|
||||||
ASTInternal.addName(this, tempName);
|
ASTInternal.addName(this, tempName);
|
||||||
|
|
||||||
//check enumerators
|
// Check enumerators.
|
||||||
IASTEnumerator[] list = ((ICASTEnumerationSpecifier) declSpec).getEnumerators();
|
IASTEnumerator[] list = ((ICASTEnumerationSpecifier) declSpec).getEnumerators();
|
||||||
for (IASTEnumerator enumerator : list) {
|
for (IASTEnumerator enumerator : list) {
|
||||||
if (enumerator == null) break;
|
if (enumerator == null) break;
|
||||||
|
@ -629,9 +615,6 @@ public class CScope implements ICScope, IASTInternalScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IScope#getScopeName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IName getScopeName() {
|
public IName getScopeName() {
|
||||||
if (physicalNode instanceof IASTCompositeTypeSpecifier) {
|
if (physicalNode instanceof IASTCompositeTypeSpecifier) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue