1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-10-04 16:09:29 -07:00
parent 3edce39739
commit c09afdc574
6 changed files with 77 additions and 85 deletions

View file

@ -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;
@ -19,10 +19,9 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IValue;
/**
* Base class for c- and c++ enumerators.
* Base class for C and C++ enumerators.
*/
public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, IASTAmbiguityParent {
private IASTName name;
private IASTExpression value;
private IValue integralValue;
@ -68,27 +67,26 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitEnumerators ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitEnumerators) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( name != null ) if( !name.accept( action ) ) return false;
if( value != null ) if( !value.accept( action ) ) return false;
if( action.shouldVisitEnumerators ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (name != null && !name.accept(action)) return false;
if (value != null && !value.accept(action)) return false;
if (action.shouldVisitEnumerators) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
public int getRoleForName(IASTName n) {
if (n == name)
return r_definition;
@ -97,11 +95,10 @@ public abstract class ASTEnumerator extends ASTNode implements IASTEnumerator, I
}
public void replace(IASTNode child, IASTNode other) {
if( child == value)
{
other.setPropertyInParent( child.getPropertyInParent() );
other.setParent( child.getParent() );
value = (IASTExpression) other;
if (child == value) {
other.setPropertyInParent(child.getPropertyInParent());
other.setParent(child.getParent());
value = (IASTExpression) other;
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -20,12 +20,10 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
* @author jcamelon
*/
public class CPPASTDeclarationStatement extends ASTNode implements
IASTDeclarationStatement, IASTAmbiguityParent {
public class CPPASTDeclarationStatement extends ASTNode
implements IASTDeclarationStatement, IASTAmbiguityParent {
private IASTDeclaration declaration;
public CPPASTDeclarationStatement() {
}
@ -61,30 +59,29 @@ public class CPPASTDeclarationStatement extends ASTNode implements
}
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( declaration != null ) if( !declaration.accept( action ) ) return false;
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (declaration != null && !declaration.accept(action)) return false;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;
}
public void replace(IASTNode child, IASTNode other) {
if( declaration == child )
{
other.setParent( child.getParent() );
other.setPropertyInParent( child.getPropertyInParent() );
if (declaration == child) {
other.setParent(child.getParent());
other.setPropertyInParent(child.getPropertyInParent());
declaration = (IASTDeclaration) other;
}
}

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
* IBM - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -20,19 +20,19 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
public class CPPASTDefaultStatement extends ASTNode implements IASTDefaultStatement {
@Override
public boolean accept( ASTVisitor action ){
if( action.shouldVisitStatements ){
switch( action.visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
public boolean accept(ASTVisitor action) {
if (action.shouldVisitStatements) {
switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
if( action.shouldVisitStatements ){
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
if (action.shouldVisitStatements) {
switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default: break;
}
}
return true;

View file

@ -143,7 +143,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
public ICPPASTCompositeTypeSpecifier getCompositeTypeSpecifier() {
if (definition != null) {
IASTNode node = definition;
while(node instanceof IASTName)
while (node instanceof IASTName)
node = node.getParent();
if (node instanceof ICPPASTCompositeTypeSpecifier)
return (ICPPASTCompositeTypeSpecifier)node;
@ -154,7 +154,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
private ICPPASTElaboratedTypeSpecifier getElaboratedTypeSpecifier() {
if (declarations != null) {
IASTNode node = declarations[0];
while(node instanceof IASTName)
while (node instanceof IASTName)
node = node.getParent();
if (node instanceof ICPPASTElaboratedTypeSpecifier)
return (ICPPASTElaboratedTypeSpecifier)node;
@ -180,7 +180,7 @@ public class CPPClassType extends PlatformObject implements ICPPInternalClassTyp
&& !getElaboratedTypeSpecifier().isFriend()) {
// 3.3.1.5 class-key identifier ;
} else {
while(scope instanceof ICPPClassScope || scope instanceof ICPPFunctionScope) {
while (scope instanceof ICPPClassScope || scope instanceof ICPPFunctionScope) {
try {
scope = scope.getParent();
} catch (DOMException e1) {

View file

@ -6,12 +6,12 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
* Mike Kucera (IBM)
* Andrew Niefer (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
* Mike Kucera (IBM)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;
@ -2042,7 +2042,6 @@ public class CPPSemantics {
return type;
}
if (fns.size() > 0) {
final ICPPFunction[] fnArray = fns.keyArray(ICPPFunction.class);
if (type != null && overrulesByRelevance(data, type, fnArray)) {
@ -2352,7 +2351,6 @@ public class CPPSemantics {
if (tmp.length == 0 || tmp[0] == null)
return new ProblemBinding(data.astName, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, fns);
int viableCount= 0;
for (IFunction f : tmp) {
if (f instanceof ICPPUnknownBinding) {
@ -2681,7 +2679,7 @@ public class CPPSemantics {
return CONTAINS_DEPENDENT_TYPES;
Context ctx= Context.ORDINARY;
if (j==0 && sourceLen == 1 && fn instanceof ICPPConstructor) {
if (j == 0 && sourceLen == 1 && fn instanceof ICPPConstructor) {
if (paramType instanceof ICPPReferenceType) {
if (((ICPPConstructor) fn).getClassOwner().isSameType(getNestedType(paramType, TDEF|REF|CVTYPE))) {
ctx= Context.FIRST_PARAM_OF_DIRECT_COPY_CTOR;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Sergey Prigogin (Google) - initial API and implementation
* Sergey Prigogin (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom;