1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-12-06 12:17:26 -08:00
parent ecf7d25dd9
commit b40827283d

View file

@ -3632,11 +3632,10 @@ public class CPPSemantics {
}
/**
* Use C++ lookup semantics to find the possible bindings for the given qualified name starting
* Uses C++ lookup semantics to find the possible bindings for the given qualified name starting
* in the given scope.
*/
public static IBinding[] findBindingsForQualifiedName(IScope scope, String qualifiedName) {
// Return immediately if the qualifiedName does not match a known format.
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
if (!m.matches())
@ -3647,9 +3646,10 @@ public class CPPSemantics {
if (isGlobal) {
IScope global = scope;
try {
while(global.getParent() != null)
while (global.getParent() != null) {
global = global.getParent();
} catch(DOMException e) {
}
} catch (DOMException e) {
CCorePlugin.log(e);
}
scope = global;
@ -3662,9 +3662,9 @@ public class CPPSemantics {
// If the qualified name is not rooted in the global namespace (with a leading ::), then
// look at all parent scopes.
if (!isGlobal)
if (!isGlobal) {
try {
while(scope != null) {
while (scope != null) {
scope = scope.getParent();
if (scope != null)
findBindingsForQualifiedName(scope, qualifiedName, bindings);
@ -3672,8 +3672,9 @@ public class CPPSemantics {
} catch (DOMException e) {
CCorePlugin.log(e);
}
}
return bindings.size() <= 0 ? IBinding.EMPTY_BINDING_ARRAY : bindings.toArray(new IBinding[bindings.size()]);
return bindings.size() == 0 ? IBinding.EMPTY_BINDING_ARRAY : bindings.toArray(new IBinding[bindings.size()]);
}
private static void findBindingsForQualifiedName(IScope scope, String qualifiedName, Collection<IBinding> bindings) {
@ -3681,7 +3682,6 @@ public class CPPSemantics {
// bindings for the first part are found and their scope is used to find the rest of the name. When
// the call tree gets to a leaf (non-qualified name) then a simple lookup happens and all matching
// bindings are added to the result.
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
if (!m.matches())
return;
@ -3697,9 +3697,10 @@ public class CPPSemantics {
// Find all bindings that match the first part of the name. For each such binding,
// lookup the second part of the name.
for(IBinding binding : CPPSemantics.findBindings(scope, part1, false))
for (IBinding binding : CPPSemantics.findBindings(scope, part1, false)) {
findBindingsForQualifiedName(getLookupScope(binding), part2, bindings);
}
}
private static ICPPScope getNamespaceScope(CPPASTTranslationUnit tu, String[] namespaceParts, IASTNode point)
throws DOMException {