1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-31 01:46:31 +00:00
parent c1a3773622
commit bb1eb7f5f7

View file

@ -134,6 +134,7 @@ public class CScope implements ICScope, IASTInternalScope {
protected static class CollectNamesAction extends ASTVisitor {
private char[] name;
private IASTName[] result = null;
CollectNamesAction(char[] n) {
name = n;
shouldVisitNames = true;
@ -143,20 +144,21 @@ public class CScope implements ICScope, IASTInternalScope {
ASTNodeProperty prop = n.getPropertyInParent();
if (prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
prop == IASTDeclarator.DECLARATOR_NAME )
{
prop == IASTDeclarator.DECLARATOR_NAME) {
if (CharArrayUtils.equals(n.toCharArray(), name))
result = (IASTName[]) ArrayUtil.append(IASTName.class, result, n);
}
return PROCESS_CONTINUE;
}
@Override
public int visit(IASTStatement statement) {
if (statement instanceof IASTDeclarationStatement)
return PROCESS_CONTINUE;
return PROCESS_SKIP;
}
public IASTName[] getNames() {
return (IASTName[]) ArrayUtil.trim(IASTName.class, result);
}
@ -226,8 +228,7 @@ public class CScope implements ICScope, IASTInternalScope {
if (prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
prop == IASTEnumerationSpecifier.ENUMERATION_NAME ||
prop == CVisitor.STRING_LOOKUP_TAGS_PROPERTY )
{
prop == CVisitor.STRING_LOOKUP_TAGS_PROPERTY) {
return NAMESPACE_TYPE_TAG;
}
@ -310,8 +311,7 @@ public class CScope implements ICScope, IASTInternalScope {
if (parent instanceof IASTSimpleDeclSpecifier) {
if (((IASTSimpleDeclSpecifier) parent).getDeclTypeExpression() != null)
return false;
}
else if (parent instanceof IASTTypeIdExpression) {
} else if (parent instanceof IASTTypeIdExpression) {
if (((IASTTypeIdExpression) parent).getOperator() == IASTTypeIdExpression.op_typeof)
return false;
}
@ -348,15 +348,16 @@ public class CScope implements ICScope, IASTInternalScope {
IIndex index = tu.getIndex();
if (index != null) {
try {
IBinding[] bindings = prefixLookup ? index.findBindingsForContentAssist(name.toCharArray(), true, INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null)
: index.findBindings(name.toCharArray(), INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null);
IBinding[] bindings = prefixLookup ?
index.findBindingsForContentAssist(name.toCharArray(), true, INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null) :
index.findBindings(name.toCharArray(), INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null);
if (fileSet != null) {
bindings = fileSet.filterFileLocalBindings(bindings);
}
obj = ArrayUtil.addAll(Object.class, obj, bindings);
} catch (CoreException ce) {
CCorePlugin.log(ce);
} catch (CoreException e) {
CCorePlugin.log(e);
}
}
}
@ -392,7 +393,7 @@ public class CScope implements ICScope, IASTInternalScope {
/**
* Index results from global scope, differ from ast results from translation unit scope. This routine
* is intended to fix results from the index to be consistent with ast scope behaviour.
* is intended to fix results from the index to be consistent with ast scope behavior.
* @param name the name as it occurs in the ast
* @param bindings the set of candidate bindings
* @return the appropriate binding, or null if no binding is appropriate for the ast name