use of com.google.devtools.j2objc.ast.FieldAccess in project j2objc by google.
the class ArrayRewriter method maybeRewriteArrayLength.
private void maybeRewriteArrayLength(Expression node, SimpleName name, Expression expr) {
TypeMirror exprType = expr.getTypeMirror();
if (name.getIdentifier().equals("length") && TypeUtil.isArray(exprType)) {
VariableElement sizeField = GeneratedVariableElement.newField("size", typeUtil.getInt(), typeUtil.getIosArray(((ArrayType) exprType).getComponentType()));
node.replaceWith(new FieldAccess(sizeField, TreeUtil.remove(expr)));
}
}
Aggregations