@Override public MutableByDeclarator mutateType(MutableByDeclarator type) { if (type == null) return null; type = type.clone(); if (type instanceof Function) { TypeRef fs = new TypeRef.FunctionSignature((Function)type).importDetails((Element)type, true); type = (MutableByDeclarator) new TypeRef.Pointer(fs, getPointerStyle()); } else if (type instanceof TypeRef) { type = (MutableByDeclarator) new TypeRef.Pointer((TypeRef)type, getPointerStyle()).importDetails((Element)type, true); } else throw new IllegalArgumentException(type.getClass().getName() + " cannot be mutated by pointer"); ((Element)type).importDetails(this, false); return getTarget() == null ? type : getTarget().mutateType(type); } public Declarator.PointerStyle getPointerStyle() {
type = type == null ? null : type.clone();
public MutableByDeclarator mutateType(MutableByDeclarator type) { if (type == null) return null; type = type.clone(); if (type instanceof TypeRef) type = new TypeRef.ArrayRef((TypeRef)type, deepClone(getDimensions())); else if (type instanceof Function) { Function f = (Function)type; f.setValueType(new TypeRef.ArrayRef(f.getValueType(), deepClone(getDimensions()))); type = f; } ((Element)type).importDetails(this, false); return target.mutateType(type); }
public MutableByDeclarator mutateType(MutableByDeclarator type) { if (type == null) return null; type = type.clone(); if (type instanceof Function) { ((Function)type).setName(new Identifier.SimpleIdentifier(getName())); } ((Element)type).importDetails(this, false); return type; } @Override