}
BaseType *
-InferType::clone ()
+InferType::clone () const
{
return new InferType (get_ref (), get_ty_ref (), get_infer_kind (),
get_combined_refs ());
}
BaseType *
-ErrorType::clone ()
+ErrorType::clone () const
{
return new ErrorType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-ADTType::clone ()
+ADTType::clone () const
{
std::vector<StructFieldType *> cloned_fields;
for (auto &f : fields)
}
BaseType *
-TupleType::clone ()
+TupleType::clone () const
{
return new TupleType (get_ref (), get_ty_ref (), fields,
get_combined_refs ());
}
BaseType *
-FnType::clone ()
+FnType::clone () const
{
std::vector<std::pair<HIR::Pattern *, BaseType *> > cloned_params;
for (auto &p : params)
}
BaseType *
-FnPtr::clone ()
+FnPtr::clone () const
{
std::vector<TyVar> cloned_params;
for (auto &p : params)
}
BaseType *
-ArrayType::clone ()
+ArrayType::clone () const
{
return new ArrayType (get_ref (), get_ty_ref (), get_capacity (),
element_type, get_combined_refs ());
}
BaseType *
-BoolType::clone ()
+BoolType::clone () const
{
return new BoolType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-IntType::clone ()
+IntType::clone () const
{
return new IntType (get_ref (), get_ty_ref (), get_int_kind (),
get_combined_refs ());
}
BaseType *
-UintType::clone ()
+UintType::clone () const
{
return new UintType (get_ref (), get_ty_ref (), get_uint_kind (),
get_combined_refs ());
}
BaseType *
-FloatType::clone ()
+FloatType::clone () const
{
return new FloatType (get_ref (), get_ty_ref (), get_float_kind (),
get_combined_refs ());
}
BaseType *
-USizeType::clone ()
+USizeType::clone () const
{
return new USizeType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-ISizeType::clone ()
+ISizeType::clone () const
{
return new ISizeType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-CharType::clone ()
+CharType::clone () const
{
return new CharType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-ReferenceType::clone ()
+ReferenceType::clone () const
{
return new ReferenceType (get_ref (), get_ty_ref (), base, is_mutable (),
get_combined_refs ());
}
BaseType *
-PointerType::clone ()
+PointerType::clone () const
{
return new PointerType (get_ref (), get_ty_ref (), base, is_mutable (),
get_combined_refs ());
}
BaseType *
-ParamType::clone ()
+ParamType::clone () const
{
- return new ParamType (get_symbol (), get_ref (), get_ty_ref (),
- get_generic_param (), get_combined_refs ());
+ return new ParamType (get_symbol (), get_ref (), get_ty_ref (), param,
+ get_combined_refs ());
}
std::string
}
BaseType *
-StrType::clone ()
+StrType::clone () const
{
return new StrType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-NeverType::clone ()
+NeverType::clone () const
{
return new NeverType (get_ref (), get_ty_ref (), get_combined_refs ());
}
}
BaseType *
-PlaceholderType::clone ()
+PlaceholderType::clone () const
{
return new PlaceholderType (get_ref (), get_ty_ref (), get_combined_refs ());
}
/* Returns a pointer to a clone of this. The caller is responsible for
* releasing the memory of the returned ty. */
- virtual BaseType *clone () = 0;
+ virtual BaseType *clone () const = 0;
// get_combined_refs returns the chain of node refs involved in unification
- std::set<HirId> get_combined_refs () { return combined; }
+ std::set<HirId> get_combined_refs () const { return combined; }
void append_reference (HirId id) { combined.insert (id); }
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
InferTypeKind get_infer_kind () const { return infer_kind; }
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
std::string get_name () const override final { return as_string (); }
};
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
std::string get_symbol () const;
BaseType *get_field (size_t index) const;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool is_concrete () const override final
{
}
}
- SubstitutionParamMapping clone ()
+ SubstitutionParamMapping clone () const
{
return SubstitutionParamMapping (generic, static_cast<ParamType *> (
param->clone ()));
return substitutions;
}
- std::vector<SubstitutionParamMapping> clone_substs ()
+ std::vector<SubstitutionParamMapping> clone_substs () const
{
std::vector<SubstitutionParamMapping> clone;
identifier (identifier), fields (fields), adt_kind (adt_kind)
{}
- ADTKind get_adt_kind () { return adt_kind; }
- bool is_tuple_struct () { return adt_kind == TUPLE_STRUCT; }
- bool is_union () { return adt_kind == UNION; }
+ ADTKind get_adt_kind () const { return adt_kind; }
+ bool is_tuple_struct () const { return adt_kind == TUPLE_STRUCT; }
+ bool is_union () const { return adt_kind == UNION; }
bool is_unit () const override { return this->fields.empty (); }
return nullptr;
}
- BaseType *clone () final override;
+ BaseType *clone () const final override;
std::vector<StructFieldType *> &get_fields () { return fields; }
const std::vector<StructFieldType *> &get_fields () const { return fields; }
BaseType *get_return_type () const { return type; }
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool needs_generic_substitutions () const override final
{
bool is_equal (const BaseType &other) const override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
void iterate_params (std::function<bool (BaseType *)> cb) const
{
BaseType *get_element_type () const;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool is_concrete () const final override
{
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
};
class IntType : public BaseType
IntKind get_int_kind () const { return int_kind; }
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool is_equal (const BaseType &other) const override;
UintKind get_uint_kind () const { return uint_kind; }
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool is_equal (const BaseType &other) const override;
FloatKind get_float_kind () const { return float_kind; }
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool is_equal (const BaseType &other) const override;
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
};
class ISizeType : public BaseType
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
};
class CharType : public BaseType
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
};
class ReferenceType : public BaseType
bool is_equal (const BaseType &other) const override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool contains_type_parameters () const override final
{
bool is_equal (const BaseType &other) const override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
bool contains_type_parameters () const override final
{
bool is_equal (const BaseType &other) const override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
};
// https://doc.rust-lang.org/std/primitive.never.html
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
std::string get_name () const override final { return as_string (); }
BaseType *coerce (BaseType *other) override;
BaseType *cast (BaseType *other) override;
- BaseType *clone () final override;
+ BaseType *clone () const final override;
std::string get_name () const override final { return as_string (); }