5591: Rename TypeAliasDef -> TypeAlias r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-07-30 13:26:15 +00:00 committed by GitHub
commit ee00679331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
272 changed files with 823 additions and 824 deletions

View file

@ -118,8 +118,8 @@ fn add_missing_impl_members_inner(
let def_name = |item: &ast::AssocItem| -> Option<SmolStr> {
match item {
ast::AssocItem::FnDef(def) => def.name(),
ast::AssocItem::TypeAliasDef(def) => def.name(),
ast::AssocItem::Fn(def) => def.name(),
ast::AssocItem::TypeAlias(def) => def.name(),
ast::AssocItem::ConstDef(def) => def.name(),
ast::AssocItem::MacroCall(_) => None,
}
@ -129,13 +129,13 @@ fn add_missing_impl_members_inner(
let missing_items = get_missing_assoc_items(&ctx.sema, &impl_def)
.iter()
.map(|i| match i {
hir::AssocItem::Function(i) => ast::AssocItem::FnDef(i.source(ctx.db()).value),
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value),
hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value),
hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value),
hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value),
})
.filter(|t| def_name(&t).is_some())
.filter(|t| match t {
ast::AssocItem::FnDef(def) => match mode {
ast::AssocItem::Fn(def) => match mode {
AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(),
AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(),
},
@ -158,10 +158,8 @@ fn add_missing_impl_members_inner(
.into_iter()
.map(|it| ast_transform::apply(&*ast_transform, it))
.map(|it| match it {
ast::AssocItem::FnDef(def) => ast::AssocItem::FnDef(add_body(def)),
ast::AssocItem::TypeAliasDef(def) => {
ast::AssocItem::TypeAliasDef(def.remove_bounds())
}
ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)),
ast::AssocItem::TypeAlias(def) => ast::AssocItem::TypeAlias(def.remove_bounds()),
_ => it,
})
.map(|it| edit::remove_attrs_and_docs(&it));
@ -174,7 +172,7 @@ fn add_missing_impl_members_inner(
Some(cap) => {
let mut cursor = Cursor::Before(first_new_item.syntax());
let placeholder;
if let ast::AssocItem::FnDef(func) = &first_new_item {
if let ast::AssocItem::Fn(func) = &first_new_item {
if let Some(m) = func.syntax().descendants().find_map(ast::MacroCall::cast) {
if m.syntax().text() == "todo!()" {
placeholder = m;
@ -192,7 +190,7 @@ fn add_missing_impl_members_inner(
})
}
fn add_body(fn_def: ast::FnDef) -> ast::FnDef {
fn add_body(fn_def: ast::Fn) -> ast::Fn {
if fn_def.body().is_some() {
return fn_def;
}

View file

@ -20,7 +20,7 @@ use test_utils::mark;
pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let ret_type = ctx.find_node_at_offset::<ast::RetType>()?;
// FIXME: extend to lambdas as well
let fn_def = ret_type.syntax().parent().and_then(ast::FnDef::cast)?;
let fn_def = ret_type.syntax().parent().and_then(ast::Fn::cast)?;
let type_ref = &ret_type.type_ref()?;
let ret_type_str = type_ref.syntax().text().to_string();

View file

@ -1,9 +1,7 @@
use ra_syntax::{
ast::{self, NameOwner, VisibilityOwner},
AstNode,
SyntaxKind::{
CONST_DEF, ENUM_DEF, FN_DEF, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY,
},
SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY},
T,
};
use test_utils::mark;
@ -38,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let (offset, target) = if let Some(keyword) = item_keyword {
let parent = keyword.parent();
let def_kws = vec![CONST_DEF, STATIC_DEF, FN_DEF, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF];
let def_kws = vec![CONST_DEF, STATIC_DEF, FN, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF];
// Parent is not a definition, can't add visibility
if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) {
return None;

View file

@ -8,7 +8,7 @@ use ra_syntax::{
make,
},
AstNode,
SyntaxKind::{FN_DEF, LOOP_EXPR, L_CURLY, R_CURLY, WHILE_EXPR, WHITESPACE},
SyntaxKind::{FN, LOOP_EXPR, L_CURLY, R_CURLY, WHILE_EXPR, WHITESPACE},
SyntaxNode,
};
@ -88,7 +88,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
let early_expression: ast::Expr = match parent_container.kind() {
WHILE_EXPR | LOOP_EXPR => make::expr_continue(),
FN_DEF => make::expr_return(),
FN => make::expr_return(),
_ => return None,
};

View file

@ -82,7 +82,7 @@ struct FunctionTemplate {
insert_offset: TextSize,
placeholder_expr: ast::MacroCall,
leading_ws: String,
fn_def: ast::FnDef,
fn_def: ast::Fn,
trailing_ws: String,
file: FileId,
}

View file

@ -160,7 +160,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Opti
fn has_new_fn(imp: &ast::ImplDef) -> bool {
if let Some(il) = imp.assoc_item_list() {
for item in il.assoc_items() {
if let ast::AssocItem::FnDef(f) = item {
if let ast::AssocItem::Fn(f) = item {
if let Some(name) = f.name() {
if name.text().eq_ignore_ascii_case("new") {
return true;

View file

@ -38,7 +38,7 @@ pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -
let lifetime_token = ctx
.find_token_at_offset(SyntaxKind::LIFETIME)
.filter(|lifetime| lifetime.text() == "'_")?;
if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::FnDef::cast) {
if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::Fn::cast) {
generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range())
} else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::ImplDef::cast) {
generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range())
@ -50,7 +50,7 @@ pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -
/// Generate the assist for the fn def case
fn generate_fn_def_assist(
acc: &mut Assists,
fn_def: &ast::FnDef,
fn_def: &ast::Fn,
lifetime_loc: TextRange,
) -> Option<()> {
let param_list: ast::ParamList = fn_def.param_list()?;

View file

@ -37,7 +37,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
let anchor = match_ast! {
match parent {
ast::FnDef(it) => it.body()?.syntax().clone().into(),
ast::Fn(it) => it.body()?.syntax().clone().into(),
ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(),
ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(),
ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),

View file

@ -66,13 +66,13 @@ pub fn get_missing_assoc_items(
if let Some(item_list) = impl_def.assoc_item_list() {
for item in item_list.assoc_items() {
match item {
ast::AssocItem::FnDef(f) => {
ast::AssocItem::Fn(f) => {
if let Some(n) = f.name() {
impl_fns_consts.insert(n.syntax().to_string());
}
}
ast::AssocItem::TypeAliasDef(t) => {
ast::AssocItem::TypeAlias(t) => {
if let Some(n) = t.name() {
impl_type.insert(n.syntax().to_string());
}

View file

@ -81,8 +81,8 @@ impl HasSource for EnumVariant {
}
}
impl HasSource for Function {
type Ast = ast::FnDef;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::FnDef> {
type Ast = ast::Fn;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::Fn> {
self.id.lookup(db.upcast()).source(db.upcast())
}
}
@ -105,8 +105,8 @@ impl HasSource for Trait {
}
}
impl HasSource for TypeAlias {
type Ast = ast::TypeAliasDef;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAliasDef> {
type Ast = ast::TypeAlias;
fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> {
self.id.lookup(db.upcast()).source(db.upcast())
}
}

View file

@ -582,10 +582,10 @@ to_def_impls![
(crate::Union, ast::UnionDef, union_to_def),
(crate::Trait, ast::TraitDef, trait_to_def),
(crate::ImplDef, ast::ImplDef, impl_to_def),
(crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def),
(crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
(crate::Const, ast::ConstDef, const_to_def),
(crate::Static, ast::StaticDef, static_to_def),
(crate::Function, ast::FnDef, fn_to_def),
(crate::Function, ast::Fn, fn_to_def),
(crate::Field, ast::RecordFieldDef, record_field_to_def),
(crate::Field, ast::TupleFieldDef, tuple_field_to_def),
(crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),

View file

@ -71,7 +71,7 @@ impl SourceToDefCtx<'_, '_> {
pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> {
self.to_def(src, keys::IMPL)
}
pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> {
pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> {
self.to_def(src, keys::FUNCTION)
}
pub(super) fn struct_to_def(&mut self, src: InFile<ast::StructDef>) -> Option<StructId> {
@ -89,10 +89,7 @@ impl SourceToDefCtx<'_, '_> {
pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> {
self.to_def(src, keys::CONST)
}
pub(super) fn type_alias_to_def(
&mut self,
src: InFile<ast::TypeAliasDef>,
) -> Option<TypeAliasId> {
pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
self.to_def(src, keys::TYPE_ALIAS)
}
pub(super) fn record_field_to_def(
@ -171,7 +168,7 @@ impl SourceToDefCtx<'_, '_> {
let def = self.impl_to_def(container.with_value(it))?;
def.into()
},
ast::FnDef(it) => {
ast::Fn(it) => {
let def = self.fn_to_def(container.with_value(it))?;
DefWithBodyId::from(def).into()
},
@ -195,7 +192,7 @@ impl SourceToDefCtx<'_, '_> {
let def = self.const_to_def(container.with_value(it))?;
DefWithBodyId::from(def).into()
},
ast::TypeAliasDef(it) => {
ast::TypeAlias(it) => {
let def = self.type_alias_to_def(container.with_value(it))?;
def.into()
},
@ -213,11 +210,11 @@ impl SourceToDefCtx<'_, '_> {
for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) {
let res: GenericDefId = match_ast! {
match (container.value) {
ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(),
ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(),
ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
_ => continue,
}
@ -233,7 +230,7 @@ impl SourceToDefCtx<'_, '_> {
match (container.value) {
ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(),
ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(),
ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(),
ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
_ => continue,
}
};

View file

@ -627,14 +627,14 @@ impl ExprCollector<'_> {
.items()
.filter_map(|item| {
let (def, name): (ModuleDefId, Option<ast::Name>) = match item {
ast::Item::FnDef(def) => {
ast::Item::Fn(def) => {
let id = self.find_inner_item(&def)?;
(
FunctionLoc { container: container.into(), id }.intern(self.db).into(),
def.name(),
)
}
ast::Item::TypeAliasDef(def) => {
ast::Item::TypeAlias(def) => {
let id = self.find_inner_item(&def)?;
(
TypeAliasLoc { container: container.into(), id }.intern(self.db).into(),

View file

@ -413,7 +413,7 @@ macro_rules! mod_items {
mod_items! {
Import in imports -> ast::Use,
ExternCrate in extern_crates -> ast::ExternCrate,
Function in functions -> ast::FnDef,
Function in functions -> ast::Fn,
Struct in structs -> ast::StructDef,
Union in unions -> ast::UnionDef,
Enum in enums -> ast::EnumDef,
@ -421,7 +421,7 @@ mod_items! {
Static in statics -> ast::StaticDef,
Trait in traits -> ast::TraitDef,
Impl in impls -> ast::ImplDef,
TypeAlias in type_aliases -> ast::TypeAliasDef,
TypeAlias in type_aliases -> ast::TypeAlias,
Mod in mods -> ast::Module,
MacroCall in macro_calls -> ast::MacroCall,
}
@ -505,7 +505,7 @@ pub struct Function {
pub params: Box<[TypeRef]>,
pub is_varargs: bool,
pub ret_type: TypeRef,
pub ast_id: FileAstId<ast::FnDef>,
pub ast_id: FileAstId<ast::Fn>,
}
#[derive(Debug, Clone, Eq, PartialEq)]
@ -592,7 +592,7 @@ pub struct TypeAlias {
pub bounds: Box<[TypeBound]>,
pub generic_params: GenericParamsId,
pub type_ref: Option<TypeRef>,
pub ast_id: FileAstId<ast::TypeAliasDef>,
pub ast_id: FileAstId<ast::TypeAlias>,
}
#[derive(Debug, Clone, Eq, PartialEq)]

View file

@ -78,8 +78,8 @@ impl Ctx {
ast::Item::StructDef(_)
| ast::Item::UnionDef(_)
| ast::Item::EnumDef(_)
| ast::Item::FnDef(_)
| ast::Item::TypeAliasDef(_)
| ast::Item::Fn(_)
| ast::Item::TypeAlias(_)
| ast::Item::ConstDef(_)
| ast::Item::StaticDef(_)
| ast::Item::MacroCall(_) => {
@ -103,8 +103,8 @@ impl Ctx {
ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into),
ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into),
ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into),
ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into),
ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into),
ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into),
ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()),
ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
@ -155,8 +155,8 @@ impl Ctx {
fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> {
match item {
ast::AssocItem::FnDef(ast) => self.lower_function(ast).map(Into::into),
ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into),
ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into),
ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()),
ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
}
@ -277,7 +277,7 @@ impl Ctx {
Some(res)
}
fn lower_function(&mut self, func: &ast::FnDef) -> Option<FileItemTreeId<Function>> {
fn lower_function(&mut self, func: &ast::Fn) -> Option<FileItemTreeId<Function>> {
let visibility = self.lower_visibility(func);
let name = func.name()?.as_name();
@ -348,7 +348,7 @@ impl Ctx {
fn lower_type_alias(
&mut self,
type_alias: &ast::TypeAliasDef,
type_alias: &ast::TypeAlias,
) -> Option<FileItemTreeId<TypeAlias>> {
let name = type_alias.name()?.as_name();
let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it));
@ -547,7 +547,7 @@ impl Ctx {
self.collect_inner_items(item.syntax());
let attrs = Attrs::new(&item, &self.hygiene);
let id: ModItem = match item {
ast::ExternItem::FnDef(ast) => {
ast::ExternItem::Fn(ast) => {
let func = self.lower_function(&ast)?;
self.data().functions[func.index].is_unsafe = true;
func.into()

View file

@ -236,13 +236,13 @@ fn smoke() {
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAliasDef>(8) }
> TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
> Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }]
> Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(10) }
> Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(10) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }]
> Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(11) }
> Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(11) }
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct0"))] }, input: None }]) }]
Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::StructDef>(3), kind: Unit }
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct1"))] }, input: None }]) }]
@ -275,12 +275,12 @@ fn simple_inner_items() {
top-level items:
Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) }
> Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) }
> Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
inner items:
for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(2):
Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) }
Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
"#]],
);
@ -303,9 +303,9 @@ fn extern_attrs() {
top-level items:
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }]
Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) }
Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }]
Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) }
Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
"##]],
);
}
@ -329,9 +329,9 @@ fn trait_attrs() {
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }]
Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(0) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) }
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) }
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
"##]],
);
}
@ -355,9 +355,9 @@ fn impl_attrs() {
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }]
Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) }
> Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
> #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) }
> Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) }
"##]],
);
}
@ -408,13 +408,13 @@ fn inner_item_attrs() {
inner attrs: Attrs { entries: None }
top-level items:
Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(0) }
Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(0) }
inner items:
for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(1):
#[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_inner"))] }, input: None }]) }]
Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) }
Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
"##]],
);

View file

@ -14,10 +14,10 @@ use crate::{
pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>;
pub const FUNCTION: Key<ast::FnDef, FunctionId> = Key::new();
pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new();
pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();

View file

@ -81,7 +81,7 @@ fn check_types_impl(ra_fixture: &str, display_source: bool) {
fn type_at_range(db: &TestDB, pos: FileRange) -> Ty {
let file = db.parse(pos.file_id).ok().unwrap();
let expr = algo::find_node_at_range::<ast::Expr>(file.syntax(), pos.range).unwrap();
let fn_def = expr.syntax().ancestors().find_map(ast::FnDef::cast).unwrap();
let fn_def = expr.syntax().ancestors().find_map(ast::Fn::cast).unwrap();
let module = db.module_for_file(pos.file_id);
let func = *module.child_by_source(db)[keys::FUNCTION]
.get(&InFile::new(pos.file_id.into(), fn_def))

View file

@ -59,7 +59,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio
if let Some(nav) = syntax.ancestors().find_map(|node| {
match_ast! {
match node {
ast::FnDef(it) => {
ast::Fn(it) => {
let def = sema.to_def(&it)?;
Some(def.to_nav(sema.db))
},
@ -181,8 +181,8 @@ fn caller() {
call<|>ee();
}
"#,
"callee FN_DEF FileId(1) 0..14 3..9",
&["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"],
"callee FN FileId(1) 0..14 3..9",
&["caller FN FileId(1) 15..44 18..24 : [33..39]"],
&[],
);
}
@ -197,8 +197,8 @@ fn caller() {
callee();
}
"#,
"callee FN_DEF FileId(1) 0..14 3..9",
&["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"],
"callee FN FileId(1) 0..14 3..9",
&["caller FN FileId(1) 15..44 18..24 : [33..39]"],
&[],
);
}
@ -214,8 +214,8 @@ fn caller() {
callee();
}
"#,
"callee FN_DEF FileId(1) 0..14 3..9",
&["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"],
"callee FN FileId(1) 0..14 3..9",
&["caller FN FileId(1) 15..58 18..24 : [33..39, 47..53]"],
&[],
);
}
@ -234,10 +234,10 @@ fn caller2() {
callee();
}
"#,
"callee FN_DEF FileId(1) 0..14 3..9",
"callee FN FileId(1) 0..14 3..9",
&[
"caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]",
"caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]",
"caller1 FN FileId(1) 15..45 18..25 : [34..40]",
"caller2 FN FileId(1) 47..77 50..57 : [66..72]",
],
&[],
);
@ -263,10 +263,10 @@ mod tests {
}
}
"#,
"callee FN_DEF FileId(1) 0..14 3..9",
"callee FN FileId(1) 0..14 3..9",
&[
"caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]",
"test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]",
"caller1 FN FileId(1) 15..45 18..25 : [34..40]",
"test_caller FN FileId(1) 95..149 110..121 : [134..140]",
],
&[],
);
@ -287,8 +287,8 @@ fn caller() {
//- /foo/mod.rs
pub fn callee() {}
"#,
"callee FN_DEF FileId(2) 0..18 7..13",
&["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"],
"callee FN FileId(2) 0..18 7..13",
&["caller FN FileId(1) 27..56 30..36 : [45..51]"],
&[],
);
}
@ -304,9 +304,9 @@ fn call<|>er() {
callee();
}
"#,
"caller FN_DEF FileId(1) 15..58 18..24",
"caller FN FileId(1) 15..58 18..24",
&[],
&["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"],
&["callee FN FileId(1) 0..14 3..9 : [33..39, 47..53]"],
);
}
@ -325,9 +325,9 @@ fn call<|>er() {
//- /foo/mod.rs
pub fn callee() {}
"#,
"caller FN_DEF FileId(1) 27..56 30..36",
"caller FN FileId(1) 27..56 30..36",
&[],
&["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"],
&["callee FN FileId(2) 0..18 7..13 : [45..51]"],
);
}
@ -348,9 +348,9 @@ fn caller3() {
}
"#,
"caller2 FN_DEF FileId(1) 33..64 36..43",
&["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"],
&["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"],
"caller2 FN FileId(1) 33..64 36..43",
&["caller1 FN FileId(1) 0..31 3..10 : [19..26]"],
&["caller3 FN FileId(1) 66..83 69..76 : [52..59]"],
);
}
@ -368,9 +368,9 @@ fn main() {
a<|>()
}
"#,
"a FN_DEF FileId(1) 0..18 3..4",
&["main FN_DEF FileId(1) 31..52 34..38 : [47..48]"],
&["b FN_DEF FileId(1) 20..29 23..24 : [13..14]"],
"a FN FileId(1) 0..18 3..4",
&["main FN FileId(1) 31..52 34..38 : [47..48]"],
&["b FN FileId(1) 20..29 23..24 : [13..14]"],
);
check_hierarchy(
@ -385,8 +385,8 @@ fn main() {
a()
}
"#,
"b FN_DEF FileId(1) 20..29 23..24",
&["a FN_DEF FileId(1) 0..18 3..4 : [13..14]"],
"b FN FileId(1) 20..29 23..24",
&["a FN FileId(1) 0..18 3..4 : [13..14]"],
&[],
);
}

View file

@ -19,8 +19,8 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
let mut params = FxHashMap::default();
let me = ctx.token.ancestors().find_map(ast::FnDef::cast);
let mut process_fn = |func: ast::FnDef| {
let me = ctx.token.ancestors().find_map(ast::Fn::cast);
let mut process_fn = |func: ast::Fn| {
if Some(&func) == me.as_ref() {
return;
}
@ -34,15 +34,15 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
match_ast! {
match node {
ast::SourceFile(it) => it.items().filter_map(|item| match item {
ast::Item::FnDef(it) => Some(it),
ast::Item::Fn(it) => Some(it),
_ => None,
}).for_each(&mut process_fn),
ast::ItemList(it) => it.items().filter_map(|item| match item {
ast::Item::FnDef(it) => Some(it),
ast::Item::Fn(it) => Some(it),
_ => None,
}).for_each(&mut process_fn),
ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item {
ast::AssocItem::FnDef(it) => Some(it),
ast::AssocItem::Fn(it) => Some(it),
_ => None,
}).for_each(&mut process_fn),
_ => continue,

View file

@ -169,7 +169,7 @@ fn add_keyword(ctx: &CompletionContext, acc: &mut Completions, kw: &str, snippet
fn complete_return(
ctx: &CompletionContext,
fn_def: &ast::FnDef,
fn_def: &ast::Fn,
can_be_stmt: bool,
) -> Option<CompletionItem> {
let snip = match (can_be_stmt, fn_def.ret_type().is_some()) {

View file

@ -2,7 +2,7 @@
//!
//! This module adds the completion items related to implementing associated
//! items within a `impl Trait for Struct` block. The current context node
//! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node
//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node
//! and an direct child of an `IMPL_DEF`.
//!
//! # Examples
@ -63,7 +63,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
}
}),
SyntaxKind::FN_DEF => {
SyntaxKind::FN => {
for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
.into_iter()
.filter_map(|item| match item {
@ -75,7 +75,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
}
}
SyntaxKind::TYPE_ALIAS_DEF => {
SyntaxKind::TYPE_ALIAS => {
for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def)
.into_iter()
.filter_map(|item| match item {
@ -106,8 +106,8 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
SyntaxKind::FN_DEF
| SyntaxKind::TYPE_ALIAS_DEF
SyntaxKind::FN
| SyntaxKind::TYPE_ALIAS
| SyntaxKind::CONST_DEF
| SyntaxKind::BLOCK_EXPR => Some((p, 2)),
SyntaxKind::NAME_REF => Some((p, 5)),

View file

@ -35,7 +35,7 @@ pub(crate) struct CompletionContext<'a> {
pub(super) krate: Option<hir::Crate>,
pub(super) expected_type: Option<Type>,
pub(super) name_ref_syntax: Option<ast::NameRef>,
pub(super) function_syntax: Option<ast::FnDef>,
pub(super) function_syntax: Option<ast::Fn>,
pub(super) use_item_syntax: Option<ast::Use>,
pub(super) record_lit_syntax: Option<ast::RecordLit>,
pub(super) record_pat_syntax: Option<ast::RecordPat>,
@ -349,7 +349,7 @@ impl<'a> CompletionContext<'a> {
.sema
.ancestors_with_macros(self.token.parent())
.take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
.find_map(ast::FnDef::cast);
.find_map(ast::Fn::cast);
self.record_field_syntax = self
.sema

View file

@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {
NodeOrToken::Token(token) => token.parent(),
};
for node in leaf.ancestors() {
if node.kind() == FN_DEF || node.kind() == LAMBDA_EXPR {
if node.kind() == FN || node.kind() == LAMBDA_EXPR {
break;
}
let loop_body = match_ast! {

View file

@ -16,7 +16,7 @@ pub use navigation_target::NavigationTarget;
pub(crate) use navigation_target::{ToNav, TryToNav};
pub(crate) use short_label::ShortLabel;
pub(crate) fn function_declaration(node: &ast::FnDef) -> String {
pub(crate) fn function_declaration(node: &ast::Fn) -> String {
let mut buf = String::new();
if let Some(vis) = node.visibility() {
format_to!(buf, "{} ", vis);
@ -65,7 +65,7 @@ pub(crate) fn const_label(node: &ast::ConstDef) -> String {
label.trim().to_owned()
}
pub(crate) fn type_label(node: &ast::TypeAliasDef) -> String {
pub(crate) fn type_label(node: &ast::TypeAlias) -> String {
let label: String = node
.syntax()
.children_with_tokens()

View file

@ -379,12 +379,12 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
match_ast! {
match node {
ast::FnDef(it) => it.doc_comment_text(),
ast::Fn(it) => it.doc_comment_text(),
ast::StructDef(it) => it.doc_comment_text(),
ast::EnumDef(it) => it.doc_comment_text(),
ast::TraitDef(it) => it.doc_comment_text(),
ast::Module(it) => it.doc_comment_text(),
ast::TypeAliasDef(it) => it.doc_comment_text(),
ast::TypeAlias(it) => it.doc_comment_text(),
ast::ConstDef(it) => it.doc_comment_text(),
ast::StaticDef(it) => it.doc_comment_text(),
ast::RecordFieldDef(it) => it.doc_comment_text(),
@ -404,12 +404,12 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
match_ast! {
match node {
ast::FnDef(it) => it.short_label(),
ast::Fn(it) => it.short_label(),
ast::StructDef(it) => it.short_label(),
ast::EnumDef(it) => it.short_label(),
ast::TraitDef(it) => it.short_label(),
ast::Module(it) => it.short_label(),
ast::TypeAliasDef(it) => it.short_label(),
ast::TypeAlias(it) => it.short_label(),
ast::ConstDef(it) => it.short_label(),
ast::StaticDef(it) => it.short_label(),
ast::RecordFieldDef(it) => it.short_label(),

View file

@ -7,7 +7,7 @@ pub(crate) trait ShortLabel {
fn short_label(&self) -> Option<String>;
}
impl ShortLabel for ast::FnDef {
impl ShortLabel for ast::Fn {
fn short_label(&self) -> Option<String> {
Some(crate::display::function_declaration(self))
}
@ -47,7 +47,7 @@ impl ShortLabel for ast::Module {
}
}
impl ShortLabel for ast::TypeAliasDef {
impl ShortLabel for ast::TypeAlias {
fn short_label(&self) -> Option<String> {
short_label_from_node(self, "type ")
}

View file

@ -111,7 +111,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
match_ast! {
match node {
ast::FnDef(it) => {
ast::Fn(it) => {
let mut detail = String::from("fn");
if let Some(type_param_list) = it.type_param_list() {
collapse_ws(type_param_list.syntax(), &mut detail);
@ -132,7 +132,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
ast::EnumVariant(it) => decl(it),
ast::TraitDef(it) => decl(it),
ast::Module(it) => decl(it),
ast::TypeAliasDef(it) => {
ast::TypeAlias(it) => {
let ty = it.type_ref();
decl_with_type_ref(it, ty)
},
@ -271,7 +271,7 @@ fn very_obsolete() {}
label: "bar1",
navigation_range: 43..47,
node_range: 40..52,
kind: FN_DEF,
kind: FN,
detail: Some(
"fn()",
),
@ -284,7 +284,7 @@ fn very_obsolete() {}
label: "bar2",
navigation_range: 60..64,
node_range: 57..81,
kind: FN_DEF,
kind: FN,
detail: Some(
"fn<T>(t: T) -> T",
),
@ -297,7 +297,7 @@ fn very_obsolete() {}
label: "bar3",
navigation_range: 89..93,
node_range: 86..156,
kind: FN_DEF,
kind: FN,
detail: Some(
"fn<A, B>(a: A, b: B) -> Vec< u32 >",
),
@ -339,7 +339,7 @@ fn very_obsolete() {}
label: "T",
navigation_range: 186..187,
node_range: 181..193,
kind: TYPE_ALIAS_DEF,
kind: TYPE_ALIAS,
detail: Some(
"()",
),
@ -417,7 +417,7 @@ fn very_obsolete() {}
label: "obsolete",
navigation_range: 428..436,
node_range: 411..441,
kind: FN_DEF,
kind: FN,
detail: Some(
"fn()",
),
@ -428,7 +428,7 @@ fn very_obsolete() {}
label: "very_obsolete",
navigation_range: 481..494,
node_range: 443..499,
kind: FN_DEF,
kind: FN,
detail: Some(
"fn()",
),

View file

@ -1361,7 +1361,7 @@ fn foo_<|>test() {}
11..19,
),
name: "foo_test",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,

View file

@ -376,7 +376,7 @@ impl Foo {
}
"#,
);
check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]);
check_result(refs, "f FN FileId(1) 27..43 30..31 Other", &[]);
}
#[test]
@ -514,7 +514,7 @@ pub(super) struct Foo<|> {
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
check_result(
refs,
"quux FN_DEF FileId(1) 19..35 26..30 Other",
"quux FN FileId(1) 19..35 26..30 Other",
&["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"],
);
@ -522,7 +522,7 @@ pub(super) struct Foo<|> {
analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap();
check_result(
refs,
"quux FN_DEF FileId(1) 19..35 26..30 Other",
"quux FN FileId(1) 19..35 26..30 Other",
&["FileId(3) 16..20 StructLiteral"],
);
}
@ -619,7 +619,7 @@ fn main() {
);
check_result(
refs,
"new FN_DEF FileId(1) 54..101 61..64 Other",
"new FN FileId(1) 54..101 61..64 Other",
&["FileId(1) 146..149 StructLiteral"],
);
}
@ -646,7 +646,7 @@ fn main() {
let refs = analysis.find_all_refs(pos, None).unwrap().unwrap();
check_result(
refs,
"f FN_DEF FileId(1) 26..35 29..30 Other",
"f FN FileId(1) 26..35 29..30 Other",
&["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"],
);
}

View file

@ -149,7 +149,7 @@ fn rename_to_self(
let source_file = sema.parse(position.file_id);
let syn = source_file.syntax();
let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?;
let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?;
let params = fn_def.param_list()?;
if params.self_param().is_some() {
return None; // method already has self param
@ -221,7 +221,7 @@ fn rename_self_to_param(
let syn = source_file.syntax();
let text = sema.db.file_text(position.file_id);
let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?;
let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?;
let search_range = fn_def.syntax().text_range();
let mut edits: Vec<SourceFileEdit> = vec![];

View file

@ -102,7 +102,7 @@ pub(crate) fn runnable(
) -> Option<Runnable> {
match_ast! {
match item {
ast::FnDef(it) => runnable_fn(sema, it, file_id),
ast::Fn(it) => runnable_fn(sema, it, file_id),
ast::Module(it) => runnable_mod(sema, it, file_id),
_ => None,
}
@ -111,7 +111,7 @@ pub(crate) fn runnable(
fn runnable_fn(
sema: &Semantics<RootDatabase>,
fn_def: ast::FnDef,
fn_def: ast::Fn,
file_id: FileId,
) -> Option<Runnable> {
let name_string = fn_def.name()?.text().to_string();
@ -188,7 +188,7 @@ pub struct TestAttr {
}
impl TestAttr {
fn from_fn(fn_def: &ast::FnDef) -> TestAttr {
fn from_fn(fn_def: &ast::Fn) -> TestAttr {
let ignore = fn_def
.attrs()
.filter_map(|attr| attr.simple_name())
@ -203,7 +203,7 @@ impl TestAttr {
///
/// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test,
/// but it's better than not to have the runnables for the tests at all.
fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool {
fn has_test_related_attribute(fn_def: &ast::Fn) -> bool {
fn_def
.attrs()
.filter_map(|attr| attr.path())
@ -211,7 +211,7 @@ fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool {
.any(|attribute_text| attribute_text.contains("test"))
}
fn has_doc_test(fn_def: &ast::FnDef) -> bool {
fn has_doc_test(fn_def: &ast::Fn) -> bool {
fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```"))
}
@ -246,7 +246,7 @@ fn has_test_function_or_multiple_test_submodules(module: &ast::Module) -> bool {
for item in item_list.items() {
match item {
ast::Item::FnDef(f) => {
ast::Item::Fn(f) => {
if has_test_related_attribute(&f) {
return true;
}
@ -320,7 +320,7 @@ fn bench() {}
4..8,
),
name: "main",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -338,7 +338,7 @@ fn bench() {}
26..34,
),
name: "test_foo",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -363,7 +363,7 @@ fn bench() {}
62..70,
),
name: "test_foo",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -388,7 +388,7 @@ fn bench() {}
89..94,
),
name: "bench",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -431,7 +431,7 @@ fn foo() {}
4..8,
),
name: "main",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -447,7 +447,7 @@ fn foo() {}
full_range: 15..57,
focus_range: None,
name: "foo",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -493,7 +493,7 @@ impl Data {
4..8,
),
name: "main",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -509,7 +509,7 @@ impl Data {
full_range: 44..98,
focus_range: None,
name: "foo",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -570,7 +570,7 @@ mod test_mod {
35..44,
),
name: "test_foo1",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -670,7 +670,7 @@ mod root_tests {
107..121,
),
name: "nested_test_11",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -695,7 +695,7 @@ mod root_tests {
163..177,
),
name: "nested_test_12",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -740,7 +740,7 @@ mod root_tests {
258..271,
),
name: "nested_test_2",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -783,7 +783,7 @@ fn test_foo1() {}
36..45,
),
name: "test_foo1",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,
@ -831,7 +831,7 @@ fn test_foo1() {}
58..67,
),
name: "test_foo1",
kind: FN_DEF,
kind: FN,
container_name: None,
description: None,
docs: None,

View file

@ -464,7 +464,7 @@ fn highlight_element(
let db = sema.db;
let mut binding_hash = None;
let highlight: Highlight = match element.kind() {
FN_DEF => {
FN => {
bindings_shadow_count.clear();
return None;
}
@ -709,11 +709,11 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
ENUM_DEF => HighlightTag::Enum,
UNION_DEF => HighlightTag::Union,
TRAIT_DEF => HighlightTag::Trait,
TYPE_ALIAS_DEF => HighlightTag::TypeAlias,
TYPE_ALIAS => HighlightTag::TypeAlias,
TYPE_PARAM => HighlightTag::TypeParam,
RECORD_FIELD_DEF => HighlightTag::Field,
MODULE => HighlightTag::Module,
FN_DEF => HighlightTag::Function,
FN => HighlightTag::Function,
CONST_DEF => HighlightTag::Constant,
STATIC_DEF => HighlightTag::Static,
ENUM_VARIANT => HighlightTag::EnumVariant,

View file

@ -116,7 +116,7 @@ mod tests {
syn.trim(),
r#"
SOURCE_FILE@0..11
FN_DEF@0..11
FN@0..11
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -148,7 +148,7 @@ fn test() {
syn.trim(),
r#"
SOURCE_FILE@0..60
FN_DEF@0..60
FN@0..60
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7
@ -190,7 +190,7 @@ SOURCE_FILE@0..60
assert_eq_text!(
syn.trim(),
r#"
FN_DEF@0..11
FN@0..11
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -258,7 +258,7 @@ fn bar() {
syn.trim(),
r#"
SOURCE_FILE@0..12
FN_DEF@0..12
FN@0..12
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -292,7 +292,7 @@ fn bar() {
syn.trim(),
r#"
SOURCE_FILE@0..12
FN_DEF@0..12
FN@0..12
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -325,7 +325,7 @@ fn bar() {
syn.trim(),
r#"
SOURCE_FILE@0..25
FN_DEF@0..12
FN@0..12
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -339,7 +339,7 @@ SOURCE_FILE@0..25
WHITESPACE@10..11 "\n"
R_CURLY@11..12 "}"
WHITESPACE@12..13 "\n"
FN_DEF@13..25
FN@13..25
FN_KW@13..15 "fn"
WHITESPACE@15..16 " "
NAME@16..19

View file

@ -174,7 +174,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
let def: hir::EnumVariant = sema.to_def(&it)?;
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
},
ast::FnDef(it) => {
ast::Fn(it) => {
let def: hir::Function = sema.to_def(&it)?;
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
},
@ -182,7 +182,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
let def: hir::Const = sema.to_def(&it)?;
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
},
ast::TypeAliasDef(it) => {
ast::TypeAlias(it) => {
let def: hir::TypeAlias = sema.to_def(&it)?;
Some(NameClass::Definition(Definition::ModuleDef(def.into())))
},

View file

@ -344,7 +344,7 @@ impl Query {
}
fn is_type(kind: SyntaxKind) -> bool {
matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF)
matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS)
}
/// The actual data that is stored in the index. It should be as compact as
@ -397,12 +397,12 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
}
match_ast! {
match node {
ast::FnDef(it) => decl(it),
ast::Fn(it) => decl(it),
ast::StructDef(it) => decl(it),
ast::EnumDef(it) => decl(it),
ast::TraitDef(it) => decl(it),
ast::Module(it) => decl(it),
ast::TypeAliasDef(it) => decl(it),
ast::TypeAlias(it) => decl(it),
ast::ConstDef(it) => decl(it),
ast::StaticDef(it) => decl(it),
ast::MacroCall(it) => {

View file

@ -258,7 +258,7 @@ fn test_expr_order() {
assert_eq_text!(
dump.trim(),
r#"MACRO_ITEMS@0..15
FN_DEF@0..15
FN@0..15
FN_KW@0..2 "fn"
NAME@2..5
IDENT@2..5 "bar"

View file

@ -180,7 +180,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
// unsafe const fn bar() {}
T![fn] => {
fn_def(p);
m.complete(p, FN_DEF);
m.complete(p, FN);
}
// test unsafe_trait
@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) {
types::type_(p);
}
p.expect(T![;]);
m.complete(p, TYPE_ALIAS_DEF);
m.complete(p, TYPE_ALIAS);
}
pub(crate) fn mod_item(p: &mut Parser, m: Marker) {

View file

@ -126,7 +126,7 @@ pub enum SyntaxKind {
STRUCT_DEF,
UNION_DEF,
ENUM_DEF,
FN_DEF,
FN,
RET_TYPE,
EXTERN_CRATE,
MODULE,
@ -135,7 +135,7 @@ pub enum SyntaxKind {
CONST_DEF,
TRAIT_DEF,
IMPL_DEF,
TYPE_ALIAS_DEF,
TYPE_ALIAS,
MACRO_CALL,
TOKEN_TREE,
MACRO_DEF,

View file

@ -29,9 +29,9 @@ impl ast::BinExpr {
}
}
impl ast::FnDef {
impl ast::Fn {
#[must_use]
pub fn with_body(&self, body: ast::BlockExpr) -> ast::FnDef {
pub fn with_body(&self, body: ast::BlockExpr) -> ast::Fn {
let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new();
let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() {
old_body.syntax().clone().into()
@ -192,9 +192,9 @@ impl ast::RecordFieldList {
}
}
impl ast::TypeAliasDef {
impl ast::TypeAlias {
#[must_use]
pub fn remove_bounds(&self) -> ast::TypeAliasDef {
pub fn remove_bounds(&self) -> ast::TypeAlias {
let colon = match self.colon_token() {
Some(it) => it,
None => return self.clone(),

View file

@ -401,7 +401,7 @@ impl ast::BlockExpr {
Some(it) => it,
None => return true,
};
!matches!(parent.kind(), FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR)
!matches!(parent.kind(), FN | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR)
}
}

View file

@ -79,19 +79,19 @@ impl ExternCrate {
pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct FnDef {
pub struct Fn {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for FnDef {}
impl ast::NameOwner for FnDef {}
impl ast::VisibilityOwner for FnDef {}
impl ast::TypeParamsOwner for FnDef {}
impl FnDef {
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
impl ast::AttrsOwner for Fn {}
impl ast::NameOwner for Fn {}
impl ast::VisibilityOwner for Fn {}
impl ast::TypeParamsOwner for Fn {}
impl Fn {
pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
@ -183,15 +183,15 @@ impl TraitDef {
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TypeAliasDef {
pub struct TypeAlias {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for TypeAliasDef {}
impl ast::NameOwner for TypeAliasDef {}
impl ast::VisibilityOwner for TypeAliasDef {}
impl ast::TypeParamsOwner for TypeAliasDef {}
impl ast::TypeBoundsOwner for TypeAliasDef {}
impl TypeAliasDef {
impl ast::AttrsOwner for TypeAlias {}
impl ast::NameOwner for TypeAlias {}
impl ast::VisibilityOwner for TypeAlias {}
impl ast::TypeParamsOwner for TypeAlias {}
impl ast::TypeBoundsOwner for TypeAlias {}
impl TypeAlias {
pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
@ -303,7 +303,9 @@ impl UseTreeList {
pub struct Abi {
pub(crate) syntax: SyntaxNode,
}
impl Abi {}
impl Abi {
pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TypeParamList {
pub(crate) syntax: SyntaxNode,
@ -321,8 +323,9 @@ pub struct ParamList {
}
impl ParamList {
pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@ -355,6 +358,39 @@ impl BlockExpr {
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Param {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for Param {}
impl ast::TypeAscriptionOwner for Param {}
impl Param {
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SelfParam {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for SelfParam {}
impl ast::TypeAscriptionOwner for SelfParam {}
impl SelfParam {
pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
pub fn lifetime_token(&self) -> Option<SyntaxToken> {
support::token(&self.syntax, T![lifetime])
}
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TypeBoundList {
pub(crate) syntax: SyntaxNode,
}
impl TypeBoundList {
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RecordFieldDefList {
pub(crate) syntax: SyntaxNode,
}
@ -415,13 +451,6 @@ impl EnumVariant {
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TypeBoundList {
pub(crate) syntax: SyntaxNode,
}
impl TypeBoundList {
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct AssocItemList {
pub(crate) syntax: SyntaxNode,
}
@ -1173,32 +1202,6 @@ impl LetStmt {
pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct SelfParam {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for SelfParam {}
impl ast::TypeAscriptionOwner for SelfParam {}
impl SelfParam {
pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
pub fn lifetime_token(&self) -> Option<SyntaxToken> {
support::token(&self.syntax, T![lifetime])
}
pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Param {
pub(crate) syntax: SyntaxNode,
}
impl ast::AttrsOwner for Param {}
impl ast::TypeAscriptionOwner for Param {}
impl Param {
pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PathSegment {
pub(crate) syntax: SyntaxNode,
}
@ -1274,14 +1277,14 @@ pub enum Item {
EnumDef(EnumDef),
ExternBlock(ExternBlock),
ExternCrate(ExternCrate),
FnDef(FnDef),
Fn(Fn),
ImplDef(ImplDef),
MacroCall(MacroCall),
Module(Module),
StaticDef(StaticDef),
StructDef(StructDef),
TraitDef(TraitDef),
TypeAliasDef(TypeAliasDef),
TypeAlias(TypeAlias),
UnionDef(UnionDef),
Use(Use),
}
@ -1303,6 +1306,24 @@ pub enum TypeRef {
DynTraitType(DynTraitType),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Pat {
OrPat(OrPat),
ParenPat(ParenPat),
RefPat(RefPat),
BoxPat(BoxPat),
BindPat(BindPat),
PlaceholderPat(PlaceholderPat),
DotDotPat(DotDotPat),
PathPat(PathPat),
RecordPat(RecordPat),
TupleStructPat(TupleStructPat),
TuplePat(TuplePat),
SlicePat(SlicePat),
RangePat(RangePat),
LiteralPat(LiteralPat),
MacroPat(MacroPat),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FieldDefList {
RecordFieldDefList(RecordFieldDefList),
TupleFieldDefList(TupleFieldDefList),
@ -1343,32 +1364,14 @@ pub enum Expr {
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum AssocItem {
FnDef(FnDef),
TypeAliasDef(TypeAliasDef),
Fn(Fn),
TypeAlias(TypeAlias),
ConstDef(ConstDef),
MacroCall(MacroCall),
}
impl ast::AttrsOwner for AssocItem {}
impl ast::NameOwner for AssocItem {}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Pat {
OrPat(OrPat),
ParenPat(ParenPat),
RefPat(RefPat),
BoxPat(BoxPat),
BindPat(BindPat),
PlaceholderPat(PlaceholderPat),
DotDotPat(DotDotPat),
PathPat(PathPat),
RecordPat(RecordPat),
TupleStructPat(TupleStructPat),
TuplePat(TuplePat),
SlicePat(SlicePat),
RangePat(RangePat),
LiteralPat(LiteralPat),
MacroPat(MacroPat),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Stmt {
LetStmt(LetStmt),
ExprStmt(ExprStmt),
@ -1381,7 +1384,7 @@ pub enum AttrInput {
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ExternItem {
FnDef(FnDef),
Fn(Fn),
StaticDef(StaticDef),
}
impl ast::AttrsOwner for ExternItem {}
@ -1463,8 +1466,8 @@ impl AstNode for ExternCrate {
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for FnDef {
fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF }
impl AstNode for Fn {
fn can_cast(kind: SyntaxKind) -> bool { kind == FN }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
@ -1540,8 +1543,8 @@ impl AstNode for TraitDef {
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for TypeAliasDef {
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF }
impl AstNode for TypeAlias {
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
@ -1727,6 +1730,39 @@ impl AstNode for BlockExpr {
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for Param {
fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for SelfParam {
fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for TypeBoundList {
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for RecordFieldDefList {
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> {
@ -1793,17 +1829,6 @@ impl AstNode for EnumVariant {
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for TypeBoundList {
fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for AssocItemList {
fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> {
@ -2673,28 +2698,6 @@ impl AstNode for LetStmt {
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for SelfParam {
fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for Param {
fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) {
Some(Self { syntax })
} else {
None
}
}
fn syntax(&self) -> &SyntaxNode { &self.syntax }
}
impl AstNode for PathSegment {
fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
fn cast(syntax: SyntaxNode) -> Option<Self> {
@ -2784,8 +2787,8 @@ impl From<ExternBlock> for Item {
impl From<ExternCrate> for Item {
fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) }
}
impl From<FnDef> for Item {
fn from(node: FnDef) -> Item { Item::FnDef(node) }
impl From<Fn> for Item {
fn from(node: Fn) -> Item { Item::Fn(node) }
}
impl From<ImplDef> for Item {
fn from(node: ImplDef) -> Item { Item::ImplDef(node) }
@ -2805,8 +2808,8 @@ impl From<StructDef> for Item {
impl From<TraitDef> for Item {
fn from(node: TraitDef) -> Item { Item::TraitDef(node) }
}
impl From<TypeAliasDef> for Item {
fn from(node: TypeAliasDef) -> Item { Item::TypeAliasDef(node) }
impl From<TypeAlias> for Item {
fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
}
impl From<UnionDef> for Item {
fn from(node: UnionDef) -> Item { Item::UnionDef(node) }
@ -2817,10 +2820,8 @@ impl From<Use> for Item {
impl AstNode for Item {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL
| MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | USE => {
true
}
CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL
| MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true,
_ => false,
}
}
@ -2830,14 +2831,14 @@ impl AstNode for Item {
ENUM_DEF => Item::EnumDef(EnumDef { syntax }),
EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
FN_DEF => Item::FnDef(FnDef { syntax }),
FN => Item::Fn(Fn { syntax }),
IMPL_DEF => Item::ImplDef(ImplDef { syntax }),
MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
MODULE => Item::Module(Module { syntax }),
STATIC_DEF => Item::StaticDef(StaticDef { syntax }),
STRUCT_DEF => Item::StructDef(StructDef { syntax }),
TRAIT_DEF => Item::TraitDef(TraitDef { syntax }),
TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }),
TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
UNION_DEF => Item::UnionDef(UnionDef { syntax }),
USE => Item::Use(Use { syntax }),
_ => return None,
@ -2850,14 +2851,14 @@ impl AstNode for Item {
Item::EnumDef(it) => &it.syntax,
Item::ExternBlock(it) => &it.syntax,
Item::ExternCrate(it) => &it.syntax,
Item::FnDef(it) => &it.syntax,
Item::Fn(it) => &it.syntax,
Item::ImplDef(it) => &it.syntax,
Item::MacroCall(it) => &it.syntax,
Item::Module(it) => &it.syntax,
Item::StaticDef(it) => &it.syntax,
Item::StructDef(it) => &it.syntax,
Item::TraitDef(it) => &it.syntax,
Item::TypeAliasDef(it) => &it.syntax,
Item::TypeAlias(it) => &it.syntax,
Item::UnionDef(it) => &it.syntax,
Item::Use(it) => &it.syntax,
}
@ -2948,6 +2949,101 @@ impl AstNode for TypeRef {
}
}
}
impl From<OrPat> for Pat {
fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
}
impl From<ParenPat> for Pat {
fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
}
impl From<RefPat> for Pat {
fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
}
impl From<BoxPat> for Pat {
fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
}
impl From<BindPat> for Pat {
fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
}
impl From<PlaceholderPat> for Pat {
fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
}
impl From<DotDotPat> for Pat {
fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
}
impl From<PathPat> for Pat {
fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
}
impl From<RecordPat> for Pat {
fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
}
impl From<TupleStructPat> for Pat {
fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
}
impl From<TuplePat> for Pat {
fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
}
impl From<SlicePat> for Pat {
fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
}
impl From<RangePat> for Pat {
fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
}
impl From<LiteralPat> for Pat {
fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
}
impl From<MacroPat> for Pat {
fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
}
impl AstNode for Pat {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
| PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
| LITERAL_PAT | MACRO_PAT => true,
_ => false,
}
}
fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() {
OR_PAT => Pat::OrPat(OrPat { syntax }),
PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
REF_PAT => Pat::RefPat(RefPat { syntax }),
BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
BIND_PAT => Pat::BindPat(BindPat { syntax }),
PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
PATH_PAT => Pat::PathPat(PathPat { syntax }),
RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
RANGE_PAT => Pat::RangePat(RangePat { syntax }),
LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
_ => return None,
};
Some(res)
}
fn syntax(&self) -> &SyntaxNode {
match self {
Pat::OrPat(it) => &it.syntax,
Pat::ParenPat(it) => &it.syntax,
Pat::RefPat(it) => &it.syntax,
Pat::BoxPat(it) => &it.syntax,
Pat::BindPat(it) => &it.syntax,
Pat::PlaceholderPat(it) => &it.syntax,
Pat::DotDotPat(it) => &it.syntax,
Pat::PathPat(it) => &it.syntax,
Pat::RecordPat(it) => &it.syntax,
Pat::TupleStructPat(it) => &it.syntax,
Pat::TuplePat(it) => &it.syntax,
Pat::SlicePat(it) => &it.syntax,
Pat::RangePat(it) => &it.syntax,
Pat::LiteralPat(it) => &it.syntax,
Pat::MacroPat(it) => &it.syntax,
}
}
}
impl From<RecordFieldDefList> for FieldDefList {
fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) }
}
@ -3157,11 +3253,11 @@ impl AstNode for Expr {
}
}
}
impl From<FnDef> for AssocItem {
fn from(node: FnDef) -> AssocItem { AssocItem::FnDef(node) }
impl From<Fn> for AssocItem {
fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
}
impl From<TypeAliasDef> for AssocItem {
fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) }
impl From<TypeAlias> for AssocItem {
fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
}
impl From<ConstDef> for AssocItem {
fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
@ -3172,14 +3268,14 @@ impl From<MacroCall> for AssocItem {
impl AstNode for AssocItem {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
FN_DEF | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true,
FN | TYPE_ALIAS | CONST_DEF | MACRO_CALL => true,
_ => false,
}
}
fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() {
FN_DEF => AssocItem::FnDef(FnDef { syntax }),
TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
FN => AssocItem::Fn(Fn { syntax }),
TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
_ => return None,
@ -3188,108 +3284,13 @@ impl AstNode for AssocItem {
}
fn syntax(&self) -> &SyntaxNode {
match self {
AssocItem::FnDef(it) => &it.syntax,
AssocItem::TypeAliasDef(it) => &it.syntax,
AssocItem::Fn(it) => &it.syntax,
AssocItem::TypeAlias(it) => &it.syntax,
AssocItem::ConstDef(it) => &it.syntax,
AssocItem::MacroCall(it) => &it.syntax,
}
}
}
impl From<OrPat> for Pat {
fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
}
impl From<ParenPat> for Pat {
fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
}
impl From<RefPat> for Pat {
fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
}
impl From<BoxPat> for Pat {
fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
}
impl From<BindPat> for Pat {
fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
}
impl From<PlaceholderPat> for Pat {
fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
}
impl From<DotDotPat> for Pat {
fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
}
impl From<PathPat> for Pat {
fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
}
impl From<RecordPat> for Pat {
fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
}
impl From<TupleStructPat> for Pat {
fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
}
impl From<TuplePat> for Pat {
fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
}
impl From<SlicePat> for Pat {
fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
}
impl From<RangePat> for Pat {
fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
}
impl From<LiteralPat> for Pat {
fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
}
impl From<MacroPat> for Pat {
fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
}
impl AstNode for Pat {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
| PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
| LITERAL_PAT | MACRO_PAT => true,
_ => false,
}
}
fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() {
OR_PAT => Pat::OrPat(OrPat { syntax }),
PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
REF_PAT => Pat::RefPat(RefPat { syntax }),
BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
BIND_PAT => Pat::BindPat(BindPat { syntax }),
PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
PATH_PAT => Pat::PathPat(PathPat { syntax }),
RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
RANGE_PAT => Pat::RangePat(RangePat { syntax }),
LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
_ => return None,
};
Some(res)
}
fn syntax(&self) -> &SyntaxNode {
match self {
Pat::OrPat(it) => &it.syntax,
Pat::ParenPat(it) => &it.syntax,
Pat::RefPat(it) => &it.syntax,
Pat::BoxPat(it) => &it.syntax,
Pat::BindPat(it) => &it.syntax,
Pat::PlaceholderPat(it) => &it.syntax,
Pat::DotDotPat(it) => &it.syntax,
Pat::PathPat(it) => &it.syntax,
Pat::RecordPat(it) => &it.syntax,
Pat::TupleStructPat(it) => &it.syntax,
Pat::TuplePat(it) => &it.syntax,
Pat::SlicePat(it) => &it.syntax,
Pat::RangePat(it) => &it.syntax,
Pat::LiteralPat(it) => &it.syntax,
Pat::MacroPat(it) => &it.syntax,
}
}
}
impl From<LetStmt> for Stmt {
fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
}
@ -3346,8 +3347,8 @@ impl AstNode for AttrInput {
}
}
}
impl From<FnDef> for ExternItem {
fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) }
impl From<Fn> for ExternItem {
fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) }
}
impl From<StaticDef> for ExternItem {
fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) }
@ -3355,13 +3356,13 @@ impl From<StaticDef> for ExternItem {
impl AstNode for ExternItem {
fn can_cast(kind: SyntaxKind) -> bool {
match kind {
FN_DEF | STATIC_DEF => true,
FN | STATIC_DEF => true,
_ => false,
}
}
fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() {
FN_DEF => ExternItem::FnDef(FnDef { syntax }),
FN => ExternItem::Fn(Fn { syntax }),
STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }),
_ => return None,
};
@ -3369,7 +3370,7 @@ impl AstNode for ExternItem {
}
fn syntax(&self) -> &SyntaxNode {
match self {
ExternItem::FnDef(it) => &it.syntax,
ExternItem::Fn(it) => &it.syntax,
ExternItem::StaticDef(it) => &it.syntax,
}
}
@ -3417,6 +3418,11 @@ impl std::fmt::Display for TypeRef {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for Pat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for FieldDefList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
@ -3432,11 +3438,6 @@ impl std::fmt::Display for AssocItem {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for Pat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for Stmt {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
@ -3487,7 +3488,7 @@ impl std::fmt::Display for ExternCrate {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for FnDef {
impl std::fmt::Display for Fn {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
@ -3522,7 +3523,7 @@ impl std::fmt::Display for TraitDef {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for TypeAliasDef {
impl std::fmt::Display for TypeAlias {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
@ -3607,6 +3608,21 @@ impl std::fmt::Display for BlockExpr {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for Param {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for SelfParam {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for TypeBoundList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for RecordFieldDefList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
@ -3637,11 +3653,6 @@ impl std::fmt::Display for EnumVariant {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for TypeBoundList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for AssocItemList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
@ -4037,16 +4048,6 @@ impl std::fmt::Display for LetStmt {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for SelfParam {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for Param {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)
}
}
impl std::fmt::Display for PathSegment {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f)

View file

@ -294,7 +294,7 @@ pub fn fn_def(
type_params: Option<ast::TypeParamList>,
params: ast::ParamList,
body: ast::BlockExpr,
) -> ast::FnDef {
) -> ast::Fn {
let type_params =
if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() };
let visibility = match visibility {

View file

@ -474,7 +474,7 @@ impl ast::TokenTree {
}
impl ast::DocCommentsOwner for ast::SourceFile {}
impl ast::DocCommentsOwner for ast::FnDef {}
impl ast::DocCommentsOwner for ast::Fn {}
impl ast::DocCommentsOwner for ast::StructDef {}
impl ast::DocCommentsOwner for ast::UnionDef {}
impl ast::DocCommentsOwner for ast::RecordFieldDef {}
@ -485,6 +485,6 @@ impl ast::DocCommentsOwner for ast::TraitDef {}
impl ast::DocCommentsOwner for ast::Module {}
impl ast::DocCommentsOwner for ast::StaticDef {}
impl ast::DocCommentsOwner for ast::ConstDef {}
impl ast::DocCommentsOwner for ast::TypeAliasDef {}
impl ast::DocCommentsOwner for ast::TypeAlias {}
impl ast::DocCommentsOwner for ast::ImplDef {}
impl ast::DocCommentsOwner for ast::MacroCall {}

View file

@ -255,11 +255,11 @@ fn api_walkthrough() {
let mut func = None;
for item in file.items() {
match item {
ast::Item::FnDef(f) => func = Some(f),
ast::Item::Fn(f) => func = Some(f),
_ => unreachable!(),
}
}
let func: ast::FnDef = func.unwrap();
let func: ast::Fn = func.unwrap();
// Each AST node has a bunch of getters for children. All getters return
// `Option`s though, to account for incomplete code. Some getters are common
@ -316,7 +316,7 @@ fn api_walkthrough() {
);
// As well as some iterator helpers:
let f = expr_syntax.ancestors().find_map(ast::FnDef::cast);
let f = expr_syntax.ancestors().find_map(ast::Fn::cast);
assert_eq!(f, Some(func));
assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}']));
assert_eq!(

View file

@ -146,7 +146,7 @@ fn n_attached_trivias<'a>(
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
) -> usize {
match kind {
MACRO_CALL | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF
MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN
| TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => {
let mut res = 0;
let mut trivias = trivias.enumerate().peekable();

View file

@ -4,7 +4,7 @@ mod block;
use crate::{
ast, match_ast, AstNode, SyntaxError,
SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF},
SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS},
SyntaxNode, SyntaxToken, TextSize, T,
};
use rustc_lexer::unescape::{
@ -200,7 +200,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
None => return,
};
match parent.kind() {
FN_DEF | CONST_DEF | TYPE_ALIAS_DEF => (),
FN | CONST_DEF | TYPE_ALIAS => (),
_ => return,
}

View file

@ -9,7 +9,7 @@ use crate::{
pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
if let Some(parent) = block.syntax().parent() {
match parent.kind() {
FN_DEF | EXPR_STMT | BLOCK_EXPR => return,
FN | EXPR_STMT | BLOCK_EXPR => return,
_ => {}
}
}

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..54
FN_DEF@0..31
FN@0..31
ATTR@0..18
POUND@0..1 "#"
L_BRACK@1..2 "["

View file

@ -12,7 +12,7 @@ SOURCE_FILE@0..31
ERROR@14..15
R_CURLY@14..15 "}"
WHITESPACE@15..17 "\n\n"
FN_DEF@17..27
FN@17..27
FN_KW@17..19 "fn"
WHITESPACE@19..20 " "
NAME@20..23

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..95
FN_DEF@0..12
FN@0..12
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -58,7 +58,7 @@ SOURCE_FILE@0..95
WHITESPACE@78..79 "\n"
R_CURLY@79..80 "}"
WHITESPACE@80..82 "\n\n"
FN_DEF@82..94
FN@82..94
FN_KW@82..84 "fn"
WHITESPACE@84..85 " "
NAME@85..88

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..42
FN_DEF@0..41
FN@0..41
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..389
FN_DEF@0..389
FN@0..389
VISIBILITY@0..10
PUB_KW@0..3
L_PAREN@3..4

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..23
FN_DEF@0..22
FN@0..22
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..14
FN_DEF@0..7
FN@0..7
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..56
FN_DEF@0..55
FN@0..55
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..47
FN_DEF@0..46
FN@0..46
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -11,7 +11,7 @@ SOURCE_FILE@0..183
ASSOC_ITEM_LIST@14..182
L_CURLY@14..15 "{"
WHITESPACE@15..20 "\n "
FN_DEF@20..161
FN@20..161
FN_KW@20..22 "fn"
WHITESPACE@22..23 " "
NAME@23..32
@ -116,7 +116,7 @@ SOURCE_FILE@0..183
WHITESPACE@155..160 "\n "
R_CURLY@160..161 "}"
WHITESPACE@161..167 "\n\n "
FN_DEF@167..180
FN@167..180
FN_KW@167..169 "fn"
WHITESPACE@169..170 " "
NAME@170..180

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..139
FN_DEF@0..138
FN@0..138
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,8 +1,8 @@
SOURCE_FILE@0..16
FN_DEF@0..2
FN@0..2
FN_KW@0..2 "fn"
WHITESPACE@2..4 "\n\n"
FN_DEF@4..15
FN@4..15
FN_KW@4..6 "fn"
WHITESPACE@6..7 " "
NAME@7..10

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..22
FN_DEF@0..21
FN@0..21
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..112
FN_DEF@0..33
FN@0..33
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..4
@ -40,7 +40,7 @@ SOURCE_FILE@0..112
WHITESPACE@31..32 " "
R_CURLY@32..33 "}"
WHITESPACE@33..34 "\n"
FN_DEF@34..68
FN@34..68
FN_KW@34..36 "fn"
WHITESPACE@36..37 " "
NAME@37..38
@ -88,7 +88,7 @@ SOURCE_FILE@0..112
WHITESPACE@66..67 " "
R_CURLY@67..68 "}"
WHITESPACE@68..69 "\n"
FN_DEF@69..111
FN@69..111
FN_KW@69..71 "fn"
WHITESPACE@71..72 " "
NAME@72..73

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..94
FN_DEF@0..55
FN@0..55
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..240
FN_DEF@0..53
FN@0..53
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..4
@ -65,7 +65,7 @@ SOURCE_FILE@0..240
L_CURLY@51..52 "{"
R_CURLY@52..53 "}"
WHITESPACE@53..55 "\n\n"
FN_DEF@55..239
FN@55..239
FN_KW@55..57 "fn"
WHITESPACE@57..58 " "
NAME@58..62

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..575
FN_DEF@0..574
FN@0..574
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..30
FN_DEF@0..29
FN@0..29
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..24
FN_DEF@0..23
FN@0..23
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..350
FN_DEF@0..349
FN@0..349
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..8

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..293
FN_DEF@0..292
FN@0..292
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..89
FN_DEF@0..88
FN@0..88
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..91
FN_DEF@0..89
FN@0..89
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -34,7 +34,7 @@ SOURCE_FILE@0..48
USE@34..37
USE_KW@34..37 "use"
WHITESPACE@37..38 "\n"
FN_DEF@38..47
FN@38..47
FN_KW@38..40 "fn"
WHITESPACE@40..41 " "
NAME@41..42

View file

@ -17,7 +17,7 @@ SOURCE_FILE@0..118
ASSOC_ITEM_LIST@14..117
L_CURLY@14..15 "{"
WHITESPACE@15..20 "\n "
FN_DEF@20..31
FN@20..31
FN_KW@20..22 "fn"
WHITESPACE@22..23 " "
NAME@23..26
@ -30,7 +30,7 @@ SOURCE_FILE@0..118
L_CURLY@29..30 "{"
R_CURLY@30..31 "}"
WHITESPACE@31..36 "\n "
FN_DEF@36..51
FN@36..51
VISIBILITY@36..39
PUB_KW@36..39 "pub"
WHITESPACE@39..40 " "
@ -46,7 +46,7 @@ SOURCE_FILE@0..118
L_CURLY@49..50 "{"
R_CURLY@50..51 "}"
WHITESPACE@51..56 "\n "
TYPE_ALIAS_DEF@56..81
TYPE_ALIAS@56..81
VISIBILITY@56..66
PUB_KW@56..59 "pub"
L_PAREN@59..60 "("

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..33
FN_DEF@0..32
FN@0..32
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..83
FN_DEF@0..82
FN@0..82
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..239
TYPE_ALIAS_DEF@0..30
TYPE_ALIAS@0..30
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..11
@ -26,7 +26,7 @@ SOURCE_FILE@0..239
IDENT@26..29 "u32"
SEMICOLON@29..30 ";"
WHITESPACE@30..31 "\n"
TYPE_ALIAS_DEF@31..64
TYPE_ALIAS@31..64
TYPE_KW@31..35 "type"
WHITESPACE@35..36 " "
NAME@36..42
@ -57,7 +57,7 @@ SOURCE_FILE@0..239
R_PAREN@62..63 ")"
SEMICOLON@63..64 ";"
WHITESPACE@64..65 "\n"
TYPE_ALIAS_DEF@65..95
TYPE_ALIAS@65..95
TYPE_KW@65..69 "type"
WHITESPACE@69..70 " "
NAME@70..78
@ -83,7 +83,7 @@ SOURCE_FILE@0..239
R_BRACK@93..94 "]"
SEMICOLON@94..95 ";"
WHITESPACE@95..96 "\n"
TYPE_ALIAS_DEF@96..149
TYPE_ALIAS@96..149
TYPE_KW@96..100 "type"
WHITESPACE@100..101 " "
NAME@101..109
@ -136,7 +136,7 @@ SOURCE_FILE@0..239
R_PAREN@147..148 ")"
SEMICOLON@148..149 ";"
WHITESPACE@149..150 "\n"
FN_DEF@150..238
FN@150..238
FN_KW@150..152 "fn"
WHITESPACE@152..153 " "
NAME@153..164

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..83
FN_DEF@0..82
FN@0..82
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,4 +1,4 @@
FN_DEF@0..11
FN@0..11
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..18
TYPE_ALIAS_DEF@0..12
TYPE_ALIAS@0..12
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..30
FN_DEF@0..29
FN@0..29
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..14
TYPE_ALIAS_DEF@0..13
TYPE_ALIAS@0..13
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..20
TYPE_ALIAS_DEF@0..15
TYPE_ALIAS@0..15
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..33
FN_DEF@0..10
FN@0..10
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6
@ -19,7 +19,7 @@ SOURCE_FILE@0..33
WHITESPACE@19..20 " "
R_CURLY@20..21 "}"
WHITESPACE@21..22 " "
FN_DEF@22..32
FN@22..32
FN_KW@22..24 "fn"
WHITESPACE@24..25 " "
NAME@25..28

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..30
FN_DEF@0..29
FN@0..29
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..21
FN_DEF@0..20
FN@0..20
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..48
FN_DEF@0..47
FN@0..47
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..47
FN_DEF@0..46
FN@0..46
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -2,7 +2,7 @@ SOURCE_FILE@0..50
ERROR@0..6
UNSAFE_KW@0..6 "unsafe"
WHITESPACE@6..7 " "
FN_DEF@7..24
FN@7..24
ASYNC_KW@7..12 "async"
WHITESPACE@12..13 " "
FN_KW@13..15 "fn"

View file

@ -14,7 +14,7 @@ SOURCE_FILE@0..62
NAME_REF@14..21
IDENT@14..21 "default"
WHITESPACE@21..22 " "
TYPE_ALIAS_DEF@22..35
TYPE_ALIAS@22..35
TYPE_KW@22..26 "type"
WHITESPACE@26..27 " "
NAME@27..28
@ -35,7 +35,7 @@ SOURCE_FILE@0..62
NAME_REF@40..47
IDENT@40..47 "default"
WHITESPACE@47..48 " "
FN_DEF@48..59
FN@48..59
FN_KW@48..50 "fn"
WHITESPACE@50..51 " "
NAME@51..54

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..45
FN_DEF@0..44
FN@0..44
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..7

View file

@ -11,7 +11,7 @@ SOURCE_FILE@0..83
ASSOC_ITEM_LIST@7..82
L_CURLY@7..8 "{"
WHITESPACE@8..13 "\n "
TYPE_ALIAS_DEF@13..27
TYPE_ALIAS@13..27
TYPE_KW@13..17 "type"
WHITESPACE@17..18 " "
NAME@18..19
@ -41,7 +41,7 @@ SOURCE_FILE@0..83
IDENT@41..44 "i32"
SEMICOLON@44..45 ";"
WHITESPACE@45..50 "\n "
FN_DEF@50..61
FN@50..61
FN_KW@50..52 "fn"
WHITESPACE@52..53 " "
NAME@53..56
@ -54,7 +54,7 @@ SOURCE_FILE@0..83
L_CURLY@59..60 "{"
R_CURLY@60..61 "}"
WHITESPACE@61..66 "\n "
FN_DEF@66..80
FN@66..80
FN_KW@66..68 "fn"
WHITESPACE@68..69 " "
NAME@69..72

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..54
FN_DEF@0..53
FN@0..53
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..12

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..39
TYPE_ALIAS_DEF@0..38
TYPE_ALIAS@0..38
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..28
FN_DEF@0..27
FN@0..27
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -11,7 +11,7 @@ SOURCE_FILE@0..128
ASSOC_ITEM_LIST@7..127
L_CURLY@7..8 "{"
WHITESPACE@8..13 "\n "
FN_DEF@13..26
FN@13..26
FN_KW@13..15 "fn"
WHITESPACE@15..16 " "
NAME@16..17
@ -26,7 +26,7 @@ SOURCE_FILE@0..128
L_CURLY@24..25 "{"
R_CURLY@25..26 "}"
WHITESPACE@26..31 "\n "
FN_DEF@31..46
FN@31..46
FN_KW@31..33 "fn"
WHITESPACE@33..34 " "
NAME@34..35
@ -43,7 +43,7 @@ SOURCE_FILE@0..128
L_CURLY@44..45 "{"
R_CURLY@45..46 "}"
WHITESPACE@46..51 "\n "
FN_DEF@51..69
FN@51..69
FN_KW@51..53 "fn"
WHITESPACE@53..54 " "
NAME@54..55
@ -62,7 +62,7 @@ SOURCE_FILE@0..128
L_CURLY@67..68 "{"
R_CURLY@68..69 "}"
WHITESPACE@69..74 "\n "
FN_DEF@74..103
FN@74..103
FN_KW@74..76 "fn"
WHITESPACE@76..77 " "
NAME@77..78
@ -95,7 +95,7 @@ SOURCE_FILE@0..128
L_CURLY@101..102 "{"
R_CURLY@102..103 "}"
WHITESPACE@103..108 "\n "
FN_DEF@108..125
FN@108..125
FN_KW@108..110 "fn"
WHITESPACE@110..111 " "
NAME@111..112

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..103
FN_DEF@0..102
FN@0..102
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..26
FN_DEF@0..25
FN@0..25
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..48
FN_DEF@0..47
FN@0..47
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..6

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..31
TYPE_ALIAS_DEF@0..30
TYPE_ALIAS@0..30
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..8

View file

@ -1,5 +1,5 @@
SOURCE_FILE@0..36
TYPE_ALIAS_DEF@0..17
TYPE_ALIAS@0..17
TYPE_KW@0..4 "type"
WHITESPACE@4..5 " "
NAME@5..6
@ -16,7 +16,7 @@ SOURCE_FILE@0..36
R_PAREN@15..16 ")"
SEMICOLON@16..17 ";"
WHITESPACE@17..18 "\n"
TYPE_ALIAS_DEF@18..35
TYPE_ALIAS@18..35
TYPE_KW@18..22 "type"
WHITESPACE@22..23 " "
NAME@23..24

Some files were not shown because too many files have changed in this diff Show more