public void testPostfixExpression3() throws ANTLRException { setupParser("arr[3]++"); PostfixExpression result = (PostfixExpression) _parser.expression(); assertNotNull(result); assertTrue(result.isIncrement()); ArrayAccess arrayAccess = (ArrayAccess) result.getInnerExpression(); assertNotNull(arrayAccess); assertEquals(result, arrayAccess.getContainer()); FieldAccess fieldAccess = (FieldAccess) arrayAccess.getBaseExpression(); assertNotNull(fieldAccess); assertEquals("arr", fieldAccess.getFieldName()); assertEquals(arrayAccess, fieldAccess.getContainer()); }
public void visitArrayAccess(ArrayAccess node) { // visit expression visit(node.getBaseExpression()); visit(node.getIndexExpression()); }