5597: Rename FieldDef -> Field 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 14:49:39 +00:00 committed by GitHub
commit a257fd06b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 219 additions and 228 deletions

View file

@ -47,7 +47,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
} }
(vis_offset(&parent), keyword.text_range()) (vis_offset(&parent), keyword.text_range())
} else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() {
let field = field_name.syntax().ancestors().find_map(ast::RecordFieldDef::cast)?; let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?;
if field.name()? != field_name { if field.name()? != field_name {
mark::hit!(change_visibility_field_false_positive); mark::hit!(change_visibility_field_false_positive);
return None; return None;
@ -56,7 +56,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
return None; return None;
} }
(vis_offset(field.syntax()), field_name.syntax().text_range()) (vis_offset(field.syntax()), field_name.syntax().text_range())
} else if let Some(field) = ctx.find_node_at_offset::<ast::TupleFieldDef>() { } else if let Some(field) = ctx.find_node_at_offset::<ast::TupleField>() {
if field.visibility().is_some() { if field.visibility().is_some() {
return None; return None;
} }

View file

@ -43,7 +43,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),
ast::StructDef(it) => { ast::StructDef(it) => {
it.syntax().children_with_tokens() it.syntax().children_with_tokens()
.find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])? .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])?
}, },
_ => return None _ => return None
} }

View file

@ -361,8 +361,8 @@ pub struct Field {
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
pub enum FieldSource { pub enum FieldSource {
Named(ast::RecordFieldDef), Named(ast::RecordField),
Pos(ast::TupleFieldDef), Pos(ast::TupleField),
} }
impl Field { impl Field {

View file

@ -589,8 +589,8 @@ to_def_impls![
(crate::Const, ast::ConstDef, const_to_def), (crate::Const, ast::ConstDef, const_to_def),
(crate::Static, ast::StaticDef, static_to_def), (crate::Static, ast::StaticDef, static_to_def),
(crate::Function, ast::Fn, fn_to_def), (crate::Function, ast::Fn, fn_to_def),
(crate::Field, ast::RecordFieldDef, record_field_to_def), (crate::Field, ast::RecordField, record_field_to_def),
(crate::Field, ast::TupleFieldDef, tuple_field_to_def), (crate::Field, ast::TupleField, tuple_field_to_def),
(crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),
(crate::TypeParam, ast::TypeParam, type_param_to_def), (crate::TypeParam, ast::TypeParam, type_param_to_def),
(crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros

View file

@ -92,16 +92,10 @@ impl SourceToDefCtx<'_, '_> {
pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
self.to_def(src, keys::TYPE_ALIAS) self.to_def(src, keys::TYPE_ALIAS)
} }
pub(super) fn record_field_to_def( pub(super) fn record_field_to_def(&mut self, src: InFile<ast::RecordField>) -> Option<FieldId> {
&mut self,
src: InFile<ast::RecordFieldDef>,
) -> Option<FieldId> {
self.to_def(src, keys::RECORD_FIELD) self.to_def(src, keys::RECORD_FIELD)
} }
pub(super) fn tuple_field_to_def( pub(super) fn tuple_field_to_def(&mut self, src: InFile<ast::TupleField>) -> Option<FieldId> {
&mut self,
src: InFile<ast::TupleFieldDef>,
) -> Option<FieldId> {
self.to_def(src, keys::TUPLE_FIELD) self.to_def(src, keys::TUPLE_FIELD)
} }
pub(super) fn enum_variant_to_def( pub(super) fn enum_variant_to_def(

View file

@ -179,7 +179,7 @@ impl VariantData {
impl HasChildSource for VariantId { impl HasChildSource for VariantId {
type ChildId = LocalFieldId; type ChildId = LocalFieldId;
type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; type Value = Either<ast::TupleField, ast::RecordField>;
fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> {
let (src, module_id) = match self { let (src, module_id) = match self {
@ -194,7 +194,7 @@ impl HasChildSource for VariantId {
} }
VariantId::UnionId(it) => ( VariantId::UnionId(it) => (
it.lookup(db).source(db).map(|it| { it.lookup(db).source(db).map(|it| {
it.record_field_def_list() it.record_field_list()
.map(ast::StructKind::Record) .map(ast::StructKind::Record)
.unwrap_or(ast::StructKind::Unit) .unwrap_or(ast::StructKind::Unit)
}), }),
@ -218,7 +218,7 @@ pub enum StructKind {
fn lower_struct( fn lower_struct(
db: &dyn DefDatabase, db: &dyn DefDatabase,
expander: &mut CfgExpander, expander: &mut CfgExpander,
trace: &mut Trace<FieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, trace: &mut Trace<FieldData, Either<ast::TupleField, ast::RecordField>>,
ast: &InFile<ast::StructKind>, ast: &InFile<ast::StructKind>,
) -> StructKind { ) -> StructKind {
let ctx = LowerCtx::new(db, ast.file_id); let ctx = LowerCtx::new(db, ast.file_id);

View file

@ -1,10 +1,7 @@
//! AST -> `ItemTree` lowering code. //! AST -> `ItemTree` lowering code.
use super::*; use std::{collections::hash_map::Entry, mem, sync::Arc};
use crate::{
attr::Attrs,
generics::{GenericParams, TypeParamData, TypeParamProvenance},
};
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId};
use ra_arena::map::ArenaMap; use ra_arena::map::ArenaMap;
use ra_syntax::{ use ra_syntax::{
@ -12,7 +9,13 @@ use ra_syntax::{
SyntaxNode, SyntaxNode,
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
use std::{collections::hash_map::Entry, mem, sync::Arc};
use crate::{
attr::Attrs,
generics::{GenericParams, TypeParamData, TypeParamProvenance},
};
use super::*;
fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> { fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> {
FileItemTreeId { index, _p: PhantomData } FileItemTreeId { index, _p: PhantomData }
@ -191,7 +194,7 @@ impl Ctx {
} }
} }
fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange<Field> { fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange<Field> {
let start = self.next_field_idx(); let start = self.next_field_idx();
for field in fields.fields() { for field in fields.fields() {
if let Some(data) = self.lower_record_field(&field) { if let Some(data) = self.lower_record_field(&field) {
@ -203,7 +206,7 @@ impl Ctx {
IdRange::new(start..end) IdRange::new(start..end)
} }
fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> { fn lower_record_field(&mut self, field: &ast::RecordField) -> Option<Field> {
let name = field.name()?.as_name(); let name = field.name()?.as_name();
let visibility = self.lower_visibility(field); let visibility = self.lower_visibility(field);
let type_ref = self.lower_type_ref_opt(field.ascribed_type()); let type_ref = self.lower_type_ref_opt(field.ascribed_type());
@ -211,7 +214,7 @@ impl Ctx {
Some(res) Some(res)
} }
fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange<Field> {
let start = self.next_field_idx(); let start = self.next_field_idx();
for (i, field) in fields.fields().enumerate() { for (i, field) in fields.fields().enumerate() {
let data = self.lower_tuple_field(i, &field); let data = self.lower_tuple_field(i, &field);
@ -222,7 +225,7 @@ impl Ctx {
IdRange::new(start..end) IdRange::new(start..end)
} }
fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field {
let name = Name::new_tuple_field(idx); let name = Name::new_tuple_field(idx);
let visibility = self.lower_visibility(field); let visibility = self.lower_visibility(field);
let type_ref = self.lower_type_ref_opt(field.type_ref()); let type_ref = self.lower_type_ref_opt(field.type_ref());
@ -234,10 +237,8 @@ impl Ctx {
let visibility = self.lower_visibility(union); let visibility = self.lower_visibility(union);
let name = union.name()?.as_name(); let name = union.name()?.as_name();
let generic_params = self.lower_generic_params(GenericsOwner::Union, union); let generic_params = self.lower_generic_params(GenericsOwner::Union, union);
let fields = match union.record_field_def_list() { let fields = match union.record_field_list() {
Some(record_field_def_list) => { Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)),
self.lower_fields(&StructKind::Record(record_field_def_list))
}
None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())),
}; };
let ast_id = self.source_ast_id_map.ast_id(union); let ast_id = self.source_ast_id_map.ast_id(union);

View file

@ -25,8 +25,8 @@ pub const UNION: Key<ast::UnionDef, UnionId> = Key::new();
pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new();
pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new();
pub const TUPLE_FIELD: Key<ast::TupleFieldDef, FieldId> = Key::new(); pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new();
pub const RECORD_FIELD: Key<ast::RecordFieldDef, FieldId> = Key::new(); pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new();
pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new();
pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new(); pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new();

View file

@ -155,21 +155,21 @@ fn missing_struct_field_fix(
module = s.module(sema.db); module = s.module(sema.db);
let source = s.source(sema.db); let source = s.source(sema.db);
def_file_id = source.file_id; def_file_id = source.file_id;
let fields = source.value.field_def_list()?; let fields = source.value.field_list()?;
record_field_def_list(fields)? record_field_list(fields)?
} }
VariantDef::Union(u) => { VariantDef::Union(u) => {
module = u.module(sema.db); module = u.module(sema.db);
let source = u.source(sema.db); let source = u.source(sema.db);
def_file_id = source.file_id; def_file_id = source.file_id;
source.value.record_field_def_list()? source.value.record_field_list()?
} }
VariantDef::EnumVariant(e) => { VariantDef::EnumVariant(e) => {
module = e.module(sema.db); module = e.module(sema.db);
let source = e.source(sema.db); let source = e.source(sema.db);
def_file_id = source.file_id; def_file_id = source.file_id;
let fields = source.value.field_def_list()?; let fields = source.value.field_list()?;
record_field_def_list(fields)? record_field_list(fields)?
} }
}; };
let def_file_id = def_file_id.original_file(sema.db); let def_file_id = def_file_id.original_file(sema.db);
@ -205,10 +205,10 @@ fn missing_struct_field_fix(
let fix = Fix::new("Create field", source_change.into()); let fix = Fix::new("Create field", source_change.into());
return Some(fix); return Some(fix);
fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option<ast::RecordFieldDefList> { fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> {
match field_def_list { match field_def_list {
ast::FieldDefList::RecordFieldDefList(it) => Some(it), ast::FieldList::RecordFieldList(it) => Some(it),
ast::FieldDefList::TupleFieldDefList(_) => None, ast::FieldList::TupleFieldList(_) => None,
} }
} }
} }

View file

@ -387,7 +387,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
ast::TypeAlias(it) => it.doc_comment_text(), ast::TypeAlias(it) => it.doc_comment_text(),
ast::ConstDef(it) => it.doc_comment_text(), ast::ConstDef(it) => it.doc_comment_text(),
ast::StaticDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(),
ast::RecordFieldDef(it) => it.doc_comment_text(), ast::RecordField(it) => it.doc_comment_text(),
ast::EnumVariant(it) => it.doc_comment_text(), ast::EnumVariant(it) => it.doc_comment_text(),
ast::MacroCall(it) => it.doc_comment_text(), ast::MacroCall(it) => it.doc_comment_text(),
_ => None, _ => None,
@ -412,7 +412,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
ast::TypeAlias(it) => it.short_label(), ast::TypeAlias(it) => it.short_label(),
ast::ConstDef(it) => it.short_label(), ast::ConstDef(it) => it.short_label(),
ast::StaticDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(),
ast::RecordFieldDef(it) => it.short_label(), ast::RecordField(it) => it.short_label(),
ast::EnumVariant(it) => it.short_label(), ast::EnumVariant(it) => it.short_label(),
_ => None, _ => None,
} }

View file

@ -65,7 +65,7 @@ impl ShortLabel for ast::StaticDef {
} }
} }
impl ShortLabel for ast::RecordFieldDef { impl ShortLabel for ast::RecordField {
fn short_label(&self) -> Option<String> { fn short_label(&self) -> Option<String> {
short_label_from_ascribed_node(self, "") short_label_from_ascribed_node(self, "")
} }

View file

@ -39,8 +39,8 @@ fn try_extend_selection(
let list_kinds = [ let list_kinds = [
RECORD_FIELD_PAT_LIST, RECORD_FIELD_PAT_LIST,
MATCH_ARM_LIST, MATCH_ARM_LIST,
RECORD_FIELD_DEF_LIST, RECORD_FIELD_LIST,
TUPLE_FIELD_DEF_LIST, TUPLE_FIELD_LIST,
RECORD_EXPR_FIELD_LIST, RECORD_EXPR_FIELD_LIST,
ENUM_VARIANT_LIST, ENUM_VARIANT_LIST,
USE_TREE_LIST, USE_TREE_LIST,

View file

@ -136,7 +136,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
let ty = it.type_ref(); let ty = it.type_ref();
decl_with_type_ref(it, ty) decl_with_type_ref(it, ty)
}, },
ast::RecordFieldDef(it) => decl_with_ascription(it), ast::RecordField(it) => decl_with_ascription(it),
ast::ConstDef(it) => decl_with_ascription(it), ast::ConstDef(it) => decl_with_ascription(it),
ast::StaticDef(it) => decl_with_ascription(it), ast::StaticDef(it) => decl_with_ascription(it),
ast::ImplDef(it) => { ast::ImplDef(it) => {
@ -249,7 +249,7 @@ fn very_obsolete() {}
label: "x", label: "x",
navigation_range: 18..19, navigation_range: 18..19,
node_range: 18..24, node_range: 18..24,
kind: RECORD_FIELD_DEF, kind: RECORD_FIELD,
detail: Some( detail: Some(
"i32", "i32",
), ),

View file

@ -85,7 +85,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
COMMENT => Some(FoldKind::Comment), COMMENT => Some(FoldKind::Comment),
USE => Some(FoldKind::Imports), USE => Some(FoldKind::Imports),
ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
RECORD_FIELD_DEF_LIST RECORD_FIELD_LIST
| RECORD_FIELD_PAT_LIST | RECORD_FIELD_PAT_LIST
| RECORD_EXPR_FIELD_LIST | RECORD_EXPR_FIELD_LIST
| ITEM_LIST | ITEM_LIST

View file

@ -361,7 +361,7 @@ fn main(s: Foo) {
); );
check_result( check_result(
refs, refs,
"spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other", "spam RECORD_FIELD FileId(1) 17..30 21..25 Other",
&["FileId(1) 67..71 Other Read"], &["FileId(1) 67..71 Other Read"],
); );
} }
@ -580,7 +580,7 @@ fn foo() {
); );
check_result( check_result(
refs, refs,
"f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other", "f RECORD_FIELD FileId(1) 15..21 15..16 Other",
&["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"],
); );
} }

View file

@ -711,7 +711,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
TRAIT_DEF => HighlightTag::Trait, TRAIT_DEF => HighlightTag::Trait,
TYPE_ALIAS => HighlightTag::TypeAlias, TYPE_ALIAS => HighlightTag::TypeAlias,
TYPE_PARAM => HighlightTag::TypeParam, TYPE_PARAM => HighlightTag::TypeParam,
RECORD_FIELD_DEF => HighlightTag::Field, RECORD_FIELD => HighlightTag::Field,
MODULE => HighlightTag::Module, MODULE => HighlightTag::Module,
FN => HighlightTag::Function, FN => HighlightTag::Function,
CONST_DEF => HighlightTag::Constant, CONST_DEF => HighlightTag::Constant,

View file

@ -142,7 +142,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
Some(NameClass::Definition(Definition::Local(local))) Some(NameClass::Definition(Definition::Local(local)))
}, },
ast::RecordFieldDef(it) => { ast::RecordField(it) => {
let field: hir::Field = sema.to_def(&it)?; let field: hir::Field = sema.to_def(&it)?;
Some(NameClass::Definition(Definition::Field(field))) Some(NameClass::Definition(Definition::Field(field)))
}, },

View file

@ -494,9 +494,9 @@ MACRO_ITEMS@0..40
STRUCT_KW@0..6 "struct" STRUCT_KW@0..6 "struct"
NAME@6..9 NAME@6..9
IDENT@6..9 "Foo" IDENT@6..9 "Foo"
RECORD_FIELD_DEF_LIST@9..20 RECORD_FIELD_LIST@9..20
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
RECORD_FIELD_DEF@10..19 RECORD_FIELD@10..19
NAME@10..15 NAME@10..15
IDENT@10..15 "field" IDENT@10..15 "field"
COLON@15..16 ":" COLON@15..16 ":"
@ -510,9 +510,9 @@ MACRO_ITEMS@0..40
STRUCT_KW@20..26 "struct" STRUCT_KW@20..26 "struct"
NAME@26..29 NAME@26..29
IDENT@26..29 "Bar" IDENT@26..29 "Bar"
RECORD_FIELD_DEF_LIST@29..40 RECORD_FIELD_LIST@29..40
L_CURLY@29..30 "{" L_CURLY@29..30 "{"
RECORD_FIELD_DEF@30..39 RECORD_FIELD@30..39
NAME@30..35 NAME@30..35
IDENT@30..35 "field" IDENT@30..35 "field"
COLON@35..36 ":" COLON@35..36 ":"

View file

@ -142,7 +142,7 @@ pub(crate) fn reparser(
) -> Option<fn(&mut Parser)> { ) -> Option<fn(&mut Parser)> {
let res = match node { let res = match node {
BLOCK_EXPR => expressions::block_expr, BLOCK_EXPR => expressions::block_expr,
RECORD_FIELD_DEF_LIST => items::record_field_def_list, RECORD_FIELD_LIST => items::record_field_def_list,
RECORD_EXPR_FIELD_LIST => items::record_field_list, RECORD_EXPR_FIELD_LIST => items::record_field_list,
ENUM_VARIANT_LIST => items::enum_variant_list, ENUM_VARIANT_LIST => items::enum_variant_list,
MATCH_ARM_LIST => items::match_arm_list, MATCH_ARM_LIST => items::match_arm_list,

View file

@ -119,7 +119,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) {
} }
} }
p.expect(T!['}']); p.expect(T!['}']);
m.complete(p, RECORD_FIELD_DEF_LIST); m.complete(p, RECORD_FIELD_LIST);
fn record_field_def(p: &mut Parser) { fn record_field_def(p: &mut Parser) {
let m = p.start(); let m = p.start();
@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) {
name(p); name(p);
p.expect(T![:]); p.expect(T![:]);
types::type_(p); types::type_(p);
m.complete(p, RECORD_FIELD_DEF); m.complete(p, RECORD_FIELD);
} else { } else {
m.abandon(p); m.abandon(p);
p.err_and_bump("expected field declaration"); p.err_and_bump("expected field declaration");
@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) {
break; break;
} }
types::type_(p); types::type_(p);
m.complete(p, TUPLE_FIELD_DEF); m.complete(p, TUPLE_FIELD);
if !p.at(T![')']) { if !p.at(T![')']) {
p.expect(T![,]); p.expect(T![,]);
} }
} }
p.expect(T![')']); p.expect(T![')']);
m.complete(p, TUPLE_FIELD_DEF_LIST); m.complete(p, TUPLE_FIELD_LIST);
} }

View file

@ -207,10 +207,10 @@ pub enum SyntaxKind {
EXTERN_BLOCK, EXTERN_BLOCK,
EXTERN_ITEM_LIST, EXTERN_ITEM_LIST,
ENUM_VARIANT, ENUM_VARIANT,
RECORD_FIELD_DEF_LIST, RECORD_FIELD_LIST,
RECORD_FIELD_DEF, RECORD_FIELD,
TUPLE_FIELD_DEF_LIST, TUPLE_FIELD_LIST,
TUPLE_FIELD_DEF, TUPLE_FIELD,
ENUM_VARIANT_LIST, ENUM_VARIANT_LIST,
ITEM_LIST, ITEM_LIST,
ASSOC_ITEM_LIST, ASSOC_ITEM_LIST,

View file

@ -165,7 +165,7 @@ impl ast::GenericParamsOwner for StructDef {}
impl StructDef { impl StructDef {
pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TraitDef { pub struct TraitDef {
@ -208,9 +208,7 @@ impl ast::VisibilityOwner for UnionDef {}
impl ast::GenericParamsOwner for UnionDef {} impl ast::GenericParamsOwner for UnionDef {}
impl UnionDef { impl UnionDef {
pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
support::child(&self.syntax)
}
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Use { pub struct Use {
@ -391,42 +389,42 @@ impl TypeBoundList {
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RecordFieldDefList { pub struct RecordFieldList {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,
} }
impl RecordFieldDefList { impl RecordFieldList {
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TupleFieldDefList { pub struct TupleFieldList {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,
} }
impl TupleFieldDefList { impl TupleFieldList {
pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) }
pub fn r_paren_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)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RecordFieldDef { pub struct RecordField {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,
} }
impl ast::AttrsOwner for RecordFieldDef {} impl ast::AttrsOwner for RecordField {}
impl ast::NameOwner for RecordFieldDef {} impl ast::NameOwner for RecordField {}
impl ast::VisibilityOwner for RecordFieldDef {} impl ast::VisibilityOwner for RecordField {}
impl ast::TypeAscriptionOwner for RecordFieldDef {} impl ast::TypeAscriptionOwner for RecordField {}
impl RecordFieldDef { impl RecordField {
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct TupleFieldDef { pub struct TupleField {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,
} }
impl ast::AttrsOwner for TupleFieldDef {} impl ast::AttrsOwner for TupleField {}
impl ast::NameOwner for TupleFieldDef {} impl ast::NameOwner for TupleField {}
impl ast::VisibilityOwner for TupleFieldDef {} impl ast::VisibilityOwner for TupleField {}
impl TupleFieldDef { impl TupleField {
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@ -446,7 +444,7 @@ impl ast::AttrsOwner for EnumVariant {}
impl ast::NameOwner for EnumVariant {} impl ast::NameOwner for EnumVariant {}
impl ast::VisibilityOwner for EnumVariant {} impl ast::VisibilityOwner for EnumVariant {}
impl EnumVariant { impl EnumVariant {
pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
} }
@ -1326,9 +1324,9 @@ pub enum Pat {
MacroPat(MacroPat), MacroPat(MacroPat),
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum FieldDefList { pub enum FieldList {
RecordFieldDefList(RecordFieldDefList), RecordFieldList(RecordFieldList),
TupleFieldDefList(TupleFieldDefList), TupleFieldList(TupleFieldList),
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Expr { pub enum Expr {
@ -1765,8 +1763,8 @@ impl AstNode for TypeBoundList {
} }
fn syntax(&self) -> &SyntaxNode { &self.syntax } fn syntax(&self) -> &SyntaxNode { &self.syntax }
} }
impl AstNode for RecordFieldDefList { impl AstNode for RecordFieldList {
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> { fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) { if Self::can_cast(syntax.kind()) {
Some(Self { syntax }) Some(Self { syntax })
@ -1776,8 +1774,8 @@ impl AstNode for RecordFieldDefList {
} }
fn syntax(&self) -> &SyntaxNode { &self.syntax } fn syntax(&self) -> &SyntaxNode { &self.syntax }
} }
impl AstNode for TupleFieldDefList { impl AstNode for TupleFieldList {
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST }
fn cast(syntax: SyntaxNode) -> Option<Self> { fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) { if Self::can_cast(syntax.kind()) {
Some(Self { syntax }) Some(Self { syntax })
@ -1787,8 +1785,8 @@ impl AstNode for TupleFieldDefList {
} }
fn syntax(&self) -> &SyntaxNode { &self.syntax } fn syntax(&self) -> &SyntaxNode { &self.syntax }
} }
impl AstNode for RecordFieldDef { impl AstNode for RecordField {
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
fn cast(syntax: SyntaxNode) -> Option<Self> { fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) { if Self::can_cast(syntax.kind()) {
Some(Self { syntax }) Some(Self { syntax })
@ -1798,8 +1796,8 @@ impl AstNode for RecordFieldDef {
} }
fn syntax(&self) -> &SyntaxNode { &self.syntax } fn syntax(&self) -> &SyntaxNode { &self.syntax }
} }
impl AstNode for TupleFieldDef { impl AstNode for TupleField {
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD }
fn cast(syntax: SyntaxNode) -> Option<Self> { fn cast(syntax: SyntaxNode) -> Option<Self> {
if Self::can_cast(syntax.kind()) { if Self::can_cast(syntax.kind()) {
Some(Self { syntax }) Some(Self { syntax })
@ -3046,33 +3044,31 @@ impl AstNode for Pat {
} }
} }
} }
impl From<RecordFieldDefList> for FieldDefList { impl From<RecordFieldList> for FieldList {
fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
} }
impl From<TupleFieldDefList> for FieldDefList { impl From<TupleFieldList> for FieldList {
fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) } fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
} }
impl AstNode for FieldDefList { impl AstNode for FieldList {
fn can_cast(kind: SyntaxKind) -> bool { fn can_cast(kind: SyntaxKind) -> bool {
match kind { match kind {
RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
_ => false, _ => false,
} }
} }
fn cast(syntax: SyntaxNode) -> Option<Self> { fn cast(syntax: SyntaxNode) -> Option<Self> {
let res = match syntax.kind() { let res = match syntax.kind() {
RECORD_FIELD_DEF_LIST => { RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
}
TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
_ => return None, _ => return None,
}; };
Some(res) Some(res)
} }
fn syntax(&self) -> &SyntaxNode { fn syntax(&self) -> &SyntaxNode {
match self { match self {
FieldDefList::RecordFieldDefList(it) => &it.syntax, FieldList::RecordFieldList(it) => &it.syntax,
FieldDefList::TupleFieldDefList(it) => &it.syntax, FieldList::TupleFieldList(it) => &it.syntax,
} }
} }
} }
@ -3425,7 +3421,7 @@ impl std::fmt::Display for Pat {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
} }
impl std::fmt::Display for FieldDefList { impl std::fmt::Display for FieldList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
@ -3625,22 +3621,22 @@ impl std::fmt::Display for TypeBoundList {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
} }
impl std::fmt::Display for RecordFieldDefList { impl std::fmt::Display for RecordFieldList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
} }
impl std::fmt::Display for TupleFieldDefList { impl std::fmt::Display for TupleFieldList {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
} }
impl std::fmt::Display for RecordFieldDef { impl std::fmt::Display for RecordField {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }
} }
impl std::fmt::Display for TupleFieldDef { impl std::fmt::Display for TupleField {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self.syntax(), f) std::fmt::Display::fmt(self.syntax(), f)
} }

View file

@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordE
} }
} }
pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField {
ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty))
} }

View file

@ -166,16 +166,16 @@ impl ast::ImplDef {
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub enum StructKind { pub enum StructKind {
Record(ast::RecordFieldDefList), Record(ast::RecordFieldList),
Tuple(ast::TupleFieldDefList), Tuple(ast::TupleFieldList),
Unit, Unit,
} }
impl StructKind { impl StructKind {
fn from_node<N: AstNode>(node: &N) -> StructKind { fn from_node<N: AstNode>(node: &N) -> StructKind {
if let Some(nfdl) = support::child::<ast::RecordFieldDefList>(node.syntax()) { if let Some(nfdl) = support::child::<ast::RecordFieldList>(node.syntax()) {
StructKind::Record(nfdl) StructKind::Record(nfdl)
} else if let Some(pfl) = support::child::<ast::TupleFieldDefList>(node.syntax()) { } else if let Some(pfl) = support::child::<ast::TupleFieldList>(node.syntax()) {
StructKind::Tuple(pfl) StructKind::Tuple(pfl)
} else { } else {
StructKind::Unit StructKind::Unit
@ -477,8 +477,8 @@ impl ast::DocCommentsOwner for ast::SourceFile {}
impl ast::DocCommentsOwner for ast::Fn {} impl ast::DocCommentsOwner for ast::Fn {}
impl ast::DocCommentsOwner for ast::StructDef {} impl ast::DocCommentsOwner for ast::StructDef {}
impl ast::DocCommentsOwner for ast::UnionDef {} impl ast::DocCommentsOwner for ast::UnionDef {}
impl ast::DocCommentsOwner for ast::RecordFieldDef {} impl ast::DocCommentsOwner for ast::RecordField {}
impl ast::DocCommentsOwner for ast::TupleFieldDef {} impl ast::DocCommentsOwner for ast::TupleField {}
impl ast::DocCommentsOwner for ast::EnumDef {} impl ast::DocCommentsOwner for ast::EnumDef {}
impl ast::DocCommentsOwner for ast::EnumVariant {} impl ast::DocCommentsOwner for ast::EnumVariant {}
impl ast::DocCommentsOwner for ast::TraitDef {} impl ast::DocCommentsOwner for ast::TraitDef {}

View file

@ -147,7 +147,7 @@ fn n_attached_trivias<'a>(
) -> usize { ) -> usize {
match kind { match kind {
MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN
| TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => { | TRAIT_DEF | MODULE | RECORD_FIELD | STATIC_DEF => {
let mut res = 0; let mut res = 0;
let mut trivias = trivias.enumerate().peekable(); let mut trivias = trivias.enumerate().peekable();

View file

@ -98,7 +98,7 @@ fn test_local_syntax_ptr() {
use crate::{ast, AstNode, SourceFile}; use crate::{ast, AstNode, SourceFile};
let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap();
let field = file.syntax().descendants().find_map(ast::RecordFieldDef::cast).unwrap(); let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap();
let ptr = SyntaxNodePtr::new(field.syntax()); let ptr = SyntaxNodePtr::new(field.syntax());
let field_syntax = ptr.to_node(file.syntax()); let field_syntax = ptr.to_node(file.syntax());
assert_eq!(field.syntax(), &field_syntax); assert_eq!(field.syntax(), &field_syntax);

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..34
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..34 RECORD_FIELD_LIST@9..34
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..21 RECORD_FIELD@15..21
NAME@15..16 NAME@15..16
IDENT@15..16 "a" IDENT@15..16 "a"
COLON@16..17 ":" COLON@16..17 ":"
@ -19,7 +19,7 @@ SOURCE_FILE@0..34
NAME_REF@18..21 NAME_REF@18..21
IDENT@18..21 "u32" IDENT@18..21 "u32"
WHITESPACE@21..26 "\n " WHITESPACE@21..26 "\n "
RECORD_FIELD_DEF@26..32 RECORD_FIELD@26..32
NAME@26..27 NAME@26..27
IDENT@26..27 "b" IDENT@26..27 "b"
COLON@27..28 ":" COLON@27..28 ":"

View file

@ -11,7 +11,7 @@ SOURCE_FILE@0..21
NAME@17..18 NAME@17..18
IDENT@17..18 "S" IDENT@17..18 "S"
WHITESPACE@18..19 " " WHITESPACE@18..19 " "
RECORD_FIELD_DEF_LIST@19..21 RECORD_FIELD_LIST@19..21
L_CURLY@19..20 "{" L_CURLY@19..20 "{"
R_CURLY@20..21 "}" R_CURLY@20..21 "}"
error 0..0: expected an item error 0..0: expected an item

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..40
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..39 RECORD_FIELD_LIST@9..39
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..21 RECORD_FIELD@15..21
NAME@15..16 NAME@15..16
IDENT@15..16 "a" IDENT@15..16 "a"
COLON@16..17 ":" COLON@16..17 ":"
@ -20,7 +20,7 @@ SOURCE_FILE@0..40
IDENT@18..21 "i32" IDENT@18..21 "i32"
COMMA@21..22 "," COMMA@21..22 ","
WHITESPACE@22..27 "\n " WHITESPACE@22..27 "\n "
RECORD_FIELD_DEF@27..36 RECORD_FIELD@27..36
NAME@27..28 NAME@27..28
IDENT@27..28 "b" IDENT@27..28 "b"
COLON@28..29 ":" COLON@28..29 ":"

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..74
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..73 RECORD_FIELD_LIST@9..73
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..21 RECORD_FIELD@15..21
NAME@15..16 NAME@15..16
IDENT@15..16 "f" IDENT@15..16 "f"
COLON@16..17 ":" COLON@16..17 ":"
@ -35,7 +35,7 @@ SOURCE_FILE@0..74
ERROR@42..43 ERROR@42..43
STAR@42..43 "*" STAR@42..43 "*"
WHITESPACE@43..48 "\n " WHITESPACE@43..48 "\n "
RECORD_FIELD_DEF@48..58 RECORD_FIELD@48..58
VISIBILITY@48..51 VISIBILITY@48..51
PUB_KW@48..51 "pub" PUB_KW@48..51 "pub"
WHITESPACE@51..52 " " WHITESPACE@51..52 " "
@ -50,7 +50,7 @@ SOURCE_FILE@0..74
IDENT@55..58 "u32" IDENT@55..58 "u32"
COMMA@58..59 "," COMMA@58..59 ","
WHITESPACE@59..64 "\n " WHITESPACE@59..64 "\n "
RECORD_FIELD_DEF@64..70 RECORD_FIELD@64..70
NAME@64..65 NAME@64..65
IDENT@64..65 "z" IDENT@64..65 "z"
COLON@65..66 ":" COLON@65..66 ":"

View file

@ -7,10 +7,10 @@ SOURCE_FILE@0..86
WHITESPACE@10..11 " " WHITESPACE@10..11 " "
NAME@11..16 NAME@11..16
IDENT@11..16 "Cache" IDENT@11..16 "Cache"
TUPLE_FIELD_DEF_LIST@16..72 TUPLE_FIELD_LIST@16..72
L_PAREN@16..17 "(" L_PAREN@16..17 "("
WHITESPACE@17..22 "\n " WHITESPACE@17..22 "\n "
TUPLE_FIELD_DEF@22..68 TUPLE_FIELD@22..68
PATH_TYPE@22..68 PATH_TYPE@22..68
PATH@22..68 PATH@22..68
PATH_SEGMENT@22..68 PATH_SEGMENT@22..68
@ -47,7 +47,7 @@ SOURCE_FILE@0..86
ERROR@67..68 ERROR@67..68
AT@67..68 "@" AT@67..68 "@"
WHITESPACE@68..69 " " WHITESPACE@68..69 " "
TUPLE_FIELD_DEF@69..72 TUPLE_FIELD@69..72
PATH_TYPE@69..72 PATH_TYPE@69..72
PATH@69..72 PATH@69..72
PATH_SEGMENT@69..72 PATH_SEGMENT@69..72

View file

@ -28,9 +28,9 @@ SOURCE_FILE@0..575
ENUM_VARIANT@50..62 ENUM_VARIANT@50..62
NAME@50..54 NAME@50..54
IDENT@50..54 "Var2" IDENT@50..54 "Var2"
TUPLE_FIELD_DEF_LIST@54..62 TUPLE_FIELD_LIST@54..62
L_PAREN@54..55 "(" L_PAREN@54..55 "("
TUPLE_FIELD_DEF@55..61 TUPLE_FIELD@55..61
PATH_TYPE@55..61 PATH_TYPE@55..61
PATH@55..61 PATH@55..61
PATH_SEGMENT@55..61 PATH_SEGMENT@55..61
@ -43,10 +43,10 @@ SOURCE_FILE@0..575
NAME@72..76 NAME@72..76
IDENT@72..76 "Var3" IDENT@72..76 "Var3"
WHITESPACE@76..77 " " WHITESPACE@76..77 " "
RECORD_FIELD_DEF_LIST@77..145 RECORD_FIELD_LIST@77..145
L_CURLY@77..78 "{" L_CURLY@77..78 "{"
WHITESPACE@78..91 "\n " WHITESPACE@78..91 "\n "
RECORD_FIELD_DEF@91..95 RECORD_FIELD@91..95
NAME@91..94 NAME@91..94
IDENT@91..94 "abc" IDENT@91..94 "abc"
COLON@94..95 ":" COLON@94..95 ":"
@ -108,10 +108,10 @@ SOURCE_FILE@0..575
NAME@250..259 NAME@250..259
IDENT@250..259 "StillFine" IDENT@250..259 "StillFine"
WHITESPACE@259..260 " " WHITESPACE@259..260 " "
RECORD_FIELD_DEF_LIST@260..293 RECORD_FIELD_LIST@260..293
L_CURLY@260..261 "{" L_CURLY@260..261 "{"
WHITESPACE@261..274 "\n " WHITESPACE@261..274 "\n "
RECORD_FIELD_DEF@274..282 RECORD_FIELD@274..282
NAME@274..277 NAME@274..277
IDENT@274..277 "def" IDENT@274..277 "def"
COLON@277..278 ":" COLON@277..278 ":"
@ -146,9 +146,9 @@ SOURCE_FILE@0..575
ENUM_VARIANT@363..372 ENUM_VARIANT@363..372
NAME@363..367 NAME@363..367
IDENT@363..367 "Nope" IDENT@363..367 "Nope"
TUPLE_FIELD_DEF_LIST@367..372 TUPLE_FIELD_LIST@367..372
L_PAREN@367..368 "(" L_PAREN@367..368 "("
TUPLE_FIELD_DEF@368..371 TUPLE_FIELD@368..371
PATH_TYPE@368..371 PATH_TYPE@368..371
PATH@368..371 PATH@368..371
PATH_SEGMENT@368..371 PATH_SEGMENT@368..371

View file

@ -86,7 +86,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax
fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
let res = match node.kind() { let res = match node.kind() {
BLOCK => grammar::block, BLOCK => grammar::block,
RECORD_FIELD_DEF_LIST => grammar::record_field_def_list, RECORD_FIELD_LIST => grammar::record_field_list,
_ => return None, _ => return None,
}; };
Some(res) Some(res)
@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax
let res = match node.kind() { let res = match node.kind() {
; ;
let end = u32::from(range.end()) as usize; let end = u32::from(range.end()) as usize;
text.replaT => grammar::record_field_def_list, text.replaT => grammar::record_field_list,
_ => return None, _ => return None,
}; };
Some(res) Some(res)

View file

@ -22,10 +22,10 @@ SOURCE_FILE@0..71
NAME@27..28 NAME@27..28
IDENT@27..28 "S" IDENT@27..28 "S"
WHITESPACE@28..29 " " WHITESPACE@28..29 " "
RECORD_FIELD_DEF_LIST@29..49 RECORD_FIELD_LIST@29..49
L_CURLY@29..30 "{" L_CURLY@29..30 "{"
WHITESPACE@30..31 " " WHITESPACE@30..31 " "
RECORD_FIELD_DEF@31..47 RECORD_FIELD@31..47
VISIBILITY@31..36 VISIBILITY@31..36
CRATE_KW@31..36 "crate" CRATE_KW@31..36 "crate"
WHITESPACE@36..37 " " WHITESPACE@36..37 " "
@ -46,9 +46,9 @@ SOURCE_FILE@0..71
WHITESPACE@56..57 " " WHITESPACE@56..57 " "
NAME@57..58 NAME@57..58
IDENT@57..58 "T" IDENT@57..58 "T"
TUPLE_FIELD_DEF_LIST@58..69 TUPLE_FIELD_LIST@58..69
L_PAREN@58..59 "(" L_PAREN@58..59 "("
TUPLE_FIELD_DEF@59..68 TUPLE_FIELD@59..68
VISIBILITY@59..64 VISIBILITY@59..64
CRATE_KW@59..64 "crate" CRATE_KW@59..64 "crate"
WHITESPACE@64..65 " " WHITESPACE@64..65 " "

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..64
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..63 RECORD_FIELD_LIST@9..63
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..60 RECORD_FIELD@15..60
ATTR@15..43 ATTR@15..43
POUND@15..16 "#" POUND@15..16 "#"
L_BRACK@16..17 "[" L_BRACK@16..17 "["

View file

@ -5,7 +5,7 @@ SOURCE_FILE@0..51
NAME@6..9 NAME@6..9
IDENT@6..9 "Foo" IDENT@6..9 "Foo"
WHITESPACE@9..10 " " WHITESPACE@9..10 " "
RECORD_FIELD_DEF_LIST@10..12 RECORD_FIELD_LIST@10..12
L_CURLY@10..11 "{" L_CURLY@10..11 "{"
R_CURLY@11..12 "}" R_CURLY@11..12 "}"
WHITESPACE@12..13 "\n" WHITESPACE@12..13 "\n"
@ -15,10 +15,10 @@ SOURCE_FILE@0..51
NAME@19..22 NAME@19..22
IDENT@19..22 "Foo" IDENT@19..22 "Foo"
WHITESPACE@22..23 " " WHITESPACE@22..23 " "
RECORD_FIELD_DEF_LIST@23..50 RECORD_FIELD_LIST@23..50
L_CURLY@23..24 "{" L_CURLY@23..24 "{"
WHITESPACE@24..29 "\n " WHITESPACE@24..29 "\n "
RECORD_FIELD_DEF@29..35 RECORD_FIELD@29..35
NAME@29..30 NAME@29..30
IDENT@29..30 "a" IDENT@29..30 "a"
COLON@30..31 ":" COLON@30..31 ":"
@ -30,7 +30,7 @@ SOURCE_FILE@0..51
IDENT@32..35 "i32" IDENT@32..35 "i32"
COMMA@35..36 "," COMMA@35..36 ","
WHITESPACE@36..41 "\n " WHITESPACE@36..41 "\n "
RECORD_FIELD_DEF@41..47 RECORD_FIELD@41..47
NAME@41..42 NAME@41..42
IDENT@41..42 "b" IDENT@41..42 "b"
COLON@42..43 ":" COLON@42..43 ":"

View file

@ -12,7 +12,7 @@ SOURCE_FILE@0..106
NAME@19..22 NAME@19..22
IDENT@19..22 "Foo" IDENT@19..22 "Foo"
WHITESPACE@22..23 " " WHITESPACE@22..23 " "
RECORD_FIELD_DEF_LIST@23..25 RECORD_FIELD_LIST@23..25
L_CURLY@23..24 "{" L_CURLY@23..24 "{"
R_CURLY@24..25 "}" R_CURLY@24..25 "}"
WHITESPACE@25..26 "\n" WHITESPACE@25..26 "\n"
@ -21,7 +21,7 @@ SOURCE_FILE@0..106
WHITESPACE@32..33 " " WHITESPACE@32..33 " "
NAME@33..36 NAME@33..36
IDENT@33..36 "Foo" IDENT@33..36 "Foo"
TUPLE_FIELD_DEF_LIST@36..38 TUPLE_FIELD_LIST@36..38
L_PAREN@36..37 "(" L_PAREN@36..37 "("
R_PAREN@37..38 ")" R_PAREN@37..38 ")"
SEMICOLON@38..39 ";" SEMICOLON@38..39 ";"
@ -31,9 +31,9 @@ SOURCE_FILE@0..106
WHITESPACE@46..47 " " WHITESPACE@46..47 " "
NAME@47..50 NAME@47..50
IDENT@47..50 "Foo" IDENT@47..50 "Foo"
TUPLE_FIELD_DEF_LIST@50..65 TUPLE_FIELD_LIST@50..65
L_PAREN@50..51 "(" L_PAREN@50..51 "("
TUPLE_FIELD_DEF@51..57 TUPLE_FIELD@51..57
PATH_TYPE@51..57 PATH_TYPE@51..57
PATH@51..57 PATH@51..57
PATH_SEGMENT@51..57 PATH_SEGMENT@51..57
@ -41,7 +41,7 @@ SOURCE_FILE@0..106
IDENT@51..57 "String" IDENT@51..57 "String"
COMMA@57..58 "," COMMA@57..58 ","
WHITESPACE@58..59 " " WHITESPACE@58..59 " "
TUPLE_FIELD_DEF@59..64 TUPLE_FIELD@59..64
PATH_TYPE@59..64 PATH_TYPE@59..64
PATH@59..64 PATH@59..64
PATH_SEGMENT@59..64 PATH_SEGMENT@59..64
@ -56,10 +56,10 @@ SOURCE_FILE@0..106
NAME@74..77 NAME@74..77
IDENT@74..77 "Foo" IDENT@74..77 "Foo"
WHITESPACE@77..78 " " WHITESPACE@77..78 " "
RECORD_FIELD_DEF_LIST@78..105 RECORD_FIELD_LIST@78..105
L_CURLY@78..79 "{" L_CURLY@78..79 "{"
WHITESPACE@79..84 "\n " WHITESPACE@79..84 "\n "
RECORD_FIELD_DEF@84..90 RECORD_FIELD@84..90
NAME@84..85 NAME@84..85
IDENT@84..85 "a" IDENT@84..85 "a"
COLON@85..86 ":" COLON@85..86 ":"
@ -71,7 +71,7 @@ SOURCE_FILE@0..106
IDENT@87..90 "i32" IDENT@87..90 "i32"
COMMA@90..91 "," COMMA@90..91 ","
WHITESPACE@91..96 "\n " WHITESPACE@91..96 "\n "
RECORD_FIELD_DEF@96..102 RECORD_FIELD@96..102
NAME@96..97 NAME@96..97
IDENT@96..97 "b" IDENT@96..97 "b"
COLON@97..98 ":" COLON@97..98 ":"

View file

@ -10,9 +10,9 @@ SOURCE_FILE@0..53
NAME@12..13 NAME@12..13
IDENT@12..13 "T" IDENT@12..13 "T"
R_ANGLE@13..14 ">" R_ANGLE@13..14 ">"
TUPLE_FIELD_DEF_LIST@14..17 TUPLE_FIELD_LIST@14..17
L_PAREN@14..15 "(" L_PAREN@14..15 "("
TUPLE_FIELD_DEF@15..16 TUPLE_FIELD@15..16
PATH_TYPE@15..16 PATH_TYPE@15..16
PATH@15..16 PATH@15..16
PATH_SEGMENT@15..16 PATH_SEGMENT@15..16
@ -51,9 +51,9 @@ SOURCE_FILE@0..53
NAME@46..47 NAME@46..47
IDENT@46..47 "T" IDENT@46..47 "T"
R_ANGLE@47..48 ">" R_ANGLE@47..48 ">"
TUPLE_FIELD_DEF_LIST@48..51 TUPLE_FIELD_LIST@48..51
L_PAREN@48..49 "(" L_PAREN@48..49 "("
TUPLE_FIELD_DEF@49..50 TUPLE_FIELD@49..50
PATH_TYPE@49..50 PATH_TYPE@49..50
PATH@49..50 PATH@49..50
PATH_SEGMENT@49..50 PATH_SEGMENT@49..50

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..60
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
TUPLE_FIELD_DEF_LIST@9..58 TUPLE_FIELD_LIST@9..58
L_PAREN@9..10 "(" L_PAREN@9..10 "("
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
TUPLE_FIELD_DEF@15..55 TUPLE_FIELD@15..55
ATTR@15..43 ATTR@15..43
POUND@15..16 "#" POUND@15..16 "#"
L_BRACK@16..17 "[" L_BRACK@16..17 "["

View file

@ -53,7 +53,7 @@ SOURCE_FILE@0..111
NAME@103..104 NAME@103..104
IDENT@103..104 "S" IDENT@103..104 "S"
WHITESPACE@104..105 " " WHITESPACE@104..105 " "
RECORD_FIELD_DEF_LIST@105..107 RECORD_FIELD_LIST@105..107
L_CURLY@105..106 "{" L_CURLY@105..106 "{"
R_CURLY@106..107 "}" R_CURLY@106..107 "}"
SEMICOLON@107..108 ";" SEMICOLON@107..108 ";"

View file

@ -11,9 +11,9 @@ SOURCE_FILE@0..23
ENUM_VARIANT@9..20 ENUM_VARIANT@9..20
NAME@9..10 NAME@9..10
IDENT@9..10 "X" IDENT@9..10 "X"
TUPLE_FIELD_DEF_LIST@10..15 TUPLE_FIELD_LIST@10..15
L_PAREN@10..11 "(" L_PAREN@10..11 "("
TUPLE_FIELD_DEF@11..14 TUPLE_FIELD@11..14
PATH_TYPE@11..14 PATH_TYPE@11..14
PATH@11..14 PATH@11..14
PATH_SEGMENT@11..14 PATH_SEGMENT@11..14

View file

@ -20,10 +20,10 @@ SOURCE_FILE@0..32
IDENT@12..16 "Copy" IDENT@12..16 "Copy"
R_ANGLE@16..17 ">" R_ANGLE@16..17 ">"
WHITESPACE@17..18 " " WHITESPACE@17..18 " "
RECORD_FIELD_DEF_LIST@18..31 RECORD_FIELD_LIST@18..31
L_CURLY@18..19 "{" L_CURLY@18..19 "{"
WHITESPACE@19..24 "\n " WHITESPACE@19..24 "\n "
RECORD_FIELD_DEF@24..28 RECORD_FIELD@24..28
NAME@24..25 NAME@24..25
IDENT@24..25 "f" IDENT@24..25 "f"
COLON@25..26 ":" COLON@25..26 ":"

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..25
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..25 RECORD_FIELD_LIST@9..25
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..23 RECORD_FIELD@15..23
NAME@15..18 NAME@15..18
IDENT@15..18 "foo" IDENT@15..18 "foo"
COLON@18..19 ":" COLON@18..19 ":"

View file

@ -46,7 +46,7 @@ SOURCE_FILE@0..118
NAME@59..60 NAME@59..60
IDENT@59..60 "S" IDENT@59..60 "S"
WHITESPACE@60..61 " " WHITESPACE@60..61 " "
RECORD_FIELD_DEF_LIST@61..63 RECORD_FIELD_LIST@61..63
L_CURLY@61..62 "{" L_CURLY@61..62 "{"
R_CURLY@62..63 "}" R_CURLY@62..63 "}"
WHITESPACE@63..64 "\n" WHITESPACE@63..64 "\n"

View file

@ -12,7 +12,7 @@ SOURCE_FILE@0..97
NAME@17..18 NAME@17..18
IDENT@17..18 "B" IDENT@17..18 "B"
WHITESPACE@18..19 " " WHITESPACE@18..19 " "
RECORD_FIELD_DEF_LIST@19..21 RECORD_FIELD_LIST@19..21
L_CURLY@19..20 "{" L_CURLY@19..20 "{"
R_CURLY@20..21 "}" R_CURLY@20..21 "}"
WHITESPACE@21..22 "\n" WHITESPACE@21..22 "\n"
@ -21,7 +21,7 @@ SOURCE_FILE@0..97
WHITESPACE@28..29 " " WHITESPACE@28..29 " "
NAME@29..30 NAME@29..30
IDENT@29..30 "C" IDENT@29..30 "C"
TUPLE_FIELD_DEF_LIST@30..32 TUPLE_FIELD_LIST@30..32
L_PAREN@30..31 "(" L_PAREN@30..31 "("
R_PAREN@31..32 ")" R_PAREN@31..32 ")"
SEMICOLON@32..33 ";" SEMICOLON@32..33 ";"
@ -32,10 +32,10 @@ SOURCE_FILE@0..97
NAME@42..43 NAME@42..43
IDENT@42..43 "D" IDENT@42..43 "D"
WHITESPACE@43..44 " " WHITESPACE@43..44 " "
RECORD_FIELD_DEF_LIST@44..74 RECORD_FIELD_LIST@44..74
L_CURLY@44..45 "{" L_CURLY@44..45 "{"
WHITESPACE@45..50 "\n " WHITESPACE@45..50 "\n "
RECORD_FIELD_DEF@50..56 RECORD_FIELD@50..56
NAME@50..51 NAME@50..51
IDENT@50..51 "a" IDENT@50..51 "a"
COLON@51..52 ":" COLON@51..52 ":"
@ -47,7 +47,7 @@ SOURCE_FILE@0..97
IDENT@53..56 "u32" IDENT@53..56 "u32"
COMMA@56..57 "," COMMA@56..57 ","
WHITESPACE@57..62 "\n " WHITESPACE@57..62 "\n "
RECORD_FIELD_DEF@62..72 RECORD_FIELD@62..72
VISIBILITY@62..65 VISIBILITY@62..65
PUB_KW@62..65 "pub" PUB_KW@62..65 "pub"
WHITESPACE@65..66 " " WHITESPACE@65..66 " "
@ -68,9 +68,9 @@ SOURCE_FILE@0..97
WHITESPACE@82..83 " " WHITESPACE@82..83 " "
NAME@83..84 NAME@83..84
IDENT@83..84 "E" IDENT@83..84 "E"
TUPLE_FIELD_DEF_LIST@84..95 TUPLE_FIELD_LIST@84..95
L_PAREN@84..85 "(" L_PAREN@84..85 "("
TUPLE_FIELD_DEF@85..90 TUPLE_FIELD@85..90
VISIBILITY@85..88 VISIBILITY@85..88
PUB_KW@85..88 "pub" PUB_KW@85..88 "pub"
WHITESPACE@88..89 " " WHITESPACE@88..89 " "
@ -81,7 +81,7 @@ SOURCE_FILE@0..97
IDENT@89..90 "x" IDENT@89..90 "x"
COMMA@90..91 "," COMMA@90..91 ","
WHITESPACE@91..92 " " WHITESPACE@91..92 " "
TUPLE_FIELD_DEF@92..93 TUPLE_FIELD@92..93
PATH_TYPE@92..93 PATH_TYPE@92..93
PATH@92..93 PATH@92..93
PATH_SEGMENT@92..93 PATH_SEGMENT@92..93

View file

@ -23,9 +23,9 @@ SOURCE_FILE@0..290
NAME@24..25 NAME@24..25
IDENT@24..25 "T" IDENT@24..25 "T"
R_ANGLE@25..26 ">" R_ANGLE@25..26 ">"
TUPLE_FIELD_DEF_LIST@26..31 TUPLE_FIELD_LIST@26..31
L_PAREN@26..27 "(" L_PAREN@26..27 "("
TUPLE_FIELD_DEF@27..30 TUPLE_FIELD@27..30
PATH_TYPE@27..30 PATH_TYPE@27..30
PATH@27..30 PATH@27..30
PATH_SEGMENT@27..30 PATH_SEGMENT@27..30
@ -46,10 +46,10 @@ SOURCE_FILE@0..290
IDENT@43..44 "T" IDENT@43..44 "T"
R_ANGLE@44..45 ">" R_ANGLE@44..45 ">"
WHITESPACE@45..46 " " WHITESPACE@45..46 " "
RECORD_FIELD_DEF_LIST@46..56 RECORD_FIELD_LIST@46..56
L_CURLY@46..47 "{" L_CURLY@46..47 "{"
WHITESPACE@47..48 " " WHITESPACE@47..48 " "
RECORD_FIELD_DEF@48..54 RECORD_FIELD@48..54
NAME@48..49 NAME@48..49
IDENT@48..49 "u" IDENT@48..49 "u"
COLON@49..50 ":" COLON@49..50 ":"

View file

@ -86,10 +86,10 @@ SOURCE_FILE@0..182
NAME@101..102 NAME@101..102
IDENT@101..102 "C" IDENT@101..102 "C"
WHITESPACE@102..103 " " WHITESPACE@102..103 " "
RECORD_FIELD_DEF_LIST@103..146 RECORD_FIELD_LIST@103..146
L_CURLY@103..104 "{" L_CURLY@103..104 "{"
WHITESPACE@104..113 "\n " WHITESPACE@104..113 "\n "
RECORD_FIELD_DEF@113..119 RECORD_FIELD@113..119
NAME@113..114 NAME@113..114
IDENT@113..114 "a" IDENT@113..114 "a"
COLON@114..115 ":" COLON@114..115 ":"
@ -101,7 +101,7 @@ SOURCE_FILE@0..182
IDENT@116..119 "u32" IDENT@116..119 "u32"
COMMA@119..120 "," COMMA@119..120 ","
WHITESPACE@120..129 "\n " WHITESPACE@120..129 "\n "
RECORD_FIELD_DEF@129..139 RECORD_FIELD@129..139
VISIBILITY@129..132 VISIBILITY@129..132
PUB_KW@129..132 "pub" PUB_KW@129..132 "pub"
WHITESPACE@132..133 " " WHITESPACE@132..133 " "
@ -123,7 +123,7 @@ SOURCE_FILE@0..182
NAME@152..153 NAME@152..153
IDENT@152..153 "F" IDENT@152..153 "F"
WHITESPACE@153..154 " " WHITESPACE@153..154 " "
RECORD_FIELD_DEF_LIST@154..156 RECORD_FIELD_LIST@154..156
L_CURLY@154..155 "{" L_CURLY@154..155 "{"
R_CURLY@155..156 "}" R_CURLY@155..156 "}"
COMMA@156..157 "," COMMA@156..157 ","
@ -131,9 +131,9 @@ SOURCE_FILE@0..182
ENUM_VARIANT@162..169 ENUM_VARIANT@162..169
NAME@162..163 NAME@162..163
IDENT@162..163 "D" IDENT@162..163 "D"
TUPLE_FIELD_DEF_LIST@163..169 TUPLE_FIELD_LIST@163..169
L_PAREN@163..164 "(" L_PAREN@163..164 "("
TUPLE_FIELD_DEF@164..167 TUPLE_FIELD@164..167
PATH_TYPE@164..167 PATH_TYPE@164..167
PATH@164..167 PATH@164..167
PATH_SEGMENT@164..167 PATH_SEGMENT@164..167
@ -146,7 +146,7 @@ SOURCE_FILE@0..182
ENUM_VARIANT@175..178 ENUM_VARIANT@175..178
NAME@175..176 NAME@175..176
IDENT@175..176 "E" IDENT@175..176 "E"
TUPLE_FIELD_DEF_LIST@176..178 TUPLE_FIELD_LIST@176..178
L_PAREN@176..177 "(" L_PAREN@176..177 "("
R_PAREN@177..178 ")" R_PAREN@177..178 ")"
COMMA@178..179 "," COMMA@178..179 ","

View file

@ -1571,10 +1571,10 @@ SOURCE_FILE@0..3813
LIFETIME@2863..2869 "\'union" LIFETIME@2863..2869 "\'union"
R_ANGLE@2869..2870 ">" R_ANGLE@2869..2870 ">"
WHITESPACE@2870..2871 " " WHITESPACE@2870..2871 " "
RECORD_FIELD_DEF_LIST@2871..2904 RECORD_FIELD_LIST@2871..2904
L_CURLY@2871..2872 "{" L_CURLY@2871..2872 "{"
WHITESPACE@2872..2873 " " WHITESPACE@2872..2873 " "
RECORD_FIELD_DEF@2873..2901 RECORD_FIELD@2873..2901
NAME@2873..2878 NAME@2873..2878
IDENT@2873..2878 "union" IDENT@2873..2878 "union"
COLON@2878..2879 ":" COLON@2878..2879 ":"

View file

@ -5,10 +5,10 @@ SOURCE_FILE@0..27
NAME@7..8 NAME@7..8
IDENT@7..8 "S" IDENT@7..8 "S"
WHITESPACE@8..9 " " WHITESPACE@8..9 " "
RECORD_FIELD_DEF_LIST@9..27 RECORD_FIELD_LIST@9..27
L_CURLY@9..10 "{" L_CURLY@9..10 "{"
WHITESPACE@10..15 "\n " WHITESPACE@10..15 "\n "
RECORD_FIELD_DEF@15..25 RECORD_FIELD@15..25
NAME@15..20 NAME@15..20
IDENT@15..20 "r#foo" IDENT@15..20 "r#foo"
COLON@20..21 ":" COLON@20..21 ":"

View file

@ -7,10 +7,10 @@ SOURCE_FILE@0..160
NAME@69..73 NAME@69..73
IDENT@69..73 "Repr" IDENT@69..73 "Repr"
WHITESPACE@73..74 " " WHITESPACE@73..74 " "
RECORD_FIELD_DEF_LIST@74..90 RECORD_FIELD_LIST@74..90
L_CURLY@74..75 "{" L_CURLY@74..75 "{"
WHITESPACE@75..76 " " WHITESPACE@75..76 " "
RECORD_FIELD_DEF@76..88 RECORD_FIELD@76..88
NAME@76..79 NAME@76..79
IDENT@76..79 "raw" IDENT@76..79 "raw"
COLON@79..80 ":" COLON@79..80 ":"

View file

@ -268,9 +268,9 @@ SOURCE_FILE@0..395
ENUM_VARIANT@356..365 ENUM_VARIANT@356..365
NAME@356..357 NAME@356..357
IDENT@356..357 "B" IDENT@356..357 "B"
TUPLE_FIELD_DEF_LIST@357..365 TUPLE_FIELD_LIST@357..365
L_PAREN@357..358 "(" L_PAREN@357..358 "("
TUPLE_FIELD_DEF@358..360 TUPLE_FIELD@358..360
PATH_TYPE@358..360 PATH_TYPE@358..360
PATH@358..360 PATH@358..360
PATH_SEGMENT@358..360 PATH_SEGMENT@358..360
@ -278,7 +278,7 @@ SOURCE_FILE@0..395
IDENT@358..360 "i8" IDENT@358..360 "i8"
COMMA@360..361 "," COMMA@360..361 ","
WHITESPACE@361..362 " " WHITESPACE@361..362 " "
TUPLE_FIELD_DEF@362..364 TUPLE_FIELD@362..364
PATH_TYPE@362..364 PATH_TYPE@362..364
PATH@362..364 PATH@362..364
PATH_SEGMENT@362..364 PATH_SEGMENT@362..364

View file

@ -39,7 +39,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
SyntaxKind::MODULE => lsp_types::SymbolKind::Module, SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter,
SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field, SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field,
SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant,
SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant,
SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object,

View file

@ -180,10 +180,10 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
"EXTERN_BLOCK", "EXTERN_BLOCK",
"EXTERN_ITEM_LIST", "EXTERN_ITEM_LIST",
"ENUM_VARIANT", "ENUM_VARIANT",
"RECORD_FIELD_DEF_LIST", "RECORD_FIELD_LIST",
"RECORD_FIELD_DEF", "RECORD_FIELD",
"TUPLE_FIELD_DEF_LIST", "TUPLE_FIELD_LIST",
"TUPLE_FIELD_DEF", "TUPLE_FIELD",
"ENUM_VARIANT_LIST", "ENUM_VARIANT_LIST",
"ITEM_LIST", "ITEM_LIST",
"ASSOC_ITEM_LIST", "ASSOC_ITEM_LIST",

View file

@ -78,30 +78,30 @@ TypeAlias =
StructDef = StructDef =
Attr* Visibility? 'struct' Name GenericParamList? ( Attr* Visibility? 'struct' Name GenericParamList? (
WhereClause? (RecordFieldDefList | ';') WhereClause? (RecordFieldList | ';')
| TupleFieldDefList WhereClause? ';' | TupleFieldList WhereClause? ';'
) )
RecordFieldDefList = RecordFieldList =
'{' fields:RecordFieldDef* '}' '{' fields:RecordField* '}'
RecordFieldDef = RecordField =
Attr* Visibility? Name ':' ascribed_type:TypeRef Attr* Visibility? Name ':' ascribed_type:TypeRef
TupleFieldDefList = TupleFieldList =
'(' fields:TupleFieldDef* ')' '(' fields:TupleField* ')'
TupleFieldDef = TupleField =
Attr* Visibility? Name TypeRef Attr* Visibility? Name TypeRef
FieldDefList = FieldList =
RecordFieldDefList RecordFieldList
| TupleFieldDefList | TupleFieldList
UnionDef = UnionDef =
Attr* Visibility? 'union' Name GenericParamList? WhereClause? Attr* Visibility? 'union' Name GenericParamList? WhereClause?
RecordFieldDefList RecordFieldList
EnumDef = EnumDef =
Attr* Visibility? 'enum' Name GenericParamList? WhereClause? Attr* Visibility? 'enum' Name GenericParamList? WhereClause?
@ -111,7 +111,7 @@ EnumVariantList =
'{' variants:EnumVariant* '}' '{' variants:EnumVariant* '}'
EnumVariant = EnumVariant =
Attr* Visibility? Name FieldDefList ('=' Expr)? Attr* Visibility? Name FieldList ('=' Expr)?
TraitDef = TraitDef =
Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList