1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 13:35:22 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-12-05 16:06:29 -08:00
parent 35a973d9a5
commit b7807b8a16
3 changed files with 24 additions and 30 deletions

View file

@ -51,11 +51,7 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
@Override @Override
public CASTIdExpression copy(CopyStyle style) { public CASTIdExpression copy(CopyStyle style) {
CASTIdExpression copy = new CASTIdExpression(name == null ? null : name.copy(style)); CASTIdExpression copy = new CASTIdExpression(name == null ? null : name.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override
@ -105,13 +101,13 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
public IType getExpressionType() { public IType getExpressionType() {
IBinding binding = getName().resolveBinding(); IBinding binding = getName().resolveBinding();
if (binding instanceof IVariable) { if (binding instanceof IVariable) {
return ((IVariable)binding).getType(); return ((IVariable) binding).getType();
} }
if (binding instanceof IFunction) { if (binding instanceof IFunction) {
return ((IFunction)binding).getType(); return ((IFunction) binding).getType();
} }
if (binding instanceof IEnumerator) { if (binding instanceof IEnumerator) {
return ((IEnumerator)binding).getType(); return ((IEnumerator) binding).getType();
} }
if (binding instanceof IProblemBinding) { if (binding instanceof IProblemBinding) {
return new ProblemType(ISemanticProblem.TYPE_UNRESOLVED_NAME); return new ProblemType(ISemanticProblem.TYPE_UNRESOLVED_NAME);

View file

@ -1,14 +1,14 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation and others. * Copyright (c) 2004, 2011 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
* Bryan Wilkinson (QNX) * Bryan Wilkinson (QNX)
* 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;
@ -48,11 +48,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override @Override
public CPPASTIdExpression copy(CopyStyle style) { public CPPASTIdExpression copy(CopyStyle style) {
CPPASTIdExpression copy = new CPPASTIdExpression(name == null ? null : name.copy(style)); CPPASTIdExpression copy = new CPPASTIdExpression(name == null ? null : name.copy(style));
copy.setOffsetAndLength(this); return copy(copy, style);
if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this);
}
return copy;
} }
@Override @Override
@ -94,7 +90,8 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
@Override @Override
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if (name == n) return r_reference; if (name == n)
return r_reference;
return r_unclear; return r_unclear;
} }

View file

@ -239,6 +239,7 @@ public class CPPVisitor extends ASTQueries {
return new HashSet<IASTDeclSpecifier>(); return new HashSet<IASTDeclSpecifier>();
} }
}; };
public static IBinding createBinding(IASTName name) { public static IBinding createBinding(IASTName name) {
IASTNode parent = name.getParent(); IASTNode parent = name.getParent();
IBinding binding = null; IBinding binding = null;
@ -2000,7 +2001,7 @@ public class CPPVisitor extends ASTQueries {
IASTExpression beginExpr= null; IASTExpression beginExpr= null;
if (forInit instanceof IASTExpression) { if (forInit instanceof IASTExpression) {
final IASTExpression expr = (IASTExpression) forInit; final IASTExpression expr = (IASTExpression) forInit;
IType type= SemanticUtil.getNestedType(expr.getExpressionType(), TDEF|CVTYPE); IType type= SemanticUtil.getNestedType(expr.getExpressionType(), TDEF | CVTYPE);
if (type instanceof IArrayType) { if (type instanceof IArrayType) {
beginExpr= expr.copy(); beginExpr= expr.copy();
} }