public void testPostfixExpression2() throws ANTLRException { setupParser("this.var--"); PostfixExpression result = (PostfixExpression) _parser.expression(); assertNotNull(result); assertTrue(!result.isIncrement()); FieldAccess fieldAccess = (FieldAccess) result.getInnerExpression(); assertNotNull(fieldAccess); assertEquals("var", fieldAccess.getFieldName()); assertEquals(result, fieldAccess.getContainer()); }
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()); }