diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 72 |
1 files changed, 51 insertions, 21 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index dfda79550..fbf3b457a 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -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!['}']) } |
@@ -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 }) |
@@ -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 | } |