fn replace_self_with()

in src/bindgen/ir/constant.rs [113:160]


    fn replace_self_with(&mut self, self_ty: &Path) {
        match *self {
            Literal::PostfixUnaryOp { ref mut value, .. } => {
                value.replace_self_with(self_ty);
            }
            Literal::BinOp {
                ref mut left,
                ref mut right,
                ..
            } => {
                left.replace_self_with(self_ty);
                right.replace_self_with(self_ty);
            }
            Literal::FieldAccess { ref mut base, .. } => {
                base.replace_self_with(self_ty);
            }
            Literal::Struct {
                ref mut path,
                ref mut export_name,
                ref mut fields,
            } => {
                if path.replace_self_with(self_ty) {
                    self_ty.name().clone_into(export_name);
                }
                for ref mut expr in fields.values_mut() {
                    expr.replace_self_with(self_ty);
                }
            }
            Literal::Cast {
                ref mut ty,
                ref mut value,
            } => {
                ty.replace_self_with(self_ty);
                value.replace_self_with(self_ty);
            }
            Literal::Path {
                ref mut associated_to,
                ..
            } => {
                if let Some((ref mut path, ref mut export_name)) = *associated_to {
                    if path.replace_self_with(self_ty) {
                        self_ty.name().clone_into(export_name);
                    }
                }
            }
            Literal::Expr(..) => {}
        }
    }