mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Simpler acessors for keywords
This commit is contained in:
parent
00ec0c1066
commit
30084a56a5
14 changed files with 128 additions and 1025 deletions
|
@ -4,7 +4,7 @@ use super::tokens::*;
|
|||
use crate::{
|
||||
ast::{self, support, AstChildren, AstNode},
|
||||
SyntaxKind::{self, *},
|
||||
SyntaxNode,
|
||||
SyntaxNode, SyntaxToken,
|
||||
};
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct SourceFile {
|
||||
|
@ -48,11 +48,11 @@ impl ast::DocCommentsOwner for FnDef {}
|
|||
impl ast::AttrsOwner for FnDef {}
|
||||
impl FnDef {
|
||||
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
|
||||
pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
|
||||
pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
|
||||
pub fn async_kw_token(&self) -> Option<AsyncKw> { support::token(&self.syntax) }
|
||||
pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
|
||||
pub fn fn_kw_token(&self) -> Option<FnKw> { support::token(&self.syntax) }
|
||||
pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) }
|
||||
pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) }
|
||||
pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) }
|
||||
pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) }
|
||||
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
|
||||
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
|
||||
pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
|
||||
|
@ -98,7 +98,7 @@ impl ast::TypeParamsOwner for StructDef {}
|
|||
impl ast::AttrsOwner for StructDef {}
|
||||
impl ast::DocCommentsOwner for StructDef {}
|
||||
impl StructDef {
|
||||
pub fn struct_kw_token(&self) -> Option<StructKw> { support::token(&self.syntax) }
|
||||
pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STRUCT_KW) }
|
||||
pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
|
||||
pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ impl ast::TypeParamsOwner for UnionDef {}
|
|||
impl ast::AttrsOwner for UnionDef {}
|
||||
impl ast::DocCommentsOwner for UnionDef {}
|
||||
impl UnionDef {
|
||||
pub fn union_kw_token(&self) -> Option<UnionKw> { support::token(&self.syntax) }
|
||||
pub fn union_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNION_KW) }
|
||||
pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
|
||||
support::child(&self.syntax)
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ impl ast::TypeParamsOwner for EnumDef {}
|
|||
impl ast::AttrsOwner for EnumDef {}
|
||||
impl ast::DocCommentsOwner for EnumDef {}
|
||||
impl EnumDef {
|
||||
pub fn enum_kw_token(&self) -> Option<EnumKw> { support::token(&self.syntax) }
|
||||
pub fn enum_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ENUM_KW) }
|
||||
pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -299,9 +299,9 @@ impl ast::DocCommentsOwner for TraitDef {}
|
|||
impl ast::TypeParamsOwner for TraitDef {}
|
||||
impl ast::TypeBoundsOwner for TraitDef {}
|
||||
impl TraitDef {
|
||||
pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
|
||||
pub fn auto_kw_token(&self) -> Option<AutoKw> { support::token(&self.syntax) }
|
||||
pub fn trait_kw_token(&self) -> Option<TraitKw> { support::token(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) }
|
||||
pub fn auto_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AUTO_KW) }
|
||||
pub fn trait_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRAIT_KW) }
|
||||
pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -324,7 +324,7 @@ impl ast::NameOwner for Module {}
|
|||
impl ast::AttrsOwner for Module {}
|
||||
impl ast::DocCommentsOwner for Module {}
|
||||
impl Module {
|
||||
pub fn mod_kw_token(&self) -> Option<ModKw> { support::token(&self.syntax) }
|
||||
pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOD_KW) }
|
||||
pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
|
||||
pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
|
||||
}
|
||||
|
@ -371,8 +371,8 @@ impl ast::AttrsOwner for ConstDef {}
|
|||
impl ast::DocCommentsOwner for ConstDef {}
|
||||
impl ast::TypeAscriptionOwner for ConstDef {}
|
||||
impl ConstDef {
|
||||
pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
|
||||
pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
|
||||
pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) }
|
||||
pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) }
|
||||
pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
|
||||
pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
|
||||
|
@ -399,8 +399,8 @@ impl ast::AttrsOwner for StaticDef {}
|
|||
impl ast::DocCommentsOwner for StaticDef {}
|
||||
impl ast::TypeAscriptionOwner for StaticDef {}
|
||||
impl StaticDef {
|
||||
pub fn static_kw_token(&self) -> Option<StaticKw> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
|
||||
pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
|
||||
|
@ -427,8 +427,8 @@ impl ast::AttrsOwner for TypeAliasDef {}
|
|||
impl ast::DocCommentsOwner for TypeAliasDef {}
|
||||
impl ast::TypeBoundsOwner for TypeAliasDef {}
|
||||
impl TypeAliasDef {
|
||||
pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
|
||||
pub fn type_kw_token(&self) -> Option<TypeKw> { support::token(&self.syntax) }
|
||||
pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) }
|
||||
pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TYPE_KW) }
|
||||
pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) }
|
||||
|
@ -451,12 +451,12 @@ impl AstNode for ImplDef {
|
|||
impl ast::TypeParamsOwner for ImplDef {}
|
||||
impl ast::AttrsOwner for ImplDef {}
|
||||
impl ImplDef {
|
||||
pub fn default_kw_token(&self) -> Option<DefaultKw> { support::token(&self.syntax) }
|
||||
pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
|
||||
pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
|
||||
pub fn impl_kw_token(&self) -> Option<ImplKw> { support::token(&self.syntax) }
|
||||
pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) }
|
||||
pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) }
|
||||
pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) }
|
||||
pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) }
|
||||
pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
|
||||
pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) }
|
||||
pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -552,8 +552,8 @@ impl AstNode for PointerType {
|
|||
}
|
||||
impl PointerType {
|
||||
pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) }
|
||||
pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -616,7 +616,7 @@ impl AstNode for ReferenceType {
|
|||
impl ReferenceType {
|
||||
pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
|
||||
pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -654,8 +654,8 @@ impl AstNode for FnPointerType {
|
|||
}
|
||||
impl FnPointerType {
|
||||
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
|
||||
pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
|
||||
pub fn fn_kw_token(&self) -> Option<FnKw> { support::token(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) }
|
||||
pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) }
|
||||
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
|
||||
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ impl AstNode for ForType {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl ForType {
|
||||
pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
|
||||
pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) }
|
||||
pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -696,7 +696,7 @@ impl AstNode for ImplTraitType {
|
|||
}
|
||||
impl ast::TypeBoundsOwner for ImplTraitType {}
|
||||
impl ImplTraitType {
|
||||
pub fn impl_kw_token(&self) -> Option<ImplKw> { support::token(&self.syntax) }
|
||||
pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct DynTraitType {
|
||||
|
@ -715,7 +715,7 @@ impl AstNode for DynTraitType {
|
|||
}
|
||||
impl ast::TypeBoundsOwner for DynTraitType {}
|
||||
impl DynTraitType {
|
||||
pub fn dyn_kw_token(&self) -> Option<DynKw> { support::token(&self.syntax) }
|
||||
pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DYN_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TupleExpr {
|
||||
|
@ -816,9 +816,9 @@ impl AstNode for LambdaExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for LambdaExpr {}
|
||||
impl LambdaExpr {
|
||||
pub fn static_kw_token(&self) -> Option<StaticKw> { support::token(&self.syntax) }
|
||||
pub fn async_kw_token(&self) -> Option<AsyncKw> { support::token(&self.syntax) }
|
||||
pub fn move_kw_token(&self) -> Option<MoveKw> { support::token(&self.syntax) }
|
||||
pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) }
|
||||
pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) }
|
||||
pub fn move_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOVE_KW) }
|
||||
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
|
||||
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
|
||||
pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
|
@ -840,7 +840,7 @@ impl AstNode for IfExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for IfExpr {}
|
||||
impl IfExpr {
|
||||
pub fn if_kw_token(&self) -> Option<IfKw> { support::token(&self.syntax) }
|
||||
pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) }
|
||||
pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -861,7 +861,7 @@ impl AstNode for LoopExpr {
|
|||
impl ast::AttrsOwner for LoopExpr {}
|
||||
impl ast::LoopBodyOwner for LoopExpr {}
|
||||
impl LoopExpr {
|
||||
pub fn loop_kw_token(&self) -> Option<LoopKw> { support::token(&self.syntax) }
|
||||
pub fn loop_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LOOP_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TryBlockExpr {
|
||||
|
@ -880,7 +880,7 @@ impl AstNode for TryBlockExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for TryBlockExpr {}
|
||||
impl TryBlockExpr {
|
||||
pub fn try_kw_token(&self) -> Option<TryKw> { support::token(&self.syntax) }
|
||||
pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) }
|
||||
pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -901,9 +901,9 @@ impl AstNode for ForExpr {
|
|||
impl ast::AttrsOwner for ForExpr {}
|
||||
impl ast::LoopBodyOwner for ForExpr {}
|
||||
impl ForExpr {
|
||||
pub fn for_kw_token(&self) -> Option<ForKw> { support::token(&self.syntax) }
|
||||
pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
pub fn in_kw_token(&self) -> Option<InKw> { support::token(&self.syntax) }
|
||||
pub fn in_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IN_KW) }
|
||||
pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -924,7 +924,7 @@ impl AstNode for WhileExpr {
|
|||
impl ast::AttrsOwner for WhileExpr {}
|
||||
impl ast::LoopBodyOwner for WhileExpr {}
|
||||
impl WhileExpr {
|
||||
pub fn while_kw_token(&self) -> Option<WhileKw> { support::token(&self.syntax) }
|
||||
pub fn while_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHILE_KW) }
|
||||
pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -944,7 +944,9 @@ impl AstNode for ContinueExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for ContinueExpr {}
|
||||
impl ContinueExpr {
|
||||
pub fn continue_kw_token(&self) -> Option<ContinueKw> { support::token(&self.syntax) }
|
||||
pub fn continue_token(&self) -> Option<SyntaxToken> {
|
||||
support::token2(&self.syntax, CONTINUE_KW)
|
||||
}
|
||||
pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -964,7 +966,7 @@ impl AstNode for BreakExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for BreakExpr {}
|
||||
impl BreakExpr {
|
||||
pub fn break_kw_token(&self) -> Option<BreakKw> { support::token(&self.syntax) }
|
||||
pub fn break_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BREAK_KW) }
|
||||
pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -1004,7 +1006,7 @@ impl AstNode for BlockExpr {
|
|||
impl ast::AttrsOwner for BlockExpr {}
|
||||
impl BlockExpr {
|
||||
pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
|
||||
pub fn unsafe_kw_token(&self) -> Option<UnsafeKw> { support::token(&self.syntax) }
|
||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) }
|
||||
pub fn block(&self) -> Option<Block> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1128,7 +1130,7 @@ impl ast::AttrsOwner for AwaitExpr {}
|
|||
impl AwaitExpr {
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) }
|
||||
pub fn await_kw_token(&self) -> Option<AwaitKw> { support::token(&self.syntax) }
|
||||
pub fn await_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AWAIT_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TryExpr {
|
||||
|
@ -1147,7 +1149,7 @@ impl AstNode for TryExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for TryExpr {}
|
||||
impl TryExpr {
|
||||
pub fn try_kw_token(&self) -> Option<TryKw> { support::token(&self.syntax) }
|
||||
pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1168,7 +1170,7 @@ impl AstNode for CastExpr {
|
|||
impl ast::AttrsOwner for CastExpr {}
|
||||
impl CastExpr {
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn as_kw_token(&self) -> Option<AsKw> { support::token(&self.syntax) }
|
||||
pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1189,8 +1191,8 @@ impl AstNode for RefExpr {
|
|||
impl ast::AttrsOwner for RefExpr {}
|
||||
impl RefExpr {
|
||||
pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
|
||||
pub fn raw_kw_token(&self) -> Option<RawKw> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn raw_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, RAW_KW) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1230,7 +1232,7 @@ impl AstNode for BoxExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for BoxExpr {}
|
||||
impl BoxExpr {
|
||||
pub fn box_kw_token(&self) -> Option<BoxKw> { support::token(&self.syntax) }
|
||||
pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1306,7 +1308,7 @@ impl AstNode for MatchExpr {
|
|||
}
|
||||
impl ast::AttrsOwner for MatchExpr {}
|
||||
impl MatchExpr {
|
||||
pub fn match_kw_token(&self) -> Option<MatchKw> { support::token(&self.syntax) }
|
||||
pub fn match_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MATCH_KW) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -1369,7 +1371,7 @@ impl AstNode for MatchGuard {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl MatchGuard {
|
||||
pub fn if_kw_token(&self) -> Option<IfKw> { support::token(&self.syntax) }
|
||||
pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1489,7 +1491,7 @@ impl AstNode for RefPat {
|
|||
}
|
||||
impl RefPat {
|
||||
pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1508,7 +1510,7 @@ impl AstNode for BoxPat {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl BoxPat {
|
||||
pub fn box_kw_token(&self) -> Option<BoxKw> { support::token(&self.syntax) }
|
||||
pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -1529,8 +1531,8 @@ impl AstNode for BindPat {
|
|||
impl ast::AttrsOwner for BindPat {}
|
||||
impl ast::NameOwner for BindPat {}
|
||||
impl BindPat {
|
||||
pub fn ref_kw_token(&self) -> Option<RefKw> { support::token(&self.syntax) }
|
||||
pub fn mut_kw_token(&self) -> Option<MutKw> { support::token(&self.syntax) }
|
||||
pub fn ref_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, REF_KW) }
|
||||
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) }
|
||||
pub fn at_token(&self) -> Option<At> { support::token(&self.syntax) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -1786,10 +1788,10 @@ impl AstNode for Visibility {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl Visibility {
|
||||
pub fn pub_kw_token(&self) -> Option<PubKw> { support::token(&self.syntax) }
|
||||
pub fn super_kw_token(&self) -> Option<SuperKw> { support::token(&self.syntax) }
|
||||
pub fn self_kw_token(&self) -> Option<SelfKw> { support::token(&self.syntax) }
|
||||
pub fn crate_kw_token(&self) -> Option<CrateKw> { support::token(&self.syntax) }
|
||||
pub fn pub_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, PUB_KW) }
|
||||
pub fn super_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SUPER_KW) }
|
||||
pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) }
|
||||
pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Name {
|
||||
|
@ -1994,7 +1996,7 @@ impl AstNode for TypeBound {
|
|||
}
|
||||
impl TypeBound {
|
||||
pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
|
||||
pub fn const_kw_token(&self) -> Option<ConstKw> { support::token(&self.syntax) }
|
||||
pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) }
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -2051,7 +2053,7 @@ impl AstNode for WhereClause {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl WhereClause {
|
||||
pub fn where_kw_token(&self) -> Option<WhereKw> { support::token(&self.syntax) }
|
||||
pub fn where_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHERE_KW) }
|
||||
pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -2110,7 +2112,7 @@ impl AstNode for LetStmt {
|
|||
impl ast::AttrsOwner for LetStmt {}
|
||||
impl ast::TypeAscriptionOwner for LetStmt {}
|
||||
impl LetStmt {
|
||||
pub fn let_kw_token(&self) -> Option<LetKw> { support::token(&self.syntax) }
|
||||
pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
|
||||
pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
|
@ -2132,7 +2134,7 @@ impl AstNode for Condition {
|
|||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl Condition {
|
||||
pub fn let_kw_token(&self) -> Option<LetKw> { support::token(&self.syntax) }
|
||||
pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) }
|
||||
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
|
||||
pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) }
|
||||
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
|
@ -2201,7 +2203,7 @@ impl ast::AttrsOwner for SelfParam {}
|
|||
impl SelfParam {
|
||||
pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) }
|
||||
pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) }
|
||||
pub fn self_kw_token(&self) -> Option<SelfKw> { support::token(&self.syntax) }
|
||||
pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Param {
|
||||
|
@ -2242,7 +2244,7 @@ impl AstNode for UseItem {
|
|||
impl ast::AttrsOwner for UseItem {}
|
||||
impl ast::VisibilityOwner for UseItem {}
|
||||
impl UseItem {
|
||||
pub fn use_kw_token(&self) -> Option<UseKw> { support::token(&self.syntax) }
|
||||
pub fn use_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, USE_KW) }
|
||||
pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -2283,7 +2285,7 @@ impl AstNode for Alias {
|
|||
}
|
||||
impl ast::NameOwner for Alias {}
|
||||
impl Alias {
|
||||
pub fn as_kw_token(&self) -> Option<AsKw> { support::token(&self.syntax) }
|
||||
pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct UseTreeList {
|
||||
|
@ -2323,8 +2325,8 @@ impl AstNode for ExternCrateItem {
|
|||
impl ast::AttrsOwner for ExternCrateItem {}
|
||||
impl ast::VisibilityOwner for ExternCrateItem {}
|
||||
impl ExternCrateItem {
|
||||
pub fn extern_kw_token(&self) -> Option<ExternKw> { support::token(&self.syntax) }
|
||||
pub fn crate_kw_token(&self) -> Option<CrateKw> { support::token(&self.syntax) }
|
||||
pub fn extern_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, EXTERN_KW) }
|
||||
pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) }
|
||||
pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
|
||||
pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue