public void test_cascade_withAssignment() throws Exception {
   CascadeExpression cascade = parseExpression("new Map()..[3] = 4 ..[0] = 11;");
   Expression target = cascade.getTarget();
   for (Expression section : cascade.getCascadeSections()) {
     assertInstanceOf(AssignmentExpression.class, section);
     Expression lhs = ((AssignmentExpression) section).getLeftHandSide();
     assertInstanceOf(IndexExpression.class, lhs);
     IndexExpression index = (IndexExpression) lhs;
     assertTrue(index.isCascaded());
     assertSame(target, index.getRealTarget());
   }
 }
Esempio n. 2
0
 @Override
 public Void visitCascadeExpression(CascadeExpression node) {
   visit(node.getTarget());
   visitList(node.getCascadeSections());
   return null;
 }