TypeBoundPredicate::TypeBoundPredicate (
const Resolver::TraitReference &trait_reference, Location locus)
- : SubstitutionRef ({}, SubstitutionArgumentMappings::error ()),
+ : SubstitutionRef ({}, SubstitutionArgumentMappings::empty ()),
reference (trait_reference.get_mappings ().get_defid ()), locus (locus),
error_flag (false)
{
TypeBoundPredicate::TypeBoundPredicate (
DefId reference, std::vector<SubstitutionParamMapping> subst, Location locus)
- : SubstitutionRef ({}, SubstitutionArgumentMappings::error ()),
+ : SubstitutionRef ({}, SubstitutionArgumentMappings::empty ()),
reference (reference), locus (locus), error_flag (false)
{
substitutions.clear ();
}
TypeBoundPredicate::TypeBoundPredicate (const TypeBoundPredicate &other)
- : SubstitutionRef ({}, SubstitutionArgumentMappings::error ()),
+ : SubstitutionRef ({}, SubstitutionArgumentMappings::empty ()),
reference (other.reference), locus (other.locus),
error_flag (other.error_flag)
{
reference = other.reference;
locus = other.locus;
error_flag = other.error_flag;
- used_arguments = SubstitutionArgumentMappings::error ();
+ used_arguments = SubstitutionArgumentMappings::empty ();
substitutions.clear ();
for (const auto &p : other.get_substs ())
SubstitutionArgumentMappings::SubstitutionArgumentMappings (
std::vector<SubstitutionArg> mappings,
std::map<std::string, BaseType *> binding_args, Location locus,
- ParamSubstCb param_subst_cb, bool trait_item_flag)
+ ParamSubstCb param_subst_cb, bool trait_item_flag, bool error_flag)
: mappings (mappings), binding_args (binding_args), locus (locus),
- param_subst_cb (param_subst_cb), trait_item_flag (trait_item_flag)
+ param_subst_cb (param_subst_cb), trait_item_flag (trait_item_flag),
+ error_flag (error_flag)
{}
SubstitutionArgumentMappings::SubstitutionArgumentMappings (
const SubstitutionArgumentMappings &other)
: mappings (other.mappings), binding_args (other.binding_args),
locus (other.locus), param_subst_cb (nullptr),
- trait_item_flag (other.trait_item_flag)
+ trait_item_flag (other.trait_item_flag), error_flag (other.error_flag)
{}
SubstitutionArgumentMappings &
locus = other.locus;
param_subst_cb = nullptr;
trait_item_flag = other.trait_item_flag;
+ error_flag = other.error_flag;
return *this;
}
SubstitutionArgumentMappings
SubstitutionArgumentMappings::error ()
{
- return SubstitutionArgumentMappings ({}, {}, Location (), nullptr, false);
+ return SubstitutionArgumentMappings ({}, {}, Location (), nullptr, false,
+ true);
+}
+
+SubstitutionArgumentMappings
+SubstitutionArgumentMappings::empty ()
+{
+ return SubstitutionArgumentMappings ({}, {}, Location (), nullptr, false,
+ false);
}
bool
SubstitutionArgumentMappings::is_error () const
{
- return mappings.size () == 0;
+ return error_flag;
}
bool
std::map<std::string, BaseType *> binding_args,
Location locus,
ParamSubstCb param_subst_cb = nullptr,
- bool trait_item_flag = false);
+ bool trait_item_flag = false,
+ bool error_flag = false);
SubstitutionArgumentMappings (const SubstitutionArgumentMappings &other);
SubstitutionArgumentMappings &
= default;
static SubstitutionArgumentMappings error ();
+ static SubstitutionArgumentMappings empty ();
bool is_error () const;
Location locus;
ParamSubstCb param_subst_cb;
bool trait_item_flag;
+ bool error_flag;
};
class SubstitutionRef