1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +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 { protected static class CollectNamesAction extends ASTVisitor {
private char[] name; private char[] name;
private IASTName[] result = null; private IASTName[] result = null;
CollectNamesAction(char[] n) { CollectNamesAction(char[] n) {
name = n; name = n;
shouldVisitNames = true; shouldVisitNames = true;
@ -143,20 +144,21 @@ public class CScope implements ICScope, IASTInternalScope {
ASTNodeProperty prop = n.getPropertyInParent(); ASTNodeProperty prop = n.getPropertyInParent();
if (prop == IASTElaboratedTypeSpecifier.TYPE_NAME || if (prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
prop == IASTCompositeTypeSpecifier.TYPE_NAME || prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
prop == IASTDeclarator.DECLARATOR_NAME ) prop == IASTDeclarator.DECLARATOR_NAME) {
{
if (CharArrayUtils.equals(n.toCharArray(), name)) if (CharArrayUtils.equals(n.toCharArray(), name))
result = (IASTName[]) ArrayUtil.append(IASTName.class, result, n); result = (IASTName[]) ArrayUtil.append(IASTName.class, result, n);
} }
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
} }
@Override @Override
public int visit(IASTStatement statement) { public int visit(IASTStatement statement) {
if (statement instanceof IASTDeclarationStatement) if (statement instanceof IASTDeclarationStatement)
return PROCESS_CONTINUE; return PROCESS_CONTINUE;
return PROCESS_SKIP; return PROCESS_SKIP;
} }
public IASTName[] getNames() { public IASTName[] getNames() {
return (IASTName[]) ArrayUtil.trim(IASTName.class, result); return (IASTName[]) ArrayUtil.trim(IASTName.class, result);
} }
@ -226,8 +228,7 @@ public class CScope implements ICScope, IASTInternalScope {
if (prop == IASTCompositeTypeSpecifier.TYPE_NAME || if (prop == IASTCompositeTypeSpecifier.TYPE_NAME ||
prop == IASTElaboratedTypeSpecifier.TYPE_NAME || prop == IASTElaboratedTypeSpecifier.TYPE_NAME ||
prop == IASTEnumerationSpecifier.ENUMERATION_NAME || prop == IASTEnumerationSpecifier.ENUMERATION_NAME ||
prop == CVisitor.STRING_LOOKUP_TAGS_PROPERTY ) prop == CVisitor.STRING_LOOKUP_TAGS_PROPERTY) {
{
return NAMESPACE_TYPE_TAG; return NAMESPACE_TYPE_TAG;
} }
@ -310,8 +311,7 @@ public class CScope implements ICScope, IASTInternalScope {
if (parent instanceof IASTSimpleDeclSpecifier) { if (parent instanceof IASTSimpleDeclSpecifier) {
if (((IASTSimpleDeclSpecifier) parent).getDeclTypeExpression() != null) if (((IASTSimpleDeclSpecifier) parent).getDeclTypeExpression() != null)
return false; return false;
} } else if (parent instanceof IASTTypeIdExpression) {
else if (parent instanceof IASTTypeIdExpression) {
if (((IASTTypeIdExpression) parent).getOperator() == IASTTypeIdExpression.op_typeof) if (((IASTTypeIdExpression) parent).getOperator() == IASTTypeIdExpression.op_typeof)
return false; return false;
} }
@ -348,15 +348,16 @@ public class CScope implements ICScope, IASTInternalScope {
IIndex index = tu.getIndex(); IIndex index = tu.getIndex();
if (index != null) { if (index != null) {
try { try {
IBinding[] bindings = prefixLookup ? index.findBindingsForContentAssist(name.toCharArray(), true, INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null) IBinding[] bindings = prefixLookup ?
: index.findBindings(name.toCharArray(), INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null); index.findBindingsForContentAssist(name.toCharArray(), true, INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null) :
index.findBindings(name.toCharArray(), INDEX_FILTERS[NAMESPACE_TYPE_BOTH], null);
if (fileSet != null) { if (fileSet != null) {
bindings = fileSet.filterFileLocalBindings(bindings); bindings = fileSet.filterFileLocalBindings(bindings);
} }
obj = ArrayUtil.addAll(Object.class, obj, bindings); obj = ArrayUtil.addAll(Object.class, obj, bindings);
} catch (CoreException ce) { } catch (CoreException e) {
CCorePlugin.log(ce); 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 * 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 name the name as it occurs in the ast
* @param bindings the set of candidate bindings * @param bindings the set of candidate bindings
* @return the appropriate binding, or null if no binding is appropriate for the ast name * @return the appropriate binding, or null if no binding is appropriate for the ast name