mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Cosmetics.
This commit is contained in:
parent
39dce1d497
commit
ef9d90c4f5
4 changed files with 23 additions and 30 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2013 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -81,7 +81,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
|
||||
private void initUsingDirectives() {
|
||||
if (fUsingDirectives == null) {
|
||||
fUsingDirectives= new ArrayList<ICPPUsingDirective>(1);
|
||||
fUsingDirectives= new ArrayList<>(1);
|
||||
// Insert a using directive for every inline namespace found in the index.
|
||||
for (ICPPInternalNamespaceScope inline : getIndexInlineNamespaces()) {
|
||||
if (!(inline instanceof CPPNamespaceScope)) {
|
||||
|
@ -107,7 +107,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
}
|
||||
|
||||
public IScope findNamespaceScope(IIndexScope scope) {
|
||||
final ArrayList<IBinding> parentChain = new ArrayList<IBinding>();
|
||||
final ArrayList<IBinding> parentChain = new ArrayList<>();
|
||||
for (IBinding binding= scope.getScopeBinding(); binding != null; binding= binding.getOwner()) {
|
||||
parentChain.add(binding);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
populateCache();
|
||||
Set<ICPPInternalNamespaceScope> result= null;
|
||||
if (fInlineNamespaceDefinitions != null) {
|
||||
result= new HashSet<ICPPInternalNamespaceScope>(fInlineNamespaceDefinitions.size());
|
||||
result= new HashSet<>(fInlineNamespaceDefinitions.size());
|
||||
for (ICPPASTNamespaceDefinition nsdef : fInlineNamespaceDefinitions) {
|
||||
final IScope scope = nsdef.getScope();
|
||||
if (scope instanceof ICPPInternalNamespaceScope) {
|
||||
|
@ -271,7 +271,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
|
||||
for (ICPPInternalNamespaceScope inline : getIndexInlineNamespaces()) {
|
||||
if (result == null)
|
||||
result = new HashSet<ICPPInternalNamespaceScope>();
|
||||
result = new HashSet<>();
|
||||
result.add(inline);
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
private ICPPInternalNamespaceScope[] getIndexInlineNamespaces() {
|
||||
IASTTranslationUnit tu= getPhysicalNode().getTranslationUnit();
|
||||
if (tu instanceof CPPASTTranslationUnit) {
|
||||
CPPASTTranslationUnit cpptu= (CPPASTTranslationUnit) tu;
|
||||
CPPASTTranslationUnit ast= (CPPASTTranslationUnit) tu;
|
||||
IIndex index= tu.getIndex();
|
||||
if (index != null) {
|
||||
IScope[] inlineScopes= null;
|
||||
|
@ -301,12 +301,10 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
if (inlineScopes != null) {
|
||||
List<ICPPInternalNamespaceScope> result= null;
|
||||
for (IScope scope : inlineScopes) {
|
||||
if (scope instanceof IIndexScope) {
|
||||
scope= cpptu.mapToASTScope((IIndexScope) scope);
|
||||
}
|
||||
scope= ast.mapToASTScope(scope);
|
||||
if (scope instanceof ICPPInternalNamespaceScope) {
|
||||
if (result == null) {
|
||||
result= new ArrayList<ICPPInternalNamespaceScope>();
|
||||
result= new ArrayList<>();
|
||||
}
|
||||
result.add((ICPPInternalNamespaceScope) scope);
|
||||
}
|
||||
|
@ -325,7 +323,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
*/
|
||||
public void addInlineNamespace(ICPPASTNamespaceDefinition nsDef) {
|
||||
if (fInlineNamespaceDefinitions == null) {
|
||||
fInlineNamespaceDefinitions= new ArrayList<ICPPASTNamespaceDefinition>();
|
||||
fInlineNamespaceDefinitions= new ArrayList<>();
|
||||
}
|
||||
fInlineNamespaceDefinitions.add(nsDef);
|
||||
}
|
||||
|
@ -342,7 +340,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
}
|
||||
}
|
||||
|
||||
Set<ICPPInternalNamespaceScope> result= new HashSet<ICPPInternalNamespaceScope>();
|
||||
Set<ICPPInternalNamespaceScope> result= new HashSet<>();
|
||||
result.add(nsScope);
|
||||
addInlineNamespaces(nsScope, result);
|
||||
return result.toArray(new ICPPNamespaceScope[result.size()]);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -49,7 +49,6 @@ import org.eclipse.cdt.internal.core.index.IIndexScope;
|
|||
* scopes that can be reopened, i.e. namespaces.
|
||||
*/
|
||||
public class CPPScopeMapper {
|
||||
|
||||
/**
|
||||
* Used for implicit inline directives for inline namespaces found in the index.
|
||||
*/
|
||||
|
@ -141,7 +140,7 @@ public class CPPScopeMapper {
|
|||
|
||||
private void initUsingDirectives() {
|
||||
if (fUsingDirectives == null) {
|
||||
fUsingDirectives= new ArrayList<ICPPUsingDirective>(1);
|
||||
fUsingDirectives= new ArrayList<>(1);
|
||||
// Insert a using directive for every inline namespace
|
||||
for (ICPPInternalNamespaceScope inline: getInlineNamespaces()) {
|
||||
fUsingDirectives.add(new InlineNamespaceDirective(this, inline));
|
||||
|
@ -248,13 +247,12 @@ public class CPPScopeMapper {
|
|||
}
|
||||
}
|
||||
|
||||
private final HashMap<IIndexScope, IScope> fMappedScopes= new HashMap<IIndexScope, IScope>();
|
||||
private final HashMap<String, NamespaceScopeWrapper> fNamespaceWrappers= new HashMap<String, NamespaceScopeWrapper>();
|
||||
private final Map<String, List<UsingDirectiveWrapper>> fPerName= new HashMap<String, List<UsingDirectiveWrapper>>();
|
||||
private final HashMap<IIndexScope, IScope> fMappedScopes= new HashMap<>();
|
||||
private final HashMap<String, NamespaceScopeWrapper> fNamespaceWrappers= new HashMap<>();
|
||||
private final Map<String, List<UsingDirectiveWrapper>> fPerName= new HashMap<>();
|
||||
private final CPPASTTranslationUnit fTu;
|
||||
protected CharArrayMap<IASTName[]> fClasses;
|
||||
|
||||
|
||||
public CPPScopeMapper(CPPASTTranslationUnit tu) {
|
||||
fTu= tu;
|
||||
}
|
||||
|
@ -386,7 +384,7 @@ public class CPPScopeMapper {
|
|||
}
|
||||
|
||||
if (fClasses == null) {
|
||||
fClasses= new CharArrayMap<IASTName[]>();
|
||||
fClasses= new CharArrayMap<>();
|
||||
fTu.accept(new Visitor());
|
||||
}
|
||||
IASTName[] names= fClasses.get(type.getNameCharArray());
|
||||
|
|
|
@ -484,15 +484,12 @@ public class LookupData extends ScopeLookupData {
|
|||
}
|
||||
|
||||
public IType[] getFunctionArgumentTypes() {
|
||||
if (functionArgTypes == null) {
|
||||
if (functionArgs != null) {
|
||||
ICPPEvaluation[] exprs= functionArgs;
|
||||
functionArgTypes= new IType[exprs.length];
|
||||
for (int i = 0; i < exprs.length; i++) {
|
||||
ICPPEvaluation e = exprs[i];
|
||||
functionArgTypes[i]= getSimplifiedType(e.getTypeOrFunctionSet(getLookupPoint()));
|
||||
}
|
||||
}
|
||||
if (functionArgTypes == null && functionArgs != null) {
|
||||
functionArgTypes= new IType[functionArgs.length];
|
||||
for (int i = 0; i < functionArgs.length; i++) {
|
||||
ICPPEvaluation e = functionArgs[i];
|
||||
functionArgTypes[i]= getSimplifiedType(e.getTypeOrFunctionSet(getLookupPoint()));
|
||||
}
|
||||
}
|
||||
return functionArgTypes;
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class PDOMCPPClassTemplate extends PDOMCPPClassType
|
|||
}
|
||||
|
||||
// Need a class template.
|
||||
if (type instanceof ICPPClassTemplate == false || type instanceof ProblemBinding)
|
||||
if (!(type instanceof ICPPClassTemplate) || type instanceof ProblemBinding)
|
||||
return false;
|
||||
|
||||
// Exclude other kinds of class templates.
|
||||
|
|
Loading…
Add table
Reference in a new issue