use of com.google.devtools.j2objc.ast.Assignment in project j2objc by google.
the class TranslationUtil method isAssigned.
public static boolean isAssigned(Expression node) {
TreeNode parent = node.getParent();
while (parent instanceof ParenthesizedExpression) {
node = (Expression) parent;
parent = node.getParent();
}
if (parent instanceof PostfixExpression) {
PostfixExpression.Operator op = ((PostfixExpression) parent).getOperator();
if (op == PostfixExpression.Operator.INCREMENT || op == PostfixExpression.Operator.DECREMENT) {
return true;
}
} else if (parent instanceof PrefixExpression) {
PrefixExpression.Operator op = ((PrefixExpression) parent).getOperator();
if (op == PrefixExpression.Operator.INCREMENT || op == PrefixExpression.Operator.DECREMENT || op == PrefixExpression.Operator.ADDRESS_OF) {
return true;
}
} else if (parent instanceof Assignment) {
return node == ((Assignment) parent).getLeftHandSide();
}
return false;
}
Aggregations