public void test_assignableExpression_arguments_normal_chain() throws Exception { PropertyAccess propertyAccess1 = parseExpression("a(b)(c).d(e).f"); assertEquals("f", propertyAccess1.getPropertyName().getName()); // // a(b)(c).d(e) // MethodInvocation invocation2 = assertInstanceOf(MethodInvocation.class, propertyAccess1.getTarget()); assertEquals("d", invocation2.getMethodName().getName()); ArgumentList argumentList2 = invocation2.getArgumentList(); assertNotNull(argumentList2); assertSize(1, argumentList2.getArguments()); // // a(b)(c) // FunctionExpressionInvocation invocation3 = assertInstanceOf(FunctionExpressionInvocation.class, invocation2.getTarget()); ArgumentList argumentList3 = invocation3.getArgumentList(); assertNotNull(argumentList3); assertSize(1, argumentList3.getArguments()); // // a(b) // MethodInvocation invocation4 = assertInstanceOf(MethodInvocation.class, invocation3.getFunction()); assertEquals("a", invocation4.getMethodName().getName()); ArgumentList argumentList4 = invocation4.getArgumentList(); assertNotNull(argumentList4); assertSize(1, argumentList4.getArguments()); }
@Override public Void visitPropertyAccess(PropertyAccess node) { if (node.isCascaded()) { writer.print(".."); } else { visit(node.getTarget()); writer.print('.'); } visit(node.getPropertyName()); return null; }
@Override public R visitPropertyAccess(PropertyAccess node) { node.visitChildren(this); return null; }