From 90e1dc0b1baa47d0a7ef149339f6ce967ab89c1f Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 2 May 2012 11:12:34 -0700 Subject: [PATCH] Cosmetics. --- .../core/dom/parser/cpp/CPPClassScope.java | 38 +++++-------------- .../dom/parser/cpp/CPPNamespaceScope.java | 25 ++++-------- 2 files changed, 18 insertions(+), 45 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java index 54d28dd6ac8..363a9138ce3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java @@ -120,7 +120,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { //copy constructor: A(const A &) ICPPMethod m = new CPPImplicitConstructor(this, className, ps); - implicits[i++]=m; + implicits[i++] = m; addBinding(m); } @@ -150,9 +150,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return CPPVisitor.getContainingNonTemplateScope(compName); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#addBinding(org.eclipse.cdt.core.dom.ast.IBinding) - */ @Override public void addBinding(IBinding binding) { if (binding instanceof ICPPConstructor) { @@ -164,16 +161,16 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { @Override public void addName(IASTName name) { - // don't add names from inactive code branches + // Don't add names from inactive code branches. if (!name.isActive()) return; if (name instanceof ICPPASTQualifiedName) { - // check whether the qualification matches + // Check whether the qualification matches. IBinding b= getClassType(); final ICPPASTQualifiedName qname = (ICPPASTQualifiedName) name; final IASTName[] names= qname.getNames(); - for (int i = names.length-2; i>=0; i--) { + for (int i = names.length - 1; --i >= 0;) { if (b == null || !CharArrayUtils.equals(names[i].getLookupKey(), b.getNameCharArray())) return; @@ -211,9 +208,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { bindings.put(CONSTRUCTOR_KEY, constructor); } } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[]) - */ + @Override public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet fileSet) { char[] c = name.getLookupKey(); @@ -231,8 +226,8 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { } @Override - public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, IIndexFileSet fileSet, - boolean checkPointOfDecl) { + public IBinding[] getBindings(IASTName name, boolean resolve, boolean prefixLookup, + IIndexFileSet fileSet, boolean checkPointOfDecl) { char[] c = name.getLookupKey(); ICPPASTCompositeTypeSpecifier compType = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); @@ -299,7 +294,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return ArrayUtil.trim(ICPPConstructor.class, bs); } else if (o instanceof IASTName) { if (shouldResolve(forceResolve, (IASTName) o, forName) || ((IASTName) o).getBinding() != null) { - // always store the name, rather than the binding, such that we can properly flush the scope. + // Always store the name, rather than the binding, such that we can properly flush the scope. nameMap.put(CONSTRUCTOR_KEY, o); binding = ((IASTName)o).resolveBinding(); } @@ -313,9 +308,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.IScope#find(java.lang.String) - */ @Override public IBinding[] find(String name) { char[] n = name.toCharArray(); @@ -359,9 +351,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return true; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType() - */ @Override public ICPPClassType getClassType() { ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); @@ -373,9 +362,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return new CPPClassType.CPPClassTypeProblem(name, ISemanticProblem.BINDING_NO_CLASS, name.toCharArray()); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods() - */ @Override public ICPPMethod[] getImplicitMethods() { if (implicits == null) @@ -384,9 +370,6 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope { return implicits; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName() - */ @Override public IName getScopeName() { IASTNode node = getPhysicalNode(); @@ -419,12 +402,12 @@ class ImplicitsAnalysis { hasUserDeclaredCopyAssignmentOperator= false; hasUserDeclaredDestructor= getUserDeclaredCtorOrDtor(compSpec, false).length>0; - outer: for (int i=0; i= 1) { if (hasTypeReferenceToClassType(ps[0])) { - // and all remaining arguments have initializers + // All remaining arguments have initializers. for (int j = 1; j < ps.length; j++) { if (ps[j].getDeclarator().getInitializer() == null) { continue outer; @@ -464,7 +447,6 @@ class ImplicitsAnalysis { spec = ((IASTFunctionDefinition)member).getDeclSpecifier(); } - if (!(dcltor instanceof ICPPASTFunctionDeclarator) || !(spec instanceof IASTSimpleDeclSpecifier) || ((IASTSimpleDeclSpecifier)spec).getType() != IASTSimpleDeclSpecifier.t_unspecified) { continue; diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java index c06b8d06f17..b3940cd35bb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPNamespaceScope.java @@ -1,11 +1,11 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 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 - * http://www.eclipse.org/legal/epl-v10.html + * Copyright (c) 2004, 2010 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 + * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * Andrew Niefer (IBM Corporation) - initial API and implementation * Markus Schorn (Wind River Systems) *******************************************************************************/ @@ -42,9 +42,9 @@ import org.eclipse.core.runtime.CoreException; * Implementation of namespace scopes, including global scope. */ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespaceScope { - private static final ICPPInternalNamespaceScope[] NO_NAMESPACE_SCOPES = new ICPPInternalNamespaceScope[0]; + private static final ICPPInternalNamespaceScope[] NO_NAMESPACE_SCOPES = {}; - private List fUsingDirectives = null; + private List fUsingDirectives; private boolean fIsInline; private boolean fIsInlineInitialized; @@ -64,9 +64,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace return EScopeKind.eNamespace; } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#getUsingDirectives() - */ @Override public ICPPUsingDirective[] getUsingDirectives() { initUsingDirectives(); @@ -86,18 +83,12 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace } } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope#addUsingDirective(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective) - */ @Override public void addUsingDirective(ICPPUsingDirective directive) { initUsingDirectives(); fUsingDirectives.add(directive); } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName() - */ @Override public IName getScopeName() { IASTNode node = getPhysicalNode();