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