From e6d22187a67e762bb950de244a6ca15f3a0b0731 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Apr 2020 18:25:36 +0200 Subject: [PATCH] Add _token suffix to token accessors I think this makes is more clear which things are : AstNode and which are : AstToken --- .../src/handlers/add_explicit_type.rs | 4 +- crates/ra_assists/src/handlers/add_impl.rs | 2 +- crates/ra_assists/src/handlers/add_new.rs | 2 +- .../ra_assists/src/handlers/merge_imports.rs | 2 +- crates/ra_hir_def/src/path/lower.rs | 2 +- crates/ra_hir_def/src/path/lower/lower_use.rs | 2 +- crates/ra_hir_ty/src/tests.rs | 2 +- crates/ra_syntax/src/ast.rs | 2 +- crates/ra_syntax/src/ast/edit.rs | 6 +- crates/ra_syntax/src/ast/extensions.rs | 22 +- crates/ra_syntax/src/ast/generated/nodes.rs | 376 +++++++++--------- xtask/src/codegen/gen_syntax.rs | 1 + 12 files changed, 210 insertions(+), 213 deletions(-) diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs index d86d804b2e..e7dcfb44e2 100644 --- a/crates/ra_assists/src/handlers/add_explicit_type.rs +++ b/crates/ra_assists/src/handlers/add_explicit_type.rs @@ -1,6 +1,6 @@ use hir::HirDisplay; use ra_syntax::{ - ast::{self, AstNode, LetStmt, NameOwner, TypeAscriptionOwner}, + ast::{self, AstNode, AstToken, LetStmt, NameOwner, TypeAscriptionOwner}, TextRange, }; @@ -35,7 +35,7 @@ pub(crate) fn add_explicit_type(ctx: AssistCtx) -> Option { let name = pat.name()?; let name_range = name.syntax().text_range(); let stmt_range = stmt.syntax().text_range(); - let eq_range = stmt.eq_token()?.text_range(); + let eq_range = stmt.eq_token()?.syntax().text_range(); // Assist should only be applicable if cursor is between 'let' and '=' let let_range = TextRange::from_to(stmt_range.start(), eq_range.start()); let cursor_in_range = ctx.frange.range.is_subrange(&let_range); diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs index 72a201b6d2..26dfed2376 100644 --- a/crates/ra_assists/src/handlers/add_impl.rs +++ b/crates/ra_assists/src/handlers/add_impl.rs @@ -42,7 +42,7 @@ pub(crate) fn add_impl(ctx: AssistCtx) -> Option { if let Some(type_params) = type_params { let lifetime_params = type_params .lifetime_params() - .filter_map(|it| it.lifetime()) + .filter_map(|it| it.lifetime_token()) .map(|it| it.text().clone()); let type_params = type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs index c10397249f..30360af942 100644 --- a/crates/ra_assists/src/handlers/add_new.rs +++ b/crates/ra_assists/src/handlers/add_new.rs @@ -106,7 +106,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { if let Some(type_params) = type_params { let lifetime_params = type_params .lifetime_params() - .filter_map(|it| it.lifetime()) + .filter_map(|it| it.lifetime_token()) .map(|it| it.text().clone()); let type_params = type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index f8b3ddb4e1..936d50ab49 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs @@ -82,7 +82,7 @@ fn try_merge_trees(old: &ast::UseTree, new: &ast::UseTree) -> Option Option loop { let segment = path.segment()?; - if segment.coloncolon().is_some() { + if segment.coloncolon_token().is_some() { kind = PathKind::Abs; } diff --git a/crates/ra_hir_def/src/path/lower/lower_use.rs b/crates/ra_hir_def/src/path/lower/lower_use.rs index 6ec944228c..5b6854b0f0 100644 --- a/crates/ra_hir_def/src/path/lower/lower_use.rs +++ b/crates/ra_hir_def/src/path/lower/lower_use.rs @@ -34,7 +34,7 @@ pub(crate) fn lower_use_tree( let alias = tree.alias().map(|a| { a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) }); - let is_glob = tree.star().is_some(); + let is_glob = tree.star_token().is_some(); if let Some(ast_path) = tree.path() { // Handle self in a path. // E.g. `use something::{self, <...>}` diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index ac09662368..f97e0bfebc 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs @@ -101,7 +101,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String { let node = src_ptr.value.to_node(&src_ptr.file_syntax(&db)); let (range, text) = if let Some(self_param) = ast::SelfParam::cast(node.clone()) { - (self_param.self_kw().unwrap().syntax().text_range(), "self".to_string()) + (self_param.self_kw_token().unwrap().syntax().text_range(), "self".to_string()) } else { (src_ptr.value.range(), node.text().to_string().replace("\n", " ")) }; diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index a42eec91a9..15a8279f3d 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -287,7 +287,7 @@ where let pred = predicates.next().unwrap(); let mut bounds = pred.type_bound_list().unwrap().bounds(); - assert_eq!("'a", pred.lifetime().unwrap().text()); + assert_eq!("'a", pred.lifetime_token().unwrap().text()); assert_bound("'b", bounds.next()); assert_bound("'c", bounds.next()); diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index d793109953..62153f199b 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs @@ -96,7 +96,7 @@ impl ast::ItemList { leading_indent(it.syntax()).unwrap_or_default().to_string(), InsertPosition::After(it.syntax().clone().into()), ), - None => match self.l_curly() { + None => match self.l_curly_token() { Some(it) => ( " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), InsertPosition::After(it.syntax().clone().into()), @@ -142,7 +142,7 @@ impl ast::RecordFieldList { macro_rules! after_l_curly { () => {{ - let anchor = match self.l_curly() { + let anchor = match self.l_curly_token() { Some(it) => it.syntax().clone().into(), None => return self.clone(), }; @@ -301,7 +301,7 @@ impl ast::UseTree { suffix.clone(), self.use_tree_list(), self.alias(), - self.star().is_some(), + self.star_token().is_some(), ); let nested = make::use_tree_list(iter::once(use_tree)); return make::use_tree(prefix.clone(), Some(nested), None, false); diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index c7df15662e..ff3525c844 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -23,7 +23,7 @@ impl ast::NameRef { } pub fn as_tuple_field(&self) -> Option { - if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token() { + if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token_token() { token.text().as_str().parse().ok() } else { None @@ -138,7 +138,7 @@ impl ast::Path { impl ast::Module { pub fn has_semi(&self) -> bool { - self.semi().is_some() + self.semi_token().is_some() } } @@ -174,7 +174,7 @@ impl ast::ImplDef { } pub fn is_negative(&self) -> bool { - self.excl().is_some() + self.excl_token().is_some() } } @@ -218,11 +218,11 @@ impl ast::EnumVariant { impl ast::FnDef { pub fn semicolon_token(&self) -> Option { - Some(self.semi()?.syntax().clone()) + Some(self.semi_token()?.syntax().clone()) } pub fn is_async(&self) -> bool { - self.async_kw().is_some() + self.async_kw_token().is_some() } } @@ -233,15 +233,11 @@ impl ast::LetStmt { Some(node) => node.kind() == T![;], } } - - pub fn eq_token(&self) -> Option { - Some(self.eq()?.syntax().clone()) - } } impl ast::ExprStmt { pub fn has_semi(&self) -> bool { - self.semi().is_some() + self.semi_token().is_some() } } @@ -350,7 +346,7 @@ pub enum SelfParamKind { impl ast::SelfParam { pub fn kind(&self) -> SelfParamKind { - if self.amp().is_some() { + if self.amp_token().is_some() { if self.amp_mut_kw().is_some() { SelfParamKind::MutRef } else { @@ -396,7 +392,7 @@ impl ast::TypeBound { TypeBoundKind::PathType(path_type) } else if let Some(for_type) = children(self).next() { TypeBoundKind::ForType(for_type) - } else if let Some(lifetime) = self.lifetime() { + } else if let Some(lifetime) = self.lifetime_token() { TypeBoundKind::Lifetime(lifetime) } else { unreachable!() @@ -416,7 +412,7 @@ impl ast::TypeBound { } pub fn question(&self) -> Option { - if self.const_kw().is_some() { + if self.const_kw_token().is_some() { self.syntax() .children_with_tokens() .filter_map(|it| it.into_token()) diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 8b348ad6e1..0bcb7fe61c 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -49,15 +49,15 @@ impl ast::DocCommentsOwner for FnDef {} impl ast::AttrsOwner for FnDef {} impl FnDef { pub fn abi(&self) -> Option { support::child(&self.syntax) } - pub fn const_kw(&self) -> Option { support::token(&self.syntax) } - pub fn default_kw(&self) -> Option { support::token(&self.syntax) } - pub fn async_kw(&self) -> Option { support::token(&self.syntax) } - pub fn unsafe_kw(&self) -> Option { support::token(&self.syntax) } - pub fn fn_kw(&self) -> Option { support::token(&self.syntax) } + pub fn const_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn default_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn async_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn unsafe_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn fn_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn param_list(&self) -> Option { support::child(&self.syntax) } pub fn ret_type(&self) -> Option { support::child(&self.syntax) } pub fn body(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RetType { @@ -75,7 +75,7 @@ impl AstNode for RetType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl RetType { - pub fn thin_arrow(&self) -> Option { support::token(&self.syntax) } + pub fn thin_arrow_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -99,9 +99,9 @@ impl ast::TypeParamsOwner for StructDef {} impl ast::AttrsOwner for StructDef {} impl ast::DocCommentsOwner for StructDef {} impl StructDef { - pub fn struct_kw(&self) -> Option { support::token(&self.syntax) } + pub fn struct_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn field_def_list(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UnionDef { @@ -124,7 +124,7 @@ impl ast::TypeParamsOwner for UnionDef {} impl ast::AttrsOwner for UnionDef {} impl ast::DocCommentsOwner for UnionDef {} impl UnionDef { - pub fn union_kw(&self) -> Option { support::token(&self.syntax) } + pub fn union_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn record_field_def_list(&self) -> Option { support::child(&self.syntax) } @@ -145,9 +145,9 @@ impl AstNode for RecordFieldDefList { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl RecordFieldDefList { - pub fn l_curly(&self) -> Option { support::token(&self.syntax) } + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax) } pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_curly(&self) -> Option { support::token(&self.syntax) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordFieldDef { @@ -186,9 +186,9 @@ impl AstNode for TupleFieldDefList { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl TupleFieldDefList { - pub fn l_paren(&self) -> Option { support::token(&self.syntax) } + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax) } pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_paren(&self) -> Option { support::token(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleFieldDef { @@ -231,7 +231,7 @@ impl ast::TypeParamsOwner for EnumDef {} impl ast::AttrsOwner for EnumDef {} impl ast::DocCommentsOwner for EnumDef {} impl EnumDef { - pub fn enum_kw(&self) -> Option { support::token(&self.syntax) } + pub fn enum_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn variant_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -250,9 +250,9 @@ impl AstNode for EnumVariantList { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl EnumVariantList { - pub fn l_curly(&self) -> Option { support::token(&self.syntax) } + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax) } pub fn variants(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_curly(&self) -> Option { support::token(&self.syntax) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct EnumVariant { @@ -275,7 +275,7 @@ impl ast::DocCommentsOwner for EnumVariant {} impl ast::AttrsOwner for EnumVariant {} impl EnumVariant { pub fn field_def_list(&self) -> Option { support::child(&self.syntax) } - pub fn eq(&self) -> Option { support::token(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax) } pub fn expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -300,9 +300,9 @@ impl ast::DocCommentsOwner for TraitDef {} impl ast::TypeParamsOwner for TraitDef {} impl ast::TypeBoundsOwner for TraitDef {} impl TraitDef { - pub fn unsafe_kw(&self) -> Option { support::token(&self.syntax) } - pub fn auto_kw(&self) -> Option { support::token(&self.syntax) } - pub fn trait_kw(&self) -> Option { support::token(&self.syntax) } + pub fn unsafe_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn auto_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn trait_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn item_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -325,9 +325,9 @@ impl ast::NameOwner for Module {} impl ast::AttrsOwner for Module {} impl ast::DocCommentsOwner for Module {} impl Module { - pub fn mod_kw(&self) -> Option { support::token(&self.syntax) } + pub fn mod_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn item_list(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ItemList { @@ -347,9 +347,9 @@ impl AstNode for ItemList { impl ast::FnDefOwner for ItemList {} impl ast::ModuleItemOwner for ItemList {} impl ItemList { - pub fn l_curly(&self) -> Option { support::token(&self.syntax) } + pub fn l_curly_token(&self) -> Option { support::token(&self.syntax) } pub fn impl_items(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_curly(&self) -> Option { support::token(&self.syntax) } + pub fn r_curly_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ConstDef { @@ -373,11 +373,11 @@ impl ast::AttrsOwner for ConstDef {} impl ast::DocCommentsOwner for ConstDef {} impl ast::TypeAscriptionOwner for ConstDef {} impl ConstDef { - pub fn default_kw(&self) -> Option { support::token(&self.syntax) } - pub fn const_kw(&self) -> Option { support::token(&self.syntax) } - pub fn eq(&self) -> Option { support::token(&self.syntax) } + pub fn default_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn const_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax) } pub fn body(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct StaticDef { @@ -401,11 +401,11 @@ impl ast::AttrsOwner for StaticDef {} impl ast::DocCommentsOwner for StaticDef {} impl ast::TypeAscriptionOwner for StaticDef {} impl StaticDef { - pub fn static_kw(&self) -> Option { support::token(&self.syntax) } - pub fn mut_kw(&self) -> Option { support::token(&self.syntax) } - pub fn eq(&self) -> Option { support::token(&self.syntax) } + pub fn static_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn mut_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax) } pub fn body(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeAliasDef { @@ -429,11 +429,11 @@ impl ast::AttrsOwner for TypeAliasDef {} impl ast::DocCommentsOwner for TypeAliasDef {} impl ast::TypeBoundsOwner for TypeAliasDef {} impl TypeAliasDef { - pub fn default_kw(&self) -> Option { support::token(&self.syntax) } - pub fn type_kw(&self) -> Option { support::token(&self.syntax) } - pub fn eq(&self) -> Option { support::token(&self.syntax) } + pub fn default_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn type_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn eq_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ImplDef { @@ -453,12 +453,12 @@ impl AstNode for ImplDef { impl ast::TypeParamsOwner for ImplDef {} impl ast::AttrsOwner for ImplDef {} impl ImplDef { - pub fn default_kw(&self) -> Option { support::token(&self.syntax) } - pub fn const_kw(&self) -> Option { support::token(&self.syntax) } - pub fn unsafe_kw(&self) -> Option { support::token(&self.syntax) } - pub fn impl_kw(&self) -> Option { support::token(&self.syntax) } - pub fn excl(&self) -> Option { support::token(&self.syntax) } - pub fn for_kw(&self) -> Option { support::token(&self.syntax) } + pub fn default_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn const_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn unsafe_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn impl_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn excl_token(&self) -> Option { support::token(&self.syntax) } + pub fn for_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn item_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -477,9 +477,9 @@ impl AstNode for ParenType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl ParenType { - pub fn l_paren(&self) -> Option { support::token(&self.syntax) } + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } - pub fn r_paren(&self) -> Option { support::token(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleType { @@ -497,9 +497,9 @@ impl AstNode for TupleType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl TupleType { - pub fn l_paren(&self) -> Option { support::token(&self.syntax) } + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax) } pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_paren(&self) -> Option { support::token(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct NeverType { @@ -517,7 +517,7 @@ impl AstNode for NeverType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl NeverType { - pub fn excl(&self) -> Option { support::token(&self.syntax) } + pub fn excl_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathType { @@ -553,8 +553,8 @@ impl AstNode for PointerType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl PointerType { - pub fn star(&self) -> Option { support::token(&self.syntax) } - pub fn const_kw(&self) -> Option { support::token(&self.syntax) } + pub fn star_token(&self) -> Option { support::token(&self.syntax) } + pub fn const_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -573,11 +573,11 @@ impl AstNode for ArrayType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl ArrayType { - pub fn l_brack(&self) -> Option { support::token(&self.syntax) } + pub fn l_brack_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } pub fn expr(&self) -> Option { support::child(&self.syntax) } - pub fn r_brack(&self) -> Option { support::token(&self.syntax) } + pub fn r_brack_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SliceType { @@ -595,9 +595,9 @@ impl AstNode for SliceType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl SliceType { - pub fn l_brack(&self) -> Option { support::token(&self.syntax) } + pub fn l_brack_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } - pub fn r_brack(&self) -> Option { support::token(&self.syntax) } + pub fn r_brack_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ReferenceType { @@ -615,9 +615,9 @@ impl AstNode for ReferenceType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl ReferenceType { - pub fn amp(&self) -> Option { support::token(&self.syntax) } - pub fn lifetime(&self) -> Option { support::token(&self.syntax) } - pub fn mut_kw(&self) -> Option { support::token(&self.syntax) } + pub fn amp_token(&self) -> Option { support::token(&self.syntax) } + pub fn lifetime_token(&self) -> Option { support::token(&self.syntax) } + pub fn mut_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -636,7 +636,7 @@ impl AstNode for PlaceholderType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl PlaceholderType { - pub fn underscore(&self) -> Option { support::token(&self.syntax) } + pub fn underscore_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct FnPointerType { @@ -655,8 +655,8 @@ impl AstNode for FnPointerType { } impl FnPointerType { pub fn abi(&self) -> Option { support::child(&self.syntax) } - pub fn unsafe_kw(&self) -> Option { support::token(&self.syntax) } - pub fn fn_kw(&self) -> Option { support::token(&self.syntax) } + pub fn unsafe_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn fn_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn param_list(&self) -> Option { support::child(&self.syntax) } pub fn ret_type(&self) -> Option { support::child(&self.syntax) } } @@ -676,7 +676,7 @@ impl AstNode for ForType { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl ForType { - pub fn for_kw(&self) -> Option { support::token(&self.syntax) } + pub fn for_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn type_param_list(&self) -> Option { support::child(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } @@ -697,7 +697,7 @@ impl AstNode for ImplTraitType { } impl ast::TypeBoundsOwner for ImplTraitType {} impl ImplTraitType { - pub fn impl_kw(&self) -> Option { support::token(&self.syntax) } + pub fn impl_kw_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct DynTraitType { @@ -716,7 +716,7 @@ impl AstNode for DynTraitType { } impl ast::TypeBoundsOwner for DynTraitType {} impl DynTraitType { - pub fn dyn_kw(&self) -> Option { support::token(&self.syntax) } + pub fn dyn_kw_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleExpr { @@ -735,9 +735,9 @@ impl AstNode for TupleExpr { } impl ast::AttrsOwner for TupleExpr {} impl TupleExpr { - pub fn l_paren(&self) -> Option { support::token(&self.syntax) } + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax) } pub fn exprs(&self) -> AstChildren { support::children(&self.syntax) } - pub fn r_paren(&self) -> Option { support::token(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ArrayExpr { @@ -756,10 +756,10 @@ impl AstNode for ArrayExpr { } impl ast::AttrsOwner for ArrayExpr {} impl ArrayExpr { - pub fn l_brack(&self) -> Option { support::token(&self.syntax) } + pub fn l_brack_token(&self) -> Option { support::token(&self.syntax) } pub fn exprs(&self) -> AstChildren { support::children(&self.syntax) } - pub fn semi(&self) -> Option { support::token(&self.syntax) } - pub fn r_brack(&self) -> Option { support::token(&self.syntax) } + pub fn semi_token(&self) -> Option { support::token(&self.syntax) } + pub fn r_brack_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenExpr { @@ -778,9 +778,9 @@ impl AstNode for ParenExpr { } impl ast::AttrsOwner for ParenExpr {} impl ParenExpr { - pub fn l_paren(&self) -> Option { support::token(&self.syntax) } + pub fn l_paren_token(&self) -> Option { support::token(&self.syntax) } pub fn expr(&self) -> Option { support::child(&self.syntax) } - pub fn r_paren(&self) -> Option { support::token(&self.syntax) } + pub fn r_paren_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathExpr { @@ -817,9 +817,9 @@ impl AstNode for LambdaExpr { } impl ast::AttrsOwner for LambdaExpr {} impl LambdaExpr { - pub fn static_kw(&self) -> Option { support::token(&self.syntax) } - pub fn async_kw(&self) -> Option { support::token(&self.syntax) } - pub fn move_kw(&self) -> Option { support::token(&self.syntax) } + pub fn static_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn async_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn move_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn param_list(&self) -> Option { support::child(&self.syntax) } pub fn ret_type(&self) -> Option { support::child(&self.syntax) } pub fn body(&self) -> Option { support::child(&self.syntax) } @@ -841,7 +841,7 @@ impl AstNode for IfExpr { } impl ast::AttrsOwner for IfExpr {} impl IfExpr { - pub fn if_kw(&self) -> Option { support::token(&self.syntax) } + pub fn if_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn condition(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -862,7 +862,7 @@ impl AstNode for LoopExpr { impl ast::AttrsOwner for LoopExpr {} impl ast::LoopBodyOwner for LoopExpr {} impl LoopExpr { - pub fn loop_kw(&self) -> Option { support::token(&self.syntax) } + pub fn loop_kw_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TryBlockExpr { @@ -881,7 +881,7 @@ impl AstNode for TryBlockExpr { } impl ast::AttrsOwner for TryBlockExpr {} impl TryBlockExpr { - pub fn try_kw(&self) -> Option { support::token(&self.syntax) } + pub fn try_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn body(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -902,9 +902,9 @@ impl AstNode for ForExpr { impl ast::AttrsOwner for ForExpr {} impl ast::LoopBodyOwner for ForExpr {} impl ForExpr { - pub fn for_kw(&self) -> Option { support::token(&self.syntax) } + pub fn for_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn pat(&self) -> Option { support::child(&self.syntax) } - pub fn in_kw(&self) -> Option { support::token(&self.syntax) } + pub fn in_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn iterable(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -925,7 +925,7 @@ impl AstNode for WhileExpr { impl ast::AttrsOwner for WhileExpr {} impl ast::LoopBodyOwner for WhileExpr {} impl WhileExpr { - pub fn while_kw(&self) -> Option { support::token(&self.syntax) } + pub fn while_kw_token(&self) -> Option { support::token(&self.syntax) } pub fn condition(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -945,8 +945,8 @@ impl AstNode for ContinueExpr { } impl ast::AttrsOwner for ContinueExpr {} impl ContinueExpr { - pub fn continue_kw(&self) -> Option { support::token(&self.syntax) } - pub fn lifetime(&self) -> Option { support::token(&self.syntax) } + pub fn continue_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn lifetime_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BreakExpr { @@ -965,8 +965,8 @@ impl AstNode for BreakExpr { } impl ast::AttrsOwner for BreakExpr {} impl BreakExpr { - pub fn break_kw(&self) -> Option { support::token(&self.syntax) } - pub fn lifetime(&self) -> Option { support::token(&self.syntax) } + pub fn break_kw_token(&self) -> Option { support::token(&self.syntax) } + pub fn lifetime_token(&self) -> Option { support::token(&self.syntax) } pub fn expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -985,7 +985,7 @@ impl AstNode for Label { fn syntax(&self) -> &SyntaxNode { &self.syntax } } impl Label { - pub fn lifetime(&self) -> Option { support::token(&self.syntax) } + pub fn lifetime_token(&self) -> Option { support::token(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BlockExpr { @@ -1005,7 +1005,7 @@ impl AstNode for BlockExpr { impl ast::AttrsOwner for BlockExpr {} impl BlockExpr { pub fn label(&self) -> Option