mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 14:15:23 +02:00
Cosmetics.
This commit is contained in:
parent
35a973d9a5
commit
b7807b8a16
3 changed files with 24 additions and 30 deletions
|
@ -51,11 +51,7 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
|
|||
@Override
|
||||
public CASTIdExpression copy(CopyStyle style) {
|
||||
CASTIdExpression copy = new CASTIdExpression(name == null ? null : name.copy(style));
|
||||
copy.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
copy.setCopyLocation(this);
|
||||
}
|
||||
return copy;
|
||||
return copy(copy, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,13 +101,13 @@ public class CASTIdExpression extends ASTNode implements IASTIdExpression, IASTC
|
|||
public IType getExpressionType() {
|
||||
IBinding binding = getName().resolveBinding();
|
||||
if (binding instanceof IVariable) {
|
||||
return ((IVariable)binding).getType();
|
||||
return ((IVariable) binding).getType();
|
||||
}
|
||||
if (binding instanceof IFunction) {
|
||||
return ((IFunction)binding).getType();
|
||||
return ((IFunction) binding).getType();
|
||||
}
|
||||
if (binding instanceof IEnumerator) {
|
||||
return ((IEnumerator)binding).getType();
|
||||
return ((IEnumerator) binding).getType();
|
||||
}
|
||||
if (binding instanceof IProblemBinding) {
|
||||
return new ProblemType(ISemanticProblem.TYPE_UNRESOLVED_NAME);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2011 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:
|
||||
* John Camelon (IBM) - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Copyright (c) 2004, 2011 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:
|
||||
* John Camelon (IBM) - Initial API and implementation
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -48,11 +48,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
|
|||
@Override
|
||||
public CPPASTIdExpression copy(CopyStyle style) {
|
||||
CPPASTIdExpression copy = new CPPASTIdExpression(name == null ? null : name.copy(style));
|
||||
copy.setOffsetAndLength(this);
|
||||
if (style == CopyStyle.withLocations) {
|
||||
copy.setCopyLocation(this);
|
||||
}
|
||||
return copy;
|
||||
return copy(copy, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +90,8 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
|
|||
|
||||
@Override
|
||||
public int getRoleForName(IASTName n) {
|
||||
if (name == n) return r_reference;
|
||||
if (name == n)
|
||||
return r_reference;
|
||||
return r_unclear;
|
||||
}
|
||||
|
||||
|
@ -107,12 +104,12 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
|
|||
public String toString() {
|
||||
return name != null ? name.toString() : "<unnamed>"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBinding[] findBindings(IASTName n, boolean isPrefix) {
|
||||
return findBindings(n, isPrefix, null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ICPPEvaluation getEvaluation() {
|
||||
if (fEvaluation == null) {
|
||||
|
@ -120,7 +117,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
|
|||
}
|
||||
return fEvaluation;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IType getExpressionType() {
|
||||
IType type= getEvaluation().getTypeOrFunctionSet(this);
|
||||
|
@ -128,12 +125,12 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, ICP
|
|||
IBinding binding= name.resolveBinding();
|
||||
if (binding instanceof IFunction) {
|
||||
return SemanticUtil.mapToAST(((IFunction) binding).getType(), this);
|
||||
}
|
||||
}
|
||||
return ProblemType.UNKNOWN_FOR_EXPRESSION;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isLValue() {
|
||||
return getValueCategory() == LVALUE;
|
||||
|
|
|
@ -239,6 +239,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
return new HashSet<IASTDeclSpecifier>();
|
||||
}
|
||||
};
|
||||
|
||||
public static IBinding createBinding(IASTName name) {
|
||||
IASTNode parent = name.getParent();
|
||||
IBinding binding = null;
|
||||
|
@ -2000,7 +2001,7 @@ public class CPPVisitor extends ASTQueries {
|
|||
IASTExpression beginExpr= null;
|
||||
if (forInit instanceof IASTExpression) {
|
||||
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) {
|
||||
beginExpr= expr.copy();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue