1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Code streamlining.

This commit is contained in:
Sergey Prigogin 2012-08-20 19:48:20 -07:00
parent 1bd247ce3d
commit e430e7f6b4

View file

@ -1,13 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* John Camelon (IBM) - Initial API and implementation * John Camelon (IBM) - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -40,16 +40,12 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
public CPPASTTypeIdExpression copy() { public CPPASTTypeIdExpression copy() {
return copy(CopyStyle.withoutLocations); return copy(CopyStyle.withoutLocations);
} }
@Override @Override
public CPPASTTypeIdExpression copy(CopyStyle style) { public CPPASTTypeIdExpression copy(CopyStyle style) {
CPPASTTypeIdExpression copy = new CPPASTTypeIdExpression(op, typeId == null ? null CPPASTTypeIdExpression copy =
: typeId.copy(style)); new CPPASTTypeIdExpression(op, typeId == null ? null : typeId.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override
@ -66,11 +62,11 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
@Override @Override
public void setTypeId(IASTTypeId typeId) { public void setTypeId(IASTTypeId typeId) {
assertNotFrozen(); assertNotFrozen();
this.typeId = typeId; this.typeId = typeId;
if (typeId != null) { if (typeId != null) {
typeId.setParent(this); typeId.setParent(this);
typeId.setPropertyInParent(TYPE_ID); typeId.setPropertyInParent(TYPE_ID);
} }
} }
@Override @Override
@ -87,9 +83,9 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
default: break; default: break;
} }
} }
if (typeId != null && !typeId.accept(action)) return false; if (typeId != null && !typeId.accept(action)) return false;
if (action.shouldVisitExpressions) { if (action.shouldVisitExpressions) {
switch (action.leave(this)) { switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false; case ASTVisitor.PROCESS_ABORT: return false;
@ -99,7 +95,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
} }
return true; return true;
} }
@Override @Override
public ICPPEvaluation getEvaluation() { public ICPPEvaluation getEvaluation() {
if (fEvaluation == null) { if (fEvaluation == null) {
@ -112,7 +108,7 @@ public class CPPASTTypeIdExpression extends ASTNode implements ICPPASTTypeIdExpr
} }
return fEvaluation; return fEvaluation;
} }
@Override @Override
public IType getExpressionType() { public IType getExpressionType() {
return getEvaluation().getTypeOrFunctionSet(this); return getEvaluation().getTypeOrFunctionSet(this);