use of com.google.devtools.j2objc.ast.TypeDeclarationStatement in project j2objc by google.
the class TreeConverter method convertBlock.
private TreeNode convertBlock(JCTree.JCBlock node) {
Block newNode = new Block();
for (StatementTree stmt : node.getStatements()) {
TreeNode tree = convert(stmt);
if (tree instanceof AbstractTypeDeclaration) {
tree = new TypeDeclarationStatement().setDeclaration((AbstractTypeDeclaration) tree);
}
newNode.addStatement((Statement) tree);
}
return newNode;
}
use of com.google.devtools.j2objc.ast.TypeDeclarationStatement in project j2objc by google.
the class TreeConverter method convertBlock.
private TreeNode convertBlock(BlockTree node, TreePath parent) {
TreePath path = getTreePath(parent, node);
Block newNode = new Block();
for (StatementTree stmt : node.getStatements()) {
TreeNode tree = convert(stmt, path);
if (tree instanceof AbstractTypeDeclaration) {
tree = new TypeDeclarationStatement().setDeclaration((AbstractTypeDeclaration) tree);
}
newNode.addStatement((Statement) tree);
}
return newNode;
}
use of com.google.devtools.j2objc.ast.TypeDeclarationStatement in project j2objc by google.
the class InnerClassExtractor method endHandleType.
private void endHandleType(AbstractTypeDeclaration node) {
int insertIdx = typeOrderStack.remove(typeOrderStack.size() - 1);
TreeNode parentNode = node.getParent();
if (!(parentNode instanceof CompilationUnit)) {
// Remove this type declaration from its current location.
node.remove();
if (parentNode instanceof TypeDeclarationStatement) {
parentNode.remove();
}
addCaptureFields(node);
// Make this node non-private, if necessary, and add it to the unit's type
// list.
node.removeModifiers(Modifier.PRIVATE);
unitTypes.add(insertIdx, node);
// Check for erroneous WeakOuter annotation on static inner class.
TypeElement type = node.getTypeElement();
if (ElementUtil.isStatic(type) && ElementUtil.hasAnnotation(type, WeakOuter.class)) {
ErrorUtil.warning("static class " + type.getQualifiedName() + " has WeakOuter annotation");
}
}
}
Aggregations