@@ -1515,6 +1515,7 @@ class SingleASTNode
1515
1515
TRAIT,
1516
1516
IMPL,
1517
1517
TRAIT_IMPL,
1518
+ TYPE,
1518
1519
};
1519
1520
1520
1521
private:
@@ -1528,6 +1529,7 @@ class SingleASTNode
1528
1529
std::unique_ptr<TraitItem> trait_item;
1529
1530
std::unique_ptr<InherentImplItem> impl_item;
1530
1531
std::unique_ptr<TraitImplItem> trait_impl_item;
1532
+ std::unique_ptr<Type> type;
1531
1533
1532
1534
public:
1533
1535
SingleASTNode (std::unique_ptr<Expr> expr)
@@ -1558,6 +1560,10 @@ class SingleASTNode
1558
1560
: kind (TRAIT_IMPL), trait_impl_item (std::move (trait_impl_item))
1559
1561
{}
1560
1562
1563
+ SingleASTNode (std::unique_ptr<Type> type)
1564
+ : kind (TYPE), type (std::move (type))
1565
+ {}
1566
+
1561
1567
SingleASTNode (SingleASTNode const &other)
1562
1568
{
1563
1569
kind = other.kind ;
@@ -1590,6 +1596,10 @@ class SingleASTNode
1590
1596
case TRAIT_IMPL:
1591
1597
trait_impl_item = other.trait_impl_item ->clone_trait_impl_item ();
1592
1598
break ;
1599
+
1600
+ case TYPE:
1601
+ type = other.type ->clone_type ();
1602
+ break ;
1593
1603
}
1594
1604
}
1595
1605
@@ -1625,6 +1635,10 @@ class SingleASTNode
1625
1635
case TRAIT_IMPL:
1626
1636
trait_impl_item = other.trait_impl_item ->clone_trait_impl_item ();
1627
1637
break ;
1638
+
1639
+ case TYPE:
1640
+ type = other.type ->clone_type ();
1641
+ break ;
1628
1642
}
1629
1643
return *this ;
1630
1644
}
@@ -1699,6 +1713,12 @@ class SingleASTNode
1699
1713
return std::move (trait_impl_item);
1700
1714
}
1701
1715
1716
+ std::unique_ptr<Type> take_type ()
1717
+ {
1718
+ rust_assert (!is_error ());
1719
+ return std::move (type);
1720
+ }
1721
+
1702
1722
void accept_vis (ASTVisitor &vis)
1703
1723
{
1704
1724
switch (kind)
@@ -1730,6 +1750,10 @@ class SingleASTNode
1730
1750
case TRAIT_IMPL:
1731
1751
trait_impl_item->accept_vis (vis);
1732
1752
break ;
1753
+
1754
+ case TYPE:
1755
+ type->accept_vis (vis);
1756
+ break ;
1733
1757
}
1734
1758
}
1735
1759
@@ -1751,6 +1775,8 @@ class SingleASTNode
1751
1775
return impl_item == nullptr ;
1752
1776
case TRAIT_IMPL:
1753
1777
return trait_impl_item == nullptr ;
1778
+ case TYPE:
1779
+ return type == nullptr ;
1754
1780
}
1755
1781
1756
1782
gcc_unreachable ();
@@ -1775,6 +1801,8 @@ class SingleASTNode
1775
1801
return " Impl Item: " + impl_item->as_string ();
1776
1802
case TRAIT_IMPL:
1777
1803
return " Trait Impl Item: " + impl_item->as_string ();
1804
+ case TYPE:
1805
+ return " Type: " + type->as_string ();
1778
1806
}
1779
1807
1780
1808
gcc_unreachable ();
0 commit comments