Block getInitMethodBody(DeclarationsHolder decls) { for (Declaration decl : decls.getDeclarations()) { if (decl instanceof Function) { return ((Function) decl).getBody(); } } throw new RuntimeException("Init method not found in " + decls); }
Block getInitMethodBody(DeclarationsHolder decls) { for (Declaration decl : decls.getDeclarations()) { if (decl instanceof Function) { return ((Function) decl).getBody(); } } throw new RuntimeException("Init method not found in " + decls); }
@Override public boolean replaceChild(Element child, Element by) { if (child == getBody()) { setBody((Statement.Block)by); return true; } if (child == getName()) { setName((Identifier)by); return true; } if (replaceChild(args, Arg.class, this, child, by)) return true; if (replaceChild(thrown, TypeRef.class, this, child, by)) return true; if (replaceChild(initializers, FunctionCall.class, this, child, by)) return true; return super.replaceChild(child, by); }
public void visitFunction(Function function) { visitDeclaration(function); visit(function.getArgs()); visit(function.getThrown()); visit(function.getInitializers()); visit(function.getBody()); visit(function.getName()); }
if (isConstructor) { convertedBody = block(stat(methodCall("super", superConstructorArgs.toArray(new Expression[superConstructorArgs.size()])))); } else if (result.config.convertBodies && function.getBody() != null) { try { Pair<Element, List<Declaration>> bodyAndExtraDeclarations = result.bridjer.convertToJava(function.getBody(), libraryClassName); convertedBody = (Block) bodyAndExtraDeclarations.getFirst(); for (Declaration d : bodyAndExtraDeclarations.getSecond()) {
if (isConstructor) { convertedBody = block(stat(methodCall("super", superConstructorArgs.toArray(new Expression[superConstructorArgs.size()])))); } else if (result.config.convertBodies && function.getBody() != null) { try { Pair<Element, List<Declaration>> bodyAndExtraDeclarations = result.bridjer.convertToJava(function.getBody(), libraryClassName); convertedBody = (Block) bodyAndExtraDeclarations.getFirst(); for (Declaration d : bodyAndExtraDeclarations.getSecond()) {
public void visitFunctionSignature(FunctionSignature e) { if (e.getFunction() == null) { return; } assert e.getFunction().getBody() == null; modifiersStringPrefix(e); append(e.getFunction().getValueType()).space(e.getFunction().getValueType() != null); if (e.getParentElement() instanceof TypeRef.Pointer) { append("("); modifiersStringPrefix(e.getFunction()); switch (e.getType()) { case CFunction: append("*"); break; case ObjCBlock: append("^"); break; } append(e.getFunction().getName()); append(")"); } else { append(e.getFunction().getName()); } append("("); implode(e.getFunction().getArgs(), ", "); append(")"); append(e.getModifiers().isEmpty() ? "" : " "); implode(e.getModifiers(), " "); }