1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-10-20 16:35:17 -07:00
parent 0c4ddcf922
commit 4e5201e47c

View file

@ -32,9 +32,9 @@ import org.eclipse.cdt.core.index.IIndexFileSet;
import org.eclipse.cdt.core.parser.util.CharArrayObjectMap; import org.eclipse.cdt.core.parser.util.CharArrayObjectMap;
/** /**
* Models the scope represented by an unknown type (e.g.: typeof(template type parameter)). Used within * Models the scope represented by an unknown type (e.g.: typeof(template type parameter)).
* the context of templates, only. * Used within the context of templates, only. For safe usage in index bindings, all fields need
* For safe usage in index bindings, all fields need to be final or used in a thread-safe manner otherwise. * to be final or used in a thread-safe manner otherwise.
*/ */
public class CPPUnknownTypeScope implements ICPPInternalUnknownScope { public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
private final IASTName fName; private final IASTName fName;
@ -111,8 +111,8 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
} }
if (!type) { if (!type) {
if (parent instanceof ICPPASTBaseSpecifier || if (parent instanceof ICPPASTBaseSpecifier ||
parent instanceof ICPPASTConstructorChainInitializer) { parent instanceof ICPPASTConstructorChainInitializer) {
type= true; type= true;
} else if (parent instanceof ICPPASTNamedTypeSpecifier) { } else if (parent instanceof ICPPASTNamedTypeSpecifier) {
ICPPASTNamedTypeSpecifier nts= (ICPPASTNamedTypeSpecifier) parent; ICPPASTNamedTypeSpecifier nts= (ICPPASTNamedTypeSpecifier) parent;
type= nts.isTypename(); type= nts.isTypename();
@ -123,7 +123,7 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
} }
if (!type && parent.getPropertyInParent() == IASTFunctionCallExpression.FUNCTION_NAME) { if (!type && parent.getPropertyInParent() == IASTFunctionCallExpression.FUNCTION_NAME) {
function= true; function= true;
} }
} }
} }
@ -158,11 +158,11 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
} }
IASTName lookupName= lookup.getLookupName(); IASTName lookupName= lookup.getLookupName();
if (lookupName != null) if (lookupName != null)
return new IBinding[] {getBinding(lookupName, lookup.isResolve(), lookup.getIncludedFiles())}; return new IBinding[] { getBinding(lookupName, lookup.isResolve(), lookup.getIncludedFiles()) };
// When dealing with dependent expressions we always create an unknown class. That is because // When dealing with dependent expressions we always create an unknown class. That is because
// unknown objects are not used within the expressions, they are attached to names only. // unknown objects are not used within the expressions, they are attached to names only.
return new IBinding[] {getOrCreateBinding(lookup.getLookupKey(), 0)}; return new IBinding[] { getOrCreateBinding(lookup.getLookupKey(), 0) };
} }
@Override @Override
@ -176,7 +176,7 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
protected IBinding getOrCreateBinding(final char[] name, int idx) { protected IBinding getOrCreateBinding(final char[] name, int idx) {
if (map == null) if (map == null)
map = new CharArrayObjectMap<IBinding[]>(2); map = new CharArrayObjectMap<>(2);
IBinding[] o = map.get(name); IBinding[] o = map.get(name);
if (o == null) { if (o == null) {
@ -204,7 +204,7 @@ public class CPPUnknownTypeScope implements ICPPInternalUnknownScope {
@Override @Override
public void addBinding(IBinding binding) { public void addBinding(IBinding binding) {
// do nothing, this is part of template magic and not a normal scope // Do nothing, this is part of template magic and not a normal scope.
} }
@Override @Override