mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
Cosmetics.
This commit is contained in:
parent
ecf7d25dd9
commit
b40827283d
1 changed files with 22 additions and 21 deletions
|
@ -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.
|
* in the given scope.
|
||||||
*/
|
*/
|
||||||
public static IBinding[] findBindingsForQualifiedName(IScope scope, String qualifiedName) {
|
public static IBinding[] findBindingsForQualifiedName(IScope scope, String qualifiedName) {
|
||||||
|
|
||||||
// Return immediately if the qualifiedName does not match a known format.
|
// Return immediately if the qualifiedName does not match a known format.
|
||||||
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
|
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
|
||||||
if (!m.matches())
|
if (!m.matches())
|
||||||
|
@ -3647,8 +3646,9 @@ public class CPPSemantics {
|
||||||
if (isGlobal) {
|
if (isGlobal) {
|
||||||
IScope global = scope;
|
IScope global = scope;
|
||||||
try {
|
try {
|
||||||
while(global.getParent() != null)
|
while (global.getParent() != null) {
|
||||||
global = global.getParent();
|
global = global.getParent();
|
||||||
|
}
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
@ -3662,7 +3662,7 @@ public class CPPSemantics {
|
||||||
|
|
||||||
// If the qualified name is not rooted in the global namespace (with a leading ::), then
|
// If the qualified name is not rooted in the global namespace (with a leading ::), then
|
||||||
// look at all parent scopes.
|
// look at all parent scopes.
|
||||||
if (!isGlobal)
|
if (!isGlobal) {
|
||||||
try {
|
try {
|
||||||
while (scope != null) {
|
while (scope != null) {
|
||||||
scope = scope.getParent();
|
scope = scope.getParent();
|
||||||
|
@ -3672,8 +3672,9 @@ public class CPPSemantics {
|
||||||
} catch (DOMException e) {
|
} catch (DOMException e) {
|
||||||
CCorePlugin.log(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) {
|
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
|
// 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
|
// the call tree gets to a leaf (non-qualified name) then a simple lookup happens and all matching
|
||||||
// bindings are added to the result.
|
// bindings are added to the result.
|
||||||
|
|
||||||
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
|
Matcher m = QUALNAME_REGEX.matcher(qualifiedName);
|
||||||
if (!m.matches())
|
if (!m.matches())
|
||||||
return;
|
return;
|
||||||
|
@ -3697,9 +3697,10 @@ public class CPPSemantics {
|
||||||
|
|
||||||
// Find all bindings that match the first part of the name. For each such binding,
|
// Find all bindings that match the first part of the name. For each such binding,
|
||||||
// lookup the second part of the name.
|
// 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);
|
findBindingsForQualifiedName(getLookupScope(binding), part2, bindings);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static ICPPScope getNamespaceScope(CPPASTTranslationUnit tu, String[] namespaceParts, IASTNode point)
|
private static ICPPScope getNamespaceScope(CPPASTTranslationUnit tu, String[] namespaceParts, IASTNode point)
|
||||||
throws DOMException {
|
throws DOMException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue