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

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-11-04 12:02:51 -08:00
parent bf95b80b05
commit 8997a49ef1
2 changed files with 12 additions and 12 deletions

View file

@ -40,7 +40,8 @@ import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContext;
*/
public class NamespaceHelper {
/**
* Returns the qualified name of all namespaces that are defined at the specified translation unit and offset.
* Returns the qualified name of all namespaces that are defined at the specified translation
* unit and offset.
*
* @param translationUnit
* @param offset
@ -55,7 +56,8 @@ public class NamespaceHelper {
astCache.getAST(translationUnit, null).accept(new CPPASTAllVisitor() {
@Override
public int visit(IASTDeclSpecifier declSpec) {
if (declSpec instanceof ICPPASTCompositeTypeSpecifier && checkFileNameAndLocation(translationUnit.getLocation(), offset, declSpec)) {
if (declSpec instanceof ICPPASTCompositeTypeSpecifier &&
checkFileNameAndLocation(translationUnit.getLocation(), offset, declSpec)) {
qualifiedName.addName(createNameWithTemplates(declSpec));
}
return super.visit(declSpec);
@ -92,8 +94,7 @@ public class NamespaceHelper {
}
private static IASTName createNameWithTemplates(IASTNode declarationParent) {
IASTName parentName;
parentName = ((ICPPASTCompositeTypeSpecifier) declarationParent).getName().copy(
IASTName parentName = ((ICPPASTCompositeTypeSpecifier) declarationParent).getName().copy(
CopyStyle.withLocations);
if (classHasTemplates(declarationParent)) {
@ -101,7 +102,6 @@ public class NamespaceHelper {
templateId.setTemplateName(parentName);
for (ICPPASTTemplateParameter templateParameter : ((ICPPASTTemplateDeclaration) declarationParent.getParent().getParent()).getTemplateParameters()) {
if (templateParameter instanceof CPPASTSimpleTypeTemplateParameter) {
CPPASTSimpleTypeTemplateParameter simpleTypeTemplateParameter = (CPPASTSimpleTypeTemplateParameter) templateParameter;

View file

@ -289,7 +289,7 @@ public class IndexUI {
if (binding != null) {
IIndexName[] defs= index.findNames(binding, IIndex.FIND_DEFINITIONS | IIndex.SEARCH_ACROSS_LANGUAGE_BOUNDARIES);
ArrayList<ICElementHandle> result= new ArrayList<ICElementHandle>();
ArrayList<ICElementHandle> result= new ArrayList<>();
for (IIndexName in : defs) {
ICElementHandle definition= getCElementForName((ICProject) null, index, in);
if (definition != null) {
@ -506,7 +506,7 @@ public class IndexUI {
for (ICPPTemplateInstance inst : instances) {
if (!ASTInternal.hasDeclaration(inst)) {
if (result == null)
result= new ArrayList<IBinding>(instances.length);
result= new ArrayList<>(instances.length);
result.add(inst);
}
}
@ -524,7 +524,7 @@ public class IndexUI {
specializedMember= index.adaptBinding(specializedMember);
if (specializedMember != null) {
if (result == null)
result= new ArrayList<IBinding>(specializations.size());
result= new ArrayList<>(specializations.size());
result.add(specializedMember);
// Also add instances of the specialized member.
if (specializedMember instanceof ICPPInstanceCache) {