diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 184 |
1 files changed, 93 insertions, 91 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 3fd761367..be657699f 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -213,12 +213,12 @@ impl UnionDef { | |||
213 | } | 213 | } |
214 | } | 214 | } |
215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
216 | pub struct UseItem { | 216 | pub struct Use { |
217 | pub(crate) syntax: SyntaxNode, | 217 | pub(crate) syntax: SyntaxNode, |
218 | } | 218 | } |
219 | impl ast::AttrsOwner for UseItem {} | 219 | impl ast::AttrsOwner for Use {} |
220 | impl ast::VisibilityOwner for UseItem {} | 220 | impl ast::VisibilityOwner for Use {} |
221 | impl UseItem { | 221 | impl Use { |
222 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } | 222 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } |
223 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | 223 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } |
224 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 224 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
@@ -268,6 +268,36 @@ pub struct Rename { | |||
268 | impl ast::NameOwner for Rename {} | 268 | impl ast::NameOwner for Rename {} |
269 | impl Rename { | 269 | impl Rename { |
270 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | 270 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
271 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
272 | } | ||
273 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
274 | pub struct UseTree { | ||
275 | pub(crate) syntax: SyntaxNode, | ||
276 | } | ||
277 | impl UseTree { | ||
278 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
279 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
280 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | ||
281 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | ||
282 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } | ||
283 | } | ||
284 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
285 | pub struct Path { | ||
286 | pub(crate) syntax: SyntaxNode, | ||
287 | } | ||
288 | impl Path { | ||
289 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
290 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
291 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
292 | } | ||
293 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
294 | pub struct UseTreeList { | ||
295 | pub(crate) syntax: SyntaxNode, | ||
296 | } | ||
297 | impl UseTreeList { | ||
298 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
299 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | ||
300 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
271 | } | 301 | } |
272 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 302 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
273 | pub struct Abi { | 303 | pub struct Abi { |
@@ -433,15 +463,6 @@ impl PathType { | |||
433 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 463 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
434 | } | 464 | } |
435 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 465 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
436 | pub struct Path { | ||
437 | pub(crate) syntax: SyntaxNode, | ||
438 | } | ||
439 | impl Path { | ||
440 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
441 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
442 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
443 | } | ||
444 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
445 | pub struct PointerType { | 466 | pub struct PointerType { |
446 | pub(crate) syntax: SyntaxNode, | 467 | pub(crate) syntax: SyntaxNode, |
447 | } | 468 | } |
@@ -1178,26 +1199,6 @@ impl Param { | |||
1178 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | 1199 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } |
1179 | } | 1200 | } |
1180 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1181 | pub struct UseTree { | ||
1182 | pub(crate) syntax: SyntaxNode, | ||
1183 | } | ||
1184 | impl UseTree { | ||
1185 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1186 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
1187 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | ||
1188 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | ||
1189 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } | ||
1190 | } | ||
1191 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1192 | pub struct UseTreeList { | ||
1193 | pub(crate) syntax: SyntaxNode, | ||
1194 | } | ||
1195 | impl UseTreeList { | ||
1196 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1197 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | ||
1198 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1199 | } | ||
1200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1201 | pub struct PathSegment { | 1202 | pub struct PathSegment { |
1202 | pub(crate) syntax: SyntaxNode, | 1203 | pub(crate) syntax: SyntaxNode, |
1203 | } | 1204 | } |
@@ -1282,7 +1283,7 @@ pub enum Item { | |||
1282 | TraitDef(TraitDef), | 1283 | TraitDef(TraitDef), |
1283 | TypeAliasDef(TypeAliasDef), | 1284 | TypeAliasDef(TypeAliasDef), |
1284 | UnionDef(UnionDef), | 1285 | UnionDef(UnionDef), |
1285 | UseItem(UseItem), | 1286 | Use(Use), |
1286 | } | 1287 | } |
1287 | impl ast::AttrsOwner for Item {} | 1288 | impl ast::AttrsOwner for Item {} |
1288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1289 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1561,8 +1562,8 @@ impl AstNode for UnionDef { | |||
1561 | } | 1562 | } |
1562 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1563 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1563 | } | 1564 | } |
1564 | impl AstNode for UseItem { | 1565 | impl AstNode for Use { |
1565 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } | 1566 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE } |
1566 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1567 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1567 | if Self::can_cast(syntax.kind()) { | 1568 | if Self::can_cast(syntax.kind()) { |
1568 | Some(Self { syntax }) | 1569 | Some(Self { syntax }) |
@@ -1627,6 +1628,39 @@ impl AstNode for Rename { | |||
1627 | } | 1628 | } |
1628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1629 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1629 | } | 1630 | } |
1631 | impl AstNode for UseTree { | ||
1632 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } | ||
1633 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1634 | if Self::can_cast(syntax.kind()) { | ||
1635 | Some(Self { syntax }) | ||
1636 | } else { | ||
1637 | None | ||
1638 | } | ||
1639 | } | ||
1640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1641 | } | ||
1642 | impl AstNode for Path { | ||
1643 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } | ||
1644 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1645 | if Self::can_cast(syntax.kind()) { | ||
1646 | Some(Self { syntax }) | ||
1647 | } else { | ||
1648 | None | ||
1649 | } | ||
1650 | } | ||
1651 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1652 | } | ||
1653 | impl AstNode for UseTreeList { | ||
1654 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } | ||
1655 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1656 | if Self::can_cast(syntax.kind()) { | ||
1657 | Some(Self { syntax }) | ||
1658 | } else { | ||
1659 | None | ||
1660 | } | ||
1661 | } | ||
1662 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1663 | } | ||
1630 | impl AstNode for Abi { | 1664 | impl AstNode for Abi { |
1631 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 1665 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } |
1632 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1666 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -1825,17 +1859,6 @@ impl AstNode for PathType { | |||
1825 | } | 1859 | } |
1826 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1860 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1827 | } | 1861 | } |
1828 | impl AstNode for Path { | ||
1829 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } | ||
1830 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1831 | if Self::can_cast(syntax.kind()) { | ||
1832 | Some(Self { syntax }) | ||
1833 | } else { | ||
1834 | None | ||
1835 | } | ||
1836 | } | ||
1837 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1838 | } | ||
1839 | impl AstNode for PointerType { | 1862 | impl AstNode for PointerType { |
1840 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } | 1863 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } |
1841 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1864 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2672,28 +2695,6 @@ impl AstNode for Param { | |||
2672 | } | 2695 | } |
2673 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2696 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2674 | } | 2697 | } |
2675 | impl AstNode for UseTree { | ||
2676 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } | ||
2677 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2678 | if Self::can_cast(syntax.kind()) { | ||
2679 | Some(Self { syntax }) | ||
2680 | } else { | ||
2681 | None | ||
2682 | } | ||
2683 | } | ||
2684 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2685 | } | ||
2686 | impl AstNode for UseTreeList { | ||
2687 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } | ||
2688 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2689 | if Self::can_cast(syntax.kind()) { | ||
2690 | Some(Self { syntax }) | ||
2691 | } else { | ||
2692 | None | ||
2693 | } | ||
2694 | } | ||
2695 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2696 | } | ||
2697 | impl AstNode for PathSegment { | 2698 | impl AstNode for PathSegment { |
2698 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2699 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
2699 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2700 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2810,15 +2811,16 @@ impl From<TypeAliasDef> for Item { | |||
2810 | impl From<UnionDef> for Item { | 2811 | impl From<UnionDef> for Item { |
2811 | fn from(node: UnionDef) -> Item { Item::UnionDef(node) } | 2812 | fn from(node: UnionDef) -> Item { Item::UnionDef(node) } |
2812 | } | 2813 | } |
2813 | impl From<UseItem> for Item { | 2814 | impl From<Use> for Item { |
2814 | fn from(node: UseItem) -> Item { Item::UseItem(node) } | 2815 | fn from(node: Use) -> Item { Item::Use(node) } |
2815 | } | 2816 | } |
2816 | impl AstNode for Item { | 2817 | impl AstNode for Item { |
2817 | fn can_cast(kind: SyntaxKind) -> bool { | 2818 | fn can_cast(kind: SyntaxKind) -> bool { |
2818 | match kind { | 2819 | match kind { |
2819 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL | 2820 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL |
2820 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | 2821 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | USE => { |
2821 | | USE_ITEM => true, | 2822 | true |
2823 | } | ||
2822 | _ => false, | 2824 | _ => false, |
2823 | } | 2825 | } |
2824 | } | 2826 | } |
@@ -2837,7 +2839,7 @@ impl AstNode for Item { | |||
2837 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), | 2839 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), |
2838 | TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }), | 2840 | TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }), |
2839 | UNION_DEF => Item::UnionDef(UnionDef { syntax }), | 2841 | UNION_DEF => Item::UnionDef(UnionDef { syntax }), |
2840 | USE_ITEM => Item::UseItem(UseItem { syntax }), | 2842 | USE => Item::Use(Use { syntax }), |
2841 | _ => return None, | 2843 | _ => return None, |
2842 | }; | 2844 | }; |
2843 | Some(res) | 2845 | Some(res) |
@@ -2857,7 +2859,7 @@ impl AstNode for Item { | |||
2857 | Item::TraitDef(it) => &it.syntax, | 2859 | Item::TraitDef(it) => &it.syntax, |
2858 | Item::TypeAliasDef(it) => &it.syntax, | 2860 | Item::TypeAliasDef(it) => &it.syntax, |
2859 | Item::UnionDef(it) => &it.syntax, | 2861 | Item::UnionDef(it) => &it.syntax, |
2860 | Item::UseItem(it) => &it.syntax, | 2862 | Item::Use(it) => &it.syntax, |
2861 | } | 2863 | } |
2862 | } | 2864 | } |
2863 | } | 2865 | } |
@@ -3530,7 +3532,7 @@ impl std::fmt::Display for UnionDef { | |||
3530 | std::fmt::Display::fmt(self.syntax(), f) | 3532 | std::fmt::Display::fmt(self.syntax(), f) |
3531 | } | 3533 | } |
3532 | } | 3534 | } |
3533 | impl std::fmt::Display for UseItem { | 3535 | impl std::fmt::Display for Use { |
3534 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3536 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3535 | std::fmt::Display::fmt(self.syntax(), f) | 3537 | std::fmt::Display::fmt(self.syntax(), f) |
3536 | } | 3538 | } |
@@ -3560,6 +3562,21 @@ impl std::fmt::Display for Rename { | |||
3560 | std::fmt::Display::fmt(self.syntax(), f) | 3562 | std::fmt::Display::fmt(self.syntax(), f) |
3561 | } | 3563 | } |
3562 | } | 3564 | } |
3565 | impl std::fmt::Display for UseTree { | ||
3566 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3567 | std::fmt::Display::fmt(self.syntax(), f) | ||
3568 | } | ||
3569 | } | ||
3570 | impl std::fmt::Display for Path { | ||
3571 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3572 | std::fmt::Display::fmt(self.syntax(), f) | ||
3573 | } | ||
3574 | } | ||
3575 | impl std::fmt::Display for UseTreeList { | ||
3576 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3577 | std::fmt::Display::fmt(self.syntax(), f) | ||
3578 | } | ||
3579 | } | ||
3563 | impl std::fmt::Display for Abi { | 3580 | impl std::fmt::Display for Abi { |
3564 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3581 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3565 | std::fmt::Display::fmt(self.syntax(), f) | 3582 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3650,11 +3667,6 @@ impl std::fmt::Display for PathType { | |||
3650 | std::fmt::Display::fmt(self.syntax(), f) | 3667 | std::fmt::Display::fmt(self.syntax(), f) |
3651 | } | 3668 | } |
3652 | } | 3669 | } |
3653 | impl std::fmt::Display for Path { | ||
3654 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3655 | std::fmt::Display::fmt(self.syntax(), f) | ||
3656 | } | ||
3657 | } | ||
3658 | impl std::fmt::Display for PointerType { | 3670 | impl std::fmt::Display for PointerType { |
3659 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3671 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3660 | std::fmt::Display::fmt(self.syntax(), f) | 3672 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4035,16 +4047,6 @@ impl std::fmt::Display for Param { | |||
4035 | std::fmt::Display::fmt(self.syntax(), f) | 4047 | std::fmt::Display::fmt(self.syntax(), f) |
4036 | } | 4048 | } |
4037 | } | 4049 | } |
4038 | impl std::fmt::Display for UseTree { | ||
4039 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4040 | std::fmt::Display::fmt(self.syntax(), f) | ||
4041 | } | ||
4042 | } | ||
4043 | impl std::fmt::Display for UseTreeList { | ||
4044 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4045 | std::fmt::Display::fmt(self.syntax(), f) | ||
4046 | } | ||
4047 | } | ||
4048 | impl std::fmt::Display for PathSegment { | 4050 | impl std::fmt::Display for PathSegment { |
4049 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4051 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4050 | std::fmt::Display::fmt(self.syntax(), f) | 4052 | std::fmt::Display::fmt(self.syntax(), f) |