use of com.strobel.decompiler.languages.java.ast.VariableInitializer in project j2objc by google.
the class MethodTranslator method visitVariableDeclaration.
@Override
public TreeNode visitVariableDeclaration(com.strobel.decompiler.languages.java.ast.VariableDeclarationStatement node, Void data) {
VariableDeclarationStatement varDecl = new VariableDeclarationStatement().setModifiers(ElementUtil.fromModifierSet(new HashSet<>(node.getModifiers())));
AstType astType = node.getType();
Type type = (Type) astType.acceptVisitor(this, null);
for (VariableInitializer init : node.getVariables()) {
Expression expr = (Expression) init.acceptVisitor(this, null);
String varName = init.getName();
GeneratedVariableElement elem = GeneratedVariableElement.newLocalVar(varName, type.getTypeMirror(), executableElement);
elem.addModifiers(node.getModifiers());
localVariableTable.put(varName, elem);
varDecl.addFragment(new VariableDeclarationFragment(elem, expr));
}
return varDecl;
}
Aggregations