use of com.google.devtools.j2objc.ast.PostfixExpression in project j2objc by google.
the class OuterReferenceResolverTest method testOuterVarAccess.
public void testOuterVarAccess() {
resolveSource("Test", "class Test { int i; class Inner { void test() { i++; } } }");
TypeDeclaration innerNode = (TypeDeclaration) nodesByType.get(Kind.TYPE_DECLARATION).get(1);
assertTrue(captureInfo.needsOuterReference(innerNode.getTypeElement()));
PostfixExpression increment = (PostfixExpression) nodesByType.get(Kind.POSTFIX_EXPRESSION).get(0);
Expression iNode = increment.getOperand();
assertTrue(iNode instanceof QualifiedName);
VariableElement outerVar = TreeUtil.getVariableElement(((QualifiedName) iNode).getQualifier());
assertNotNull(outerVar);
assertEquals("Test", outerVar.asType().toString());
}
Aggregations