mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Removed use of a deprecated method.
Change-Id: I00934f05c35e5ccba097c05904f8b68d897a71de
This commit is contained in:
parent
2c9820b2b0
commit
7f6a6ae5ca
2 changed files with 31 additions and 28 deletions
|
@ -5356,13 +5356,13 @@ public class AST2Tests extends AST2TestBase {
|
||||||
return ((ASTNode) expr).getOffset() + ((ASTNode) expr).getLength();
|
return ((ASTNode) expr).getOffset() + ((ASTNode) expr).getLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String polishNotation(IASTExpression expr) {
|
private String polishNotation(IASTInitializerClause expr) {
|
||||||
StringBuilder buf= new StringBuilder();
|
StringBuilder buf= new StringBuilder();
|
||||||
polishNotation(expr, buf);
|
polishNotation(expr, buf);
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void polishNotation(IASTExpression expr, StringBuilder buf) {
|
private void polishNotation(IASTInitializerClause expr, StringBuilder buf) {
|
||||||
if (expr instanceof IASTConditionalExpression) {
|
if (expr instanceof IASTConditionalExpression) {
|
||||||
IASTConditionalExpression bexpr= (IASTConditionalExpression) expr;
|
IASTConditionalExpression bexpr= (IASTConditionalExpression) expr;
|
||||||
polishNotation(bexpr.getLogicalConditionExpression(), buf);
|
polishNotation(bexpr.getLogicalConditionExpression(), buf);
|
||||||
|
@ -5398,7 +5398,7 @@ public class AST2Tests extends AST2TestBase {
|
||||||
polishNotation(f.getFunctionNameExpression(), buf);
|
polishNotation(f.getFunctionNameExpression(), buf);
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
for (IASTInitializerClause arg : f.getArguments()) {
|
for (IASTInitializerClause arg : f.getArguments()) {
|
||||||
polishNotation((IASTExpression) arg, buf);
|
polishNotation(arg, buf);
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
}
|
}
|
||||||
buf.append("()");
|
buf.append("()");
|
||||||
|
@ -5406,7 +5406,7 @@ public class AST2Tests extends AST2TestBase {
|
||||||
IASTArraySubscriptExpression f= (IASTArraySubscriptExpression) expr;
|
IASTArraySubscriptExpression f= (IASTArraySubscriptExpression) expr;
|
||||||
polishNotation(f.getArrayExpression(), buf);
|
polishNotation(f.getArrayExpression(), buf);
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
polishNotation(f.getSubscriptExpression(), buf);
|
polishNotation(f.getArgument(), buf);
|
||||||
buf.append(",[]");
|
buf.append(",[]");
|
||||||
} else if (expr instanceof IASTFieldReference) {
|
} else if (expr instanceof IASTFieldReference) {
|
||||||
IASTFieldReference f= (IASTFieldReference) expr;
|
IASTFieldReference f= (IASTFieldReference) expr;
|
||||||
|
@ -5433,6 +5433,12 @@ public class AST2Tests extends AST2TestBase {
|
||||||
buf.append(ASTStringUtil.getUnaryOperatorString(unaryExpr));
|
buf.append(ASTStringUtil.getUnaryOperatorString(unaryExpr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (expr instanceof IASTInitializerList) {
|
||||||
|
buf.append('{');
|
||||||
|
for (IASTInitializerClause clause : ((IASTInitializerList) expr).getClauses()) {
|
||||||
|
polishNotation(clause, buf);
|
||||||
|
}
|
||||||
|
buf.append('}');
|
||||||
} else {
|
} else {
|
||||||
buf.append(expr.getRawSignature());
|
buf.append(expr.getRawSignature());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,10 @@ import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array subscript expression for c
|
* Array subscript expression for C.
|
||||||
*/
|
*/
|
||||||
public class CASTArraySubscriptExpression extends ASTNode implements
|
public class CASTArraySubscriptExpression extends ASTNode implements
|
||||||
IASTArraySubscriptExpression, IASTAmbiguityParent {
|
IASTArraySubscriptExpression, IASTAmbiguityParent {
|
||||||
|
|
||||||
private IASTExpression array;
|
private IASTExpression array;
|
||||||
private IASTExpression subscript;
|
private IASTExpression subscript;
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ public class CASTArraySubscriptExpression extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTInitializerClause getArgument() {
|
public IASTInitializerClause getArgument() {
|
||||||
return getSubscriptExpression();
|
return subscript;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,23 +97,23 @@ public class CASTArraySubscriptExpression extends ASTNode implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept( ASTVisitor action ){
|
public boolean accept(ASTVisitor action) {
|
||||||
if( action.shouldVisitExpressions ){
|
if (action.shouldVisitExpressions) {
|
||||||
switch( action.visit( this ) ){
|
switch (action.visit(this)) {
|
||||||
case ASTVisitor.PROCESS_ABORT : return false;
|
case ASTVisitor.PROCESS_ABORT: return false;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( array != null ) if( !array.accept( action ) ) return false;
|
if (array != null && !array.accept(action)) return false;
|
||||||
if( subscript != null ) if( !subscript.accept( action ) ) return false;
|
if (subscript != null && !subscript.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;
|
||||||
case ASTVisitor.PROCESS_SKIP : return true;
|
case ASTVisitor.PROCESS_SKIP: return true;
|
||||||
default : break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -122,16 +121,14 @@ public class CASTArraySubscriptExpression extends ASTNode implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void replace(IASTNode child, IASTNode other) {
|
public void replace(IASTNode child, IASTNode other) {
|
||||||
if( child == array )
|
if (child == array) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
array = (IASTExpression) other;
|
array = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
if( child == subscript)
|
if (child == subscript) {
|
||||||
{
|
other.setPropertyInParent(child.getPropertyInParent());
|
||||||
other.setPropertyInParent( child.getPropertyInParent() );
|
other.setParent(child.getParent());
|
||||||
other.setParent( child.getParent() );
|
|
||||||
subscript = (IASTExpression) other;
|
subscript = (IASTExpression) other;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue