@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if (binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if (!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if (lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode) lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment // expressions if (symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if (binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if (binaryNode.isAssignment()) { final ExpressionTree srcTree = translateExpr(binaryNode.getAssignmentSource()); final ExpressionTree destTree = translateExpr(binaryNode.getAssignmentDest()); if (binaryNode.isTokenType(TokenType.ASSIGN)) { curExpr = new AssignmentTreeImpl(binaryNode, destTree, srcTree); } else { curExpr = new CompoundAssignmentTreeImpl(binaryNode, destTree, srcTree); } } else { final ExpressionTree leftTree = translateExpr(binaryNode.lhs()); final ExpressionTree rightTree = translateExpr(binaryNode.rhs()); if (binaryNode.isTokenType(TokenType.INSTANCEOF)) { curExpr = new InstanceOfTreeImpl(binaryNode, leftTree, rightTree); } else { curExpr = new BinaryTreeImpl(binaryNode, leftTree, rightTree); } } return false; }