public boolean replaceByAndVisit(Element element, Visitor visitor) { if (!replaceBy(element)) return false; element.accept(visitor); return true; }
void replaceMalloc(TypeRef pointedType, Element toReplace, Expression sizeExpression) { // TODO handle casts and sizeof expressions ! Pair<TypeRef, Expression> typeAndSize = recognizeSizeOfMult(sizeExpression); if (typeAndSize != null && (pointedType == null || pointedType.equals(typeAndSize.getFirst()))) { String tStr = String.valueOf(typeAndSize.getFirst()); try { JavaPrim prim = JavaPrim.getJavaPrim(tStr); if (prim != null && prim.isPrimitive) { String cap = StringUtils.capitalize(tStr); toReplace.replaceBy(staticPtrMethod("allocate" + cap + "s", typeAndSize.getValue())); return; } } catch (Throwable th) { // Do nothing } } toReplace.replaceBy(staticPtrMethod("allocateBytes", sizeExpression)); }
void replaceMalloc(TypeRef pointedType, Element toReplace, Expression sizeExpression) { // TODO handle casts and sizeof expressions ! Pair<TypeRef, Expression> typeAndSize = recognizeSizeOfMult(sizeExpression); if (typeAndSize != null && (pointedType == null || pointedType.equals(typeAndSize.getFirst()))) { String tStr = String.valueOf(typeAndSize.getFirst()); try { JavaPrim prim = JavaPrim.getJavaPrim(tStr); if (prim != null && prim.isPrimitive) { String cap = StringUtils.capitalize(tStr); toReplace.replaceBy(staticPtrMethod("allocate" + cap + "s", typeAndSize.getValue())); return; } } catch (Throwable th) { // Do nothing } } toReplace.replaceBy(staticPtrMethod("allocateBytes", sizeExpression)); }
arg.replaceBy(replace); Object got2 = getter.invoke(element); Element elementGot2 = container == null ? (Element)got2 : ((Collection<Element>)got2).iterator().next();
ep.addToCommentBefore(typeDef.getCommentAfter()); typeDef.importDetails(ep, true); ep.replaceBy(null); typeDef.setValueType(e);
ep.addToCommentBefore(typeDef.getCommentAfter()); typeDef.importDetails(ep, true); ep.replaceBy(null); typeDef.setValueType(e);
if (parent instanceof VariablesDeclaration && ((VariablesDeclaration) parent).getDeclarators().isEmpty()) { taggedTypeRef.importDetails(parent, false); parent.replaceBy(null); } else { TypeRef tr = new TypeRef.SimpleTypeRef(taggedTypeRef.getTag().clone());
if (parent instanceof VariablesDeclaration && ((VariablesDeclaration) parent).getDeclarators().isEmpty()) { taggedTypeRef.importDetails(parent, false); parent.replaceBy(null); } else { TypeRef tr = new TypeRef.SimpleTypeRef(taggedTypeRef.getTag().clone());