diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 88 |
1 files changed, 59 insertions, 29 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index dfda79550..01e8111b0 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -75,7 +75,7 @@ impl ExternCrateItem { | |||
75 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 75 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
76 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 76 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
77 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | 77 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } |
78 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 78 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } |
79 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 79 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
80 | } | 80 | } |
81 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 81 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -112,7 +112,7 @@ impl ImplDef { | |||
112 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | 112 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
113 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 113 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
114 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 114 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
115 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 115 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
116 | } | 116 | } |
117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
118 | pub struct MacroCall { | 118 | pub struct MacroCall { |
@@ -180,7 +180,7 @@ impl TraitDef { | |||
180 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 180 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
181 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } | 181 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } |
182 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } | 182 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } |
183 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 183 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
184 | } | 184 | } |
185 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 185 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
186 | pub struct TypeAliasDef { | 186 | pub struct TypeAliasDef { |
@@ -238,11 +238,6 @@ impl Visibility { | |||
238 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 238 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
239 | } | 239 | } |
240 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 240 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
241 | pub struct Abi { | ||
242 | pub(crate) syntax: SyntaxNode, | ||
243 | } | ||
244 | impl Abi {} | ||
245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
246 | pub struct Name { | 241 | pub struct Name { |
247 | pub(crate) syntax: SyntaxNode, | 242 | pub(crate) syntax: SyntaxNode, |
248 | } | 243 | } |
@@ -250,6 +245,21 @@ impl Name { | |||
250 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | 245 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
251 | } | 246 | } |
252 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 247 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
248 | pub struct ItemList { | ||
249 | pub(crate) syntax: SyntaxNode, | ||
250 | } | ||
251 | impl ast::AttrsOwner for ItemList {} | ||
252 | impl ast::ModuleItemOwner for ItemList {} | ||
253 | impl ItemList { | ||
254 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
255 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
256 | } | ||
257 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
258 | pub struct Abi { | ||
259 | pub(crate) syntax: SyntaxNode, | ||
260 | } | ||
261 | impl Abi {} | ||
262 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
253 | pub struct TypeParamList { | 263 | pub struct TypeParamList { |
254 | pub(crate) syntax: SyntaxNode, | 264 | pub(crate) syntax: SyntaxNode, |
255 | } | 265 | } |
@@ -367,11 +377,10 @@ impl TypeBoundList { | |||
367 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 377 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } |
368 | } | 378 | } |
369 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 379 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
370 | pub struct ItemList { | 380 | pub struct AssocItemList { |
371 | pub(crate) syntax: SyntaxNode, | 381 | pub(crate) syntax: SyntaxNode, |
372 | } | 382 | } |
373 | impl ast::ModuleItemOwner for ItemList {} | 383 | impl AssocItemList { |
374 | impl ItemList { | ||
375 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 384 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
376 | pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } | 385 | pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } |
377 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 386 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
@@ -1169,7 +1178,7 @@ impl UseTree { | |||
1169 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | 1178 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
1170 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | 1179 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
1171 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | 1180 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } |
1172 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 1181 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } |
1173 | } | 1182 | } |
1174 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1175 | pub struct UseTreeList { | 1184 | pub struct UseTreeList { |
@@ -1181,11 +1190,11 @@ impl UseTreeList { | |||
1181 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 1190 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1182 | } | 1191 | } |
1183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1192 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1184 | pub struct Alias { | 1193 | pub struct Rename { |
1185 | pub(crate) syntax: SyntaxNode, | 1194 | pub(crate) syntax: SyntaxNode, |
1186 | } | 1195 | } |
1187 | impl ast::NameOwner for Alias {} | 1196 | impl ast::NameOwner for Rename {} |
1188 | impl Alias { | 1197 | impl Rename { |
1189 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | 1198 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
1190 | } | 1199 | } |
1191 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1336,10 +1345,10 @@ pub enum AssocItem { | |||
1336 | FnDef(FnDef), | 1345 | FnDef(FnDef), |
1337 | TypeAliasDef(TypeAliasDef), | 1346 | TypeAliasDef(TypeAliasDef), |
1338 | ConstDef(ConstDef), | 1347 | ConstDef(ConstDef), |
1348 | MacroCall(MacroCall), | ||
1339 | } | 1349 | } |
1340 | impl ast::AttrsOwner for AssocItem {} | 1350 | impl ast::AttrsOwner for AssocItem {} |
1341 | impl ast::NameOwner for AssocItem {} | 1351 | impl ast::NameOwner for AssocItem {} |
1342 | impl ast::VisibilityOwner for AssocItem {} | ||
1343 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1352 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1344 | pub enum Pat { | 1353 | pub enum Pat { |
1345 | OrPat(OrPat), | 1354 | OrPat(OrPat), |
@@ -1574,8 +1583,8 @@ impl AstNode for Visibility { | |||
1574 | } | 1583 | } |
1575 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1584 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1576 | } | 1585 | } |
1577 | impl AstNode for Abi { | 1586 | impl AstNode for Name { |
1578 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 1587 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } |
1579 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1588 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1580 | if Self::can_cast(syntax.kind()) { | 1589 | if Self::can_cast(syntax.kind()) { |
1581 | Some(Self { syntax }) | 1590 | Some(Self { syntax }) |
@@ -1585,8 +1594,19 @@ impl AstNode for Abi { | |||
1585 | } | 1594 | } |
1586 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1587 | } | 1596 | } |
1588 | impl AstNode for Name { | 1597 | impl AstNode for ItemList { |
1589 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } | 1598 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } |
1599 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1600 | if Self::can_cast(syntax.kind()) { | ||
1601 | Some(Self { syntax }) | ||
1602 | } else { | ||
1603 | None | ||
1604 | } | ||
1605 | } | ||
1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1607 | } | ||
1608 | impl AstNode for Abi { | ||
1609 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | ||
1590 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1610 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1591 | if Self::can_cast(syntax.kind()) { | 1611 | if Self::can_cast(syntax.kind()) { |
1592 | Some(Self { syntax }) | 1612 | Some(Self { syntax }) |
@@ -1728,8 +1748,8 @@ impl AstNode for TypeBoundList { | |||
1728 | } | 1748 | } |
1729 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1749 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1730 | } | 1750 | } |
1731 | impl AstNode for ItemList { | 1751 | impl AstNode for AssocItemList { |
1732 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | 1752 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } |
1733 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1753 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1734 | if Self::can_cast(syntax.kind()) { | 1754 | if Self::can_cast(syntax.kind()) { |
1735 | Some(Self { syntax }) | 1755 | Some(Self { syntax }) |
@@ -2663,8 +2683,8 @@ impl AstNode for UseTreeList { | |||
2663 | } | 2683 | } |
2664 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2684 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2665 | } | 2685 | } |
2666 | impl AstNode for Alias { | 2686 | impl AstNode for Rename { |
2667 | fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS } | 2687 | fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } |
2668 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2688 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2669 | if Self::can_cast(syntax.kind()) { | 2689 | if Self::can_cast(syntax.kind()) { |
2670 | Some(Self { syntax }) | 2690 | Some(Self { syntax }) |
@@ -3144,10 +3164,13 @@ impl From<TypeAliasDef> for AssocItem { | |||
3144 | impl From<ConstDef> for AssocItem { | 3164 | impl From<ConstDef> for AssocItem { |
3145 | fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } | 3165 | fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } |
3146 | } | 3166 | } |
3167 | impl From<MacroCall> for AssocItem { | ||
3168 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } | ||
3169 | } | ||
3147 | impl AstNode for AssocItem { | 3170 | impl AstNode for AssocItem { |
3148 | fn can_cast(kind: SyntaxKind) -> bool { | 3171 | fn can_cast(kind: SyntaxKind) -> bool { |
3149 | match kind { | 3172 | match kind { |
3150 | FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true, | 3173 | FN_DEF | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true, |
3151 | _ => false, | 3174 | _ => false, |
3152 | } | 3175 | } |
3153 | } | 3176 | } |
@@ -3156,6 +3179,7 @@ impl AstNode for AssocItem { | |||
3156 | FN_DEF => AssocItem::FnDef(FnDef { syntax }), | 3179 | FN_DEF => AssocItem::FnDef(FnDef { syntax }), |
3157 | TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }), | 3180 | TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }), |
3158 | CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }), | 3181 | CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }), |
3182 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), | ||
3159 | _ => return None, | 3183 | _ => return None, |
3160 | }; | 3184 | }; |
3161 | Some(res) | 3185 | Some(res) |
@@ -3165,6 +3189,7 @@ impl AstNode for AssocItem { | |||
3165 | AssocItem::FnDef(it) => &it.syntax, | 3189 | AssocItem::FnDef(it) => &it.syntax, |
3166 | AssocItem::TypeAliasDef(it) => &it.syntax, | 3190 | AssocItem::TypeAliasDef(it) => &it.syntax, |
3167 | AssocItem::ConstDef(it) => &it.syntax, | 3191 | AssocItem::ConstDef(it) => &it.syntax, |
3192 | AssocItem::MacroCall(it) => &it.syntax, | ||
3168 | } | 3193 | } |
3169 | } | 3194 | } |
3170 | } | 3195 | } |
@@ -3515,12 +3540,17 @@ impl std::fmt::Display for Visibility { | |||
3515 | std::fmt::Display::fmt(self.syntax(), f) | 3540 | std::fmt::Display::fmt(self.syntax(), f) |
3516 | } | 3541 | } |
3517 | } | 3542 | } |
3518 | impl std::fmt::Display for Abi { | 3543 | impl std::fmt::Display for Name { |
3519 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3544 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3520 | std::fmt::Display::fmt(self.syntax(), f) | 3545 | std::fmt::Display::fmt(self.syntax(), f) |
3521 | } | 3546 | } |
3522 | } | 3547 | } |
3523 | impl std::fmt::Display for Name { | 3548 | impl std::fmt::Display for ItemList { |
3549 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3550 | std::fmt::Display::fmt(self.syntax(), f) | ||
3551 | } | ||
3552 | } | ||
3553 | impl std::fmt::Display for Abi { | ||
3524 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3554 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3525 | std::fmt::Display::fmt(self.syntax(), f) | 3555 | std::fmt::Display::fmt(self.syntax(), f) |
3526 | } | 3556 | } |
@@ -3585,7 +3615,7 @@ impl std::fmt::Display for TypeBoundList { | |||
3585 | std::fmt::Display::fmt(self.syntax(), f) | 3615 | std::fmt::Display::fmt(self.syntax(), f) |
3586 | } | 3616 | } |
3587 | } | 3617 | } |
3588 | impl std::fmt::Display for ItemList { | 3618 | impl std::fmt::Display for AssocItemList { |
3589 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3619 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3590 | std::fmt::Display::fmt(self.syntax(), f) | 3620 | std::fmt::Display::fmt(self.syntax(), f) |
3591 | } | 3621 | } |
@@ -4010,7 +4040,7 @@ impl std::fmt::Display for UseTreeList { | |||
4010 | std::fmt::Display::fmt(self.syntax(), f) | 4040 | std::fmt::Display::fmt(self.syntax(), f) |
4011 | } | 4041 | } |
4012 | } | 4042 | } |
4013 | impl std::fmt::Display for Alias { | 4043 | impl std::fmt::Display for Rename { |
4014 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4044 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4015 | std::fmt::Display::fmt(self.syntax(), f) | 4045 | std::fmt::Display::fmt(self.syntax(), f) |
4016 | } | 4046 | } |