@@ -2562,6 +2562,7 @@ class ImplBlock : public VisItem
2562
2562
std::unique_ptr<Type> impl_type;
2563
2563
std::unique_ptr<TypePath> trait_ref;
2564
2564
WhereClause where_clause;
2565
+ Polarity polarity;
2565
2566
AST::AttrVec inner_attrs;
2566
2567
Location locus;
2567
2568
std::vector<std::unique_ptr<ImplItem>> impl_items;
@@ -2572,20 +2573,20 @@ class ImplBlock : public VisItem
2572
2573
std::vector<std::unique_ptr<GenericParam>> generic_params,
2573
2574
std::unique_ptr<Type> impl_type,
2574
2575
std::unique_ptr<TypePath> trait_ref, WhereClause where_clause,
2575
- Visibility vis, AST::AttrVec inner_attrs , AST::AttrVec outer_attrs ,
2576
- Location locus)
2576
+ Polarity polarity, Visibility vis , AST::AttrVec inner_attrs ,
2577
+ AST::AttrVec outer_attrs, Location locus)
2577
2578
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
2578
2579
generic_params (std::move (generic_params)),
2579
2580
impl_type (std::move (impl_type)), trait_ref (std::move (trait_ref)),
2580
- where_clause (std::move (where_clause)),
2581
+ where_clause (std::move (where_clause)), polarity (polarity),
2581
2582
inner_attrs (std::move (inner_attrs)), locus (locus),
2582
2583
impl_items (std::move (impl_items))
2583
2584
{}
2584
2585
2585
2586
ImplBlock (ImplBlock const &other)
2586
2587
: VisItem (other), impl_type (other.impl_type->clone_type ()),
2587
- where_clause (other.where_clause), inner_attrs (other.inner_attrs ),
2588
- locus (other.locus)
2588
+ where_clause (other.where_clause), polarity (other.polarity ),
2589
+ inner_attrs (other.inner_attrs), locus (other.locus)
2589
2590
{
2590
2591
generic_params.reserve (other.generic_params .size ());
2591
2592
for (const auto &e : other.generic_params )
@@ -2601,6 +2602,7 @@ class ImplBlock : public VisItem
2601
2602
VisItem::operator = (other);
2602
2603
impl_type = other.impl_type ->clone_type ();
2603
2604
where_clause = other.where_clause ;
2605
+ polarity = other.polarity ;
2604
2606
inner_attrs = other.inner_attrs ;
2605
2607
locus = other.locus ;
2606
2608
@@ -2641,6 +2643,9 @@ class ImplBlock : public VisItem
2641
2643
// Returns whether impl has where clause.
2642
2644
bool has_where_clause () const { return !where_clause.is_empty (); }
2643
2645
2646
+ // Returns the polarity of the impl.
2647
+ Polarity get_polarity () const { return polarity; }
2648
+
2644
2649
// Returns whether impl has inner attributes.
2645
2650
bool has_inner_attrs () const { return !inner_attrs.empty (); }
2646
2651
0 commit comments