mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Merge #5597
5597: Rename FieldDef -> Field r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
a257fd06b3
54 changed files with 219 additions and 228 deletions
|
@ -47,7 +47,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
|||
}
|
||||
(vis_offset(&parent), keyword.text_range())
|
||||
} 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 {
|
||||
mark::hit!(change_visibility_field_false_positive);
|
||||
return None;
|
||||
|
@ -56,7 +56,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
|||
return None;
|
||||
}
|
||||
(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() {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -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::StructDef(it) => {
|
||||
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
|
||||
}
|
||||
|
|
|
@ -361,8 +361,8 @@ pub struct Field {
|
|||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum FieldSource {
|
||||
Named(ast::RecordFieldDef),
|
||||
Pos(ast::TupleFieldDef),
|
||||
Named(ast::RecordField),
|
||||
Pos(ast::TupleField),
|
||||
}
|
||||
|
||||
impl Field {
|
||||
|
|
|
@ -589,8 +589,8 @@ to_def_impls![
|
|||
(crate::Const, ast::ConstDef, const_to_def),
|
||||
(crate::Static, ast::StaticDef, static_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::Field, ast::RecordField, record_field_to_def),
|
||||
(crate::Field, ast::TupleField, tuple_field_to_def),
|
||||
(crate::EnumVariant, ast::EnumVariant, enum_variant_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
|
||||
|
|
|
@ -92,16 +92,10 @@ impl SourceToDefCtx<'_, '_> {
|
|||
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(
|
||||
&mut self,
|
||||
src: InFile<ast::RecordFieldDef>,
|
||||
) -> Option<FieldId> {
|
||||
pub(super) fn record_field_to_def(&mut self, src: InFile<ast::RecordField>) -> Option<FieldId> {
|
||||
self.to_def(src, keys::RECORD_FIELD)
|
||||
}
|
||||
pub(super) fn tuple_field_to_def(
|
||||
&mut self,
|
||||
src: InFile<ast::TupleFieldDef>,
|
||||
) -> Option<FieldId> {
|
||||
pub(super) fn tuple_field_to_def(&mut self, src: InFile<ast::TupleField>) -> Option<FieldId> {
|
||||
self.to_def(src, keys::TUPLE_FIELD)
|
||||
}
|
||||
pub(super) fn enum_variant_to_def(
|
||||
|
|
|
@ -179,7 +179,7 @@ impl VariantData {
|
|||
|
||||
impl HasChildSource for VariantId {
|
||||
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>> {
|
||||
let (src, module_id) = match self {
|
||||
|
@ -194,7 +194,7 @@ impl HasChildSource for VariantId {
|
|||
}
|
||||
VariantId::UnionId(it) => (
|
||||
it.lookup(db).source(db).map(|it| {
|
||||
it.record_field_def_list()
|
||||
it.record_field_list()
|
||||
.map(ast::StructKind::Record)
|
||||
.unwrap_or(ast::StructKind::Unit)
|
||||
}),
|
||||
|
@ -218,7 +218,7 @@ pub enum StructKind {
|
|||
fn lower_struct(
|
||||
db: &dyn DefDatabase,
|
||||
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>,
|
||||
) -> StructKind {
|
||||
let ctx = LowerCtx::new(db, ast.file_id);
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
//! AST -> `ItemTree` lowering code.
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
attr::Attrs,
|
||||
generics::{GenericParams, TypeParamData, TypeParamProvenance},
|
||||
};
|
||||
use std::{collections::hash_map::Entry, mem, sync::Arc};
|
||||
|
||||
use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId};
|
||||
use ra_arena::map::ArenaMap;
|
||||
use ra_syntax::{
|
||||
|
@ -12,7 +9,13 @@ use ra_syntax::{
|
|||
SyntaxNode,
|
||||
};
|
||||
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> {
|
||||
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();
|
||||
for field in fields.fields() {
|
||||
if let Some(data) = self.lower_record_field(&field) {
|
||||
|
@ -203,7 +206,7 @@ impl Ctx {
|
|||
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 visibility = self.lower_visibility(field);
|
||||
let type_ref = self.lower_type_ref_opt(field.ascribed_type());
|
||||
|
@ -211,7 +214,7 @@ impl Ctx {
|
|||
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();
|
||||
for (i, field) in fields.fields().enumerate() {
|
||||
let data = self.lower_tuple_field(i, &field);
|
||||
|
@ -222,7 +225,7 @@ impl Ctx {
|
|||
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 visibility = self.lower_visibility(field);
|
||||
let type_ref = self.lower_type_ref_opt(field.type_ref());
|
||||
|
@ -234,10 +237,8 @@ impl Ctx {
|
|||
let visibility = self.lower_visibility(union);
|
||||
let name = union.name()?.as_name();
|
||||
let generic_params = self.lower_generic_params(GenericsOwner::Union, union);
|
||||
let fields = match union.record_field_def_list() {
|
||||
Some(record_field_def_list) => {
|
||||
self.lower_fields(&StructKind::Record(record_field_def_list))
|
||||
}
|
||||
let fields = match union.record_field_list() {
|
||||
Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)),
|
||||
None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())),
|
||||
};
|
||||
let ast_id = self.source_ast_id_map.ast_id(union);
|
||||
|
|
|
@ -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_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new();
|
||||
pub const TUPLE_FIELD: Key<ast::TupleFieldDef, FieldId> = Key::new();
|
||||
pub const RECORD_FIELD: Key<ast::RecordFieldDef, FieldId> = Key::new();
|
||||
pub const TUPLE_FIELD: Key<ast::TupleField, 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 MACRO: Key<ast::MacroCall, MacroDefId> = Key::new();
|
||||
|
|
|
@ -155,21 +155,21 @@ fn missing_struct_field_fix(
|
|||
module = s.module(sema.db);
|
||||
let source = s.source(sema.db);
|
||||
def_file_id = source.file_id;
|
||||
let fields = source.value.field_def_list()?;
|
||||
record_field_def_list(fields)?
|
||||
let fields = source.value.field_list()?;
|
||||
record_field_list(fields)?
|
||||
}
|
||||
VariantDef::Union(u) => {
|
||||
module = u.module(sema.db);
|
||||
let source = u.source(sema.db);
|
||||
def_file_id = source.file_id;
|
||||
source.value.record_field_def_list()?
|
||||
source.value.record_field_list()?
|
||||
}
|
||||
VariantDef::EnumVariant(e) => {
|
||||
module = e.module(sema.db);
|
||||
let source = e.source(sema.db);
|
||||
def_file_id = source.file_id;
|
||||
let fields = source.value.field_def_list()?;
|
||||
record_field_def_list(fields)?
|
||||
let fields = source.value.field_list()?;
|
||||
record_field_list(fields)?
|
||||
}
|
||||
};
|
||||
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());
|
||||
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 {
|
||||
ast::FieldDefList::RecordFieldDefList(it) => Some(it),
|
||||
ast::FieldDefList::TupleFieldDefList(_) => None,
|
||||
ast::FieldList::RecordFieldList(it) => Some(it),
|
||||
ast::FieldList::TupleFieldList(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
|
|||
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(),
|
||||
ast::RecordField(it) => it.doc_comment_text(),
|
||||
ast::EnumVariant(it) => it.doc_comment_text(),
|
||||
ast::MacroCall(it) => it.doc_comment_text(),
|
||||
_ => None,
|
||||
|
@ -412,7 +412,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
|
|||
ast::TypeAlias(it) => it.short_label(),
|
||||
ast::ConstDef(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(),
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
short_label_from_ascribed_node(self, "")
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ fn try_extend_selection(
|
|||
let list_kinds = [
|
||||
RECORD_FIELD_PAT_LIST,
|
||||
MATCH_ARM_LIST,
|
||||
RECORD_FIELD_DEF_LIST,
|
||||
TUPLE_FIELD_DEF_LIST,
|
||||
RECORD_FIELD_LIST,
|
||||
TUPLE_FIELD_LIST,
|
||||
RECORD_EXPR_FIELD_LIST,
|
||||
ENUM_VARIANT_LIST,
|
||||
USE_TREE_LIST,
|
||||
|
|
|
@ -136,7 +136,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
|
|||
let ty = it.type_ref();
|
||||
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::StaticDef(it) => decl_with_ascription(it),
|
||||
ast::ImplDef(it) => {
|
||||
|
@ -249,7 +249,7 @@ fn very_obsolete() {}
|
|||
label: "x",
|
||||
navigation_range: 18..19,
|
||||
node_range: 18..24,
|
||||
kind: RECORD_FIELD_DEF,
|
||||
kind: RECORD_FIELD,
|
||||
detail: Some(
|
||||
"i32",
|
||||
),
|
||||
|
|
|
@ -85,7 +85,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
|
|||
COMMENT => Some(FoldKind::Comment),
|
||||
USE => Some(FoldKind::Imports),
|
||||
ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
|
||||
RECORD_FIELD_DEF_LIST
|
||||
RECORD_FIELD_LIST
|
||||
| RECORD_FIELD_PAT_LIST
|
||||
| RECORD_EXPR_FIELD_LIST
|
||||
| ITEM_LIST
|
||||
|
|
|
@ -361,7 +361,7 @@ fn main(s: Foo) {
|
|||
);
|
||||
check_result(
|
||||
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"],
|
||||
);
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ fn foo() {
|
|||
);
|
||||
check_result(
|
||||
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"],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -711,7 +711,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
|
|||
TRAIT_DEF => HighlightTag::Trait,
|
||||
TYPE_ALIAS => HighlightTag::TypeAlias,
|
||||
TYPE_PARAM => HighlightTag::TypeParam,
|
||||
RECORD_FIELD_DEF => HighlightTag::Field,
|
||||
RECORD_FIELD => HighlightTag::Field,
|
||||
MODULE => HighlightTag::Module,
|
||||
FN => HighlightTag::Function,
|
||||
CONST_DEF => HighlightTag::Constant,
|
||||
|
|
|
@ -142,7 +142,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
|
|||
|
||||
Some(NameClass::Definition(Definition::Local(local)))
|
||||
},
|
||||
ast::RecordFieldDef(it) => {
|
||||
ast::RecordField(it) => {
|
||||
let field: hir::Field = sema.to_def(&it)?;
|
||||
Some(NameClass::Definition(Definition::Field(field)))
|
||||
},
|
||||
|
|
|
@ -494,9 +494,9 @@ MACRO_ITEMS@0..40
|
|||
STRUCT_KW@0..6 "struct"
|
||||
NAME@6..9
|
||||
IDENT@6..9 "Foo"
|
||||
RECORD_FIELD_DEF_LIST@9..20
|
||||
RECORD_FIELD_LIST@9..20
|
||||
L_CURLY@9..10 "{"
|
||||
RECORD_FIELD_DEF@10..19
|
||||
RECORD_FIELD@10..19
|
||||
NAME@10..15
|
||||
IDENT@10..15 "field"
|
||||
COLON@15..16 ":"
|
||||
|
@ -510,9 +510,9 @@ MACRO_ITEMS@0..40
|
|||
STRUCT_KW@20..26 "struct"
|
||||
NAME@26..29
|
||||
IDENT@26..29 "Bar"
|
||||
RECORD_FIELD_DEF_LIST@29..40
|
||||
RECORD_FIELD_LIST@29..40
|
||||
L_CURLY@29..30 "{"
|
||||
RECORD_FIELD_DEF@30..39
|
||||
RECORD_FIELD@30..39
|
||||
NAME@30..35
|
||||
IDENT@30..35 "field"
|
||||
COLON@35..36 ":"
|
||||
|
|
|
@ -142,7 +142,7 @@ pub(crate) fn reparser(
|
|||
) -> Option<fn(&mut Parser)> {
|
||||
let res = match node {
|
||||
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,
|
||||
ENUM_VARIANT_LIST => items::enum_variant_list,
|
||||
MATCH_ARM_LIST => items::match_arm_list,
|
||||
|
|
|
@ -119,7 +119,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) {
|
|||
}
|
||||
}
|
||||
p.expect(T!['}']);
|
||||
m.complete(p, RECORD_FIELD_DEF_LIST);
|
||||
m.complete(p, RECORD_FIELD_LIST);
|
||||
|
||||
fn record_field_def(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
|
@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) {
|
|||
name(p);
|
||||
p.expect(T![:]);
|
||||
types::type_(p);
|
||||
m.complete(p, RECORD_FIELD_DEF);
|
||||
m.complete(p, RECORD_FIELD);
|
||||
} else {
|
||||
m.abandon(p);
|
||||
p.err_and_bump("expected field declaration");
|
||||
|
@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) {
|
|||
break;
|
||||
}
|
||||
types::type_(p);
|
||||
m.complete(p, TUPLE_FIELD_DEF);
|
||||
m.complete(p, TUPLE_FIELD);
|
||||
|
||||
if !p.at(T![')']) {
|
||||
p.expect(T![,]);
|
||||
}
|
||||
}
|
||||
p.expect(T![')']);
|
||||
m.complete(p, TUPLE_FIELD_DEF_LIST);
|
||||
m.complete(p, TUPLE_FIELD_LIST);
|
||||
}
|
||||
|
|
|
@ -207,10 +207,10 @@ pub enum SyntaxKind {
|
|||
EXTERN_BLOCK,
|
||||
EXTERN_ITEM_LIST,
|
||||
ENUM_VARIANT,
|
||||
RECORD_FIELD_DEF_LIST,
|
||||
RECORD_FIELD_DEF,
|
||||
TUPLE_FIELD_DEF_LIST,
|
||||
TUPLE_FIELD_DEF,
|
||||
RECORD_FIELD_LIST,
|
||||
RECORD_FIELD,
|
||||
TUPLE_FIELD_LIST,
|
||||
TUPLE_FIELD,
|
||||
ENUM_VARIANT_LIST,
|
||||
ITEM_LIST,
|
||||
ASSOC_ITEM_LIST,
|
||||
|
|
|
@ -165,7 +165,7 @@ impl ast::GenericParamsOwner for StructDef {}
|
|||
impl StructDef {
|
||||
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 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)]
|
||||
pub struct TraitDef {
|
||||
|
@ -208,9 +208,7 @@ impl ast::VisibilityOwner for UnionDef {}
|
|||
impl ast::GenericParamsOwner for UnionDef {}
|
||||
impl UnionDef {
|
||||
pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
|
||||
pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
|
||||
support::child(&self.syntax)
|
||||
}
|
||||
pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Use {
|
||||
|
@ -391,42 +389,42 @@ impl TypeBoundList {
|
|||
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RecordFieldDefList {
|
||||
pub struct RecordFieldList {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl RecordFieldDefList {
|
||||
impl RecordFieldList {
|
||||
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!['}']) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TupleFieldDefList {
|
||||
pub struct TupleFieldList {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl TupleFieldDefList {
|
||||
impl TupleFieldList {
|
||||
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![')']) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct RecordFieldDef {
|
||||
pub struct RecordField {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for RecordFieldDef {}
|
||||
impl ast::NameOwner for RecordFieldDef {}
|
||||
impl ast::VisibilityOwner for RecordFieldDef {}
|
||||
impl ast::TypeAscriptionOwner for RecordFieldDef {}
|
||||
impl RecordFieldDef {
|
||||
impl ast::AttrsOwner for RecordField {}
|
||||
impl ast::NameOwner for RecordField {}
|
||||
impl ast::VisibilityOwner for RecordField {}
|
||||
impl ast::TypeAscriptionOwner for RecordField {}
|
||||
impl RecordField {
|
||||
pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct TupleFieldDef {
|
||||
pub struct TupleField {
|
||||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for TupleFieldDef {}
|
||||
impl ast::NameOwner for TupleFieldDef {}
|
||||
impl ast::VisibilityOwner for TupleFieldDef {}
|
||||
impl TupleFieldDef {
|
||||
impl ast::AttrsOwner for TupleField {}
|
||||
impl ast::NameOwner for TupleField {}
|
||||
impl ast::VisibilityOwner for TupleField {}
|
||||
impl TupleField {
|
||||
pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -446,7 +444,7 @@ impl ast::AttrsOwner for EnumVariant {}
|
|||
impl ast::NameOwner for EnumVariant {}
|
||||
impl ast::VisibilityOwner for 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 expr(&self) -> Option<Expr> { support::child(&self.syntax) }
|
||||
}
|
||||
|
@ -1326,9 +1324,9 @@ pub enum Pat {
|
|||
MacroPat(MacroPat),
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum FieldDefList {
|
||||
RecordFieldDefList(RecordFieldDefList),
|
||||
TupleFieldDefList(TupleFieldDefList),
|
||||
pub enum FieldList {
|
||||
RecordFieldList(RecordFieldList),
|
||||
TupleFieldList(TupleFieldList),
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum Expr {
|
||||
|
@ -1765,8 +1763,8 @@ impl AstNode for TypeBoundList {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for RecordFieldDefList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
|
||||
impl AstNode for RecordFieldList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -1776,8 +1774,8 @@ impl AstNode for RecordFieldDefList {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for TupleFieldDefList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST }
|
||||
impl AstNode for TupleFieldList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -1787,8 +1785,8 @@ impl AstNode for TupleFieldDefList {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for RecordFieldDef {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF }
|
||||
impl AstNode for RecordField {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -1798,8 +1796,8 @@ impl AstNode for RecordFieldDef {
|
|||
}
|
||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||
}
|
||||
impl AstNode for TupleFieldDef {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF }
|
||||
impl AstNode for TupleField {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
if Self::can_cast(syntax.kind()) {
|
||||
Some(Self { syntax })
|
||||
|
@ -3046,33 +3044,31 @@ impl AstNode for Pat {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl From<RecordFieldDefList> for FieldDefList {
|
||||
fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) }
|
||||
impl From<RecordFieldList> for FieldList {
|
||||
fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
|
||||
}
|
||||
impl From<TupleFieldDefList> for FieldDefList {
|
||||
fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) }
|
||||
impl From<TupleFieldList> for FieldList {
|
||||
fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
|
||||
}
|
||||
impl AstNode for FieldDefList {
|
||||
impl AstNode for FieldList {
|
||||
fn can_cast(kind: SyntaxKind) -> bool {
|
||||
match kind {
|
||||
RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true,
|
||||
RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
let res = match syntax.kind() {
|
||||
RECORD_FIELD_DEF_LIST => {
|
||||
FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax })
|
||||
}
|
||||
TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
|
||||
RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
|
||||
TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
}
|
||||
fn syntax(&self) -> &SyntaxNode {
|
||||
match self {
|
||||
FieldDefList::RecordFieldDefList(it) => &it.syntax,
|
||||
FieldDefList::TupleFieldDefList(it) => &it.syntax,
|
||||
FieldList::RecordFieldList(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)
|
||||
}
|
||||
}
|
||||
impl std::fmt::Display for FieldDefList {
|
||||
impl std::fmt::Display for FieldList {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
|
@ -3625,22 +3621,22 @@ impl std::fmt::Display for TypeBoundList {
|
|||
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 {
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
||||
|
|
|
@ -166,16 +166,16 @@ impl ast::ImplDef {
|
|||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum StructKind {
|
||||
Record(ast::RecordFieldDefList),
|
||||
Tuple(ast::TupleFieldDefList),
|
||||
Record(ast::RecordFieldList),
|
||||
Tuple(ast::TupleFieldList),
|
||||
Unit,
|
||||
}
|
||||
|
||||
impl 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)
|
||||
} 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)
|
||||
} else {
|
||||
StructKind::Unit
|
||||
|
@ -477,8 +477,8 @@ impl ast::DocCommentsOwner for ast::SourceFile {}
|
|||
impl ast::DocCommentsOwner for ast::Fn {}
|
||||
impl ast::DocCommentsOwner for ast::StructDef {}
|
||||
impl ast::DocCommentsOwner for ast::UnionDef {}
|
||||
impl ast::DocCommentsOwner for ast::RecordFieldDef {}
|
||||
impl ast::DocCommentsOwner for ast::TupleFieldDef {}
|
||||
impl ast::DocCommentsOwner for ast::RecordField {}
|
||||
impl ast::DocCommentsOwner for ast::TupleField {}
|
||||
impl ast::DocCommentsOwner for ast::EnumDef {}
|
||||
impl ast::DocCommentsOwner for ast::EnumVariant {}
|
||||
impl ast::DocCommentsOwner for ast::TraitDef {}
|
||||
|
|
|
@ -147,7 +147,7 @@ fn n_attached_trivias<'a>(
|
|||
) -> usize {
|
||||
match kind {
|
||||
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 trivias = trivias.enumerate().peekable();
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ fn test_local_syntax_ptr() {
|
|||
use crate::{ast, AstNode, SourceFile};
|
||||
|
||||
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 field_syntax = ptr.to_node(file.syntax());
|
||||
assert_eq!(field.syntax(), &field_syntax);
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..34
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..34
|
||||
RECORD_FIELD_LIST@9..34
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..21
|
||||
RECORD_FIELD@15..21
|
||||
NAME@15..16
|
||||
IDENT@15..16 "a"
|
||||
COLON@16..17 ":"
|
||||
|
@ -19,7 +19,7 @@ SOURCE_FILE@0..34
|
|||
NAME_REF@18..21
|
||||
IDENT@18..21 "u32"
|
||||
WHITESPACE@21..26 "\n "
|
||||
RECORD_FIELD_DEF@26..32
|
||||
RECORD_FIELD@26..32
|
||||
NAME@26..27
|
||||
IDENT@26..27 "b"
|
||||
COLON@27..28 ":"
|
||||
|
|
|
@ -11,7 +11,7 @@ SOURCE_FILE@0..21
|
|||
NAME@17..18
|
||||
IDENT@17..18 "S"
|
||||
WHITESPACE@18..19 " "
|
||||
RECORD_FIELD_DEF_LIST@19..21
|
||||
RECORD_FIELD_LIST@19..21
|
||||
L_CURLY@19..20 "{"
|
||||
R_CURLY@20..21 "}"
|
||||
error 0..0: expected an item
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..40
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..39
|
||||
RECORD_FIELD_LIST@9..39
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..21
|
||||
RECORD_FIELD@15..21
|
||||
NAME@15..16
|
||||
IDENT@15..16 "a"
|
||||
COLON@16..17 ":"
|
||||
|
@ -20,7 +20,7 @@ SOURCE_FILE@0..40
|
|||
IDENT@18..21 "i32"
|
||||
COMMA@21..22 ","
|
||||
WHITESPACE@22..27 "\n "
|
||||
RECORD_FIELD_DEF@27..36
|
||||
RECORD_FIELD@27..36
|
||||
NAME@27..28
|
||||
IDENT@27..28 "b"
|
||||
COLON@28..29 ":"
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..74
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..73
|
||||
RECORD_FIELD_LIST@9..73
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..21
|
||||
RECORD_FIELD@15..21
|
||||
NAME@15..16
|
||||
IDENT@15..16 "f"
|
||||
COLON@16..17 ":"
|
||||
|
@ -35,7 +35,7 @@ SOURCE_FILE@0..74
|
|||
ERROR@42..43
|
||||
STAR@42..43 "*"
|
||||
WHITESPACE@43..48 "\n "
|
||||
RECORD_FIELD_DEF@48..58
|
||||
RECORD_FIELD@48..58
|
||||
VISIBILITY@48..51
|
||||
PUB_KW@48..51 "pub"
|
||||
WHITESPACE@51..52 " "
|
||||
|
@ -50,7 +50,7 @@ SOURCE_FILE@0..74
|
|||
IDENT@55..58 "u32"
|
||||
COMMA@58..59 ","
|
||||
WHITESPACE@59..64 "\n "
|
||||
RECORD_FIELD_DEF@64..70
|
||||
RECORD_FIELD@64..70
|
||||
NAME@64..65
|
||||
IDENT@64..65 "z"
|
||||
COLON@65..66 ":"
|
||||
|
|
|
@ -7,10 +7,10 @@ SOURCE_FILE@0..86
|
|||
WHITESPACE@10..11 " "
|
||||
NAME@11..16
|
||||
IDENT@11..16 "Cache"
|
||||
TUPLE_FIELD_DEF_LIST@16..72
|
||||
TUPLE_FIELD_LIST@16..72
|
||||
L_PAREN@16..17 "("
|
||||
WHITESPACE@17..22 "\n "
|
||||
TUPLE_FIELD_DEF@22..68
|
||||
TUPLE_FIELD@22..68
|
||||
PATH_TYPE@22..68
|
||||
PATH@22..68
|
||||
PATH_SEGMENT@22..68
|
||||
|
@ -47,7 +47,7 @@ SOURCE_FILE@0..86
|
|||
ERROR@67..68
|
||||
AT@67..68 "@"
|
||||
WHITESPACE@68..69 " "
|
||||
TUPLE_FIELD_DEF@69..72
|
||||
TUPLE_FIELD@69..72
|
||||
PATH_TYPE@69..72
|
||||
PATH@69..72
|
||||
PATH_SEGMENT@69..72
|
||||
|
|
|
@ -28,9 +28,9 @@ SOURCE_FILE@0..575
|
|||
ENUM_VARIANT@50..62
|
||||
NAME@50..54
|
||||
IDENT@50..54 "Var2"
|
||||
TUPLE_FIELD_DEF_LIST@54..62
|
||||
TUPLE_FIELD_LIST@54..62
|
||||
L_PAREN@54..55 "("
|
||||
TUPLE_FIELD_DEF@55..61
|
||||
TUPLE_FIELD@55..61
|
||||
PATH_TYPE@55..61
|
||||
PATH@55..61
|
||||
PATH_SEGMENT@55..61
|
||||
|
@ -43,10 +43,10 @@ SOURCE_FILE@0..575
|
|||
NAME@72..76
|
||||
IDENT@72..76 "Var3"
|
||||
WHITESPACE@76..77 " "
|
||||
RECORD_FIELD_DEF_LIST@77..145
|
||||
RECORD_FIELD_LIST@77..145
|
||||
L_CURLY@77..78 "{"
|
||||
WHITESPACE@78..91 "\n "
|
||||
RECORD_FIELD_DEF@91..95
|
||||
RECORD_FIELD@91..95
|
||||
NAME@91..94
|
||||
IDENT@91..94 "abc"
|
||||
COLON@94..95 ":"
|
||||
|
@ -108,10 +108,10 @@ SOURCE_FILE@0..575
|
|||
NAME@250..259
|
||||
IDENT@250..259 "StillFine"
|
||||
WHITESPACE@259..260 " "
|
||||
RECORD_FIELD_DEF_LIST@260..293
|
||||
RECORD_FIELD_LIST@260..293
|
||||
L_CURLY@260..261 "{"
|
||||
WHITESPACE@261..274 "\n "
|
||||
RECORD_FIELD_DEF@274..282
|
||||
RECORD_FIELD@274..282
|
||||
NAME@274..277
|
||||
IDENT@274..277 "def"
|
||||
COLON@277..278 ":"
|
||||
|
@ -146,9 +146,9 @@ SOURCE_FILE@0..575
|
|||
ENUM_VARIANT@363..372
|
||||
NAME@363..367
|
||||
IDENT@363..367 "Nope"
|
||||
TUPLE_FIELD_DEF_LIST@367..372
|
||||
TUPLE_FIELD_LIST@367..372
|
||||
L_PAREN@367..368 "("
|
||||
TUPLE_FIELD_DEF@368..371
|
||||
TUPLE_FIELD@368..371
|
||||
PATH_TYPE@368..371
|
||||
PATH@368..371
|
||||
PATH_SEGMENT@368..371
|
||||
|
|
|
@ -86,7 +86,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax
|
|||
fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> {
|
||||
let res = match node.kind() {
|
||||
BLOCK => grammar::block,
|
||||
RECORD_FIELD_DEF_LIST => grammar::record_field_def_list,
|
||||
RECORD_FIELD_LIST => grammar::record_field_list,
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
|
@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax
|
|||
let res = match node.kind() {
|
||||
;
|
||||
let end = u32::from(range.end()) as usize;
|
||||
text.replaT => grammar::record_field_def_list,
|
||||
text.replaT => grammar::record_field_list,
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
|
|
|
@ -22,10 +22,10 @@ SOURCE_FILE@0..71
|
|||
NAME@27..28
|
||||
IDENT@27..28 "S"
|
||||
WHITESPACE@28..29 " "
|
||||
RECORD_FIELD_DEF_LIST@29..49
|
||||
RECORD_FIELD_LIST@29..49
|
||||
L_CURLY@29..30 "{"
|
||||
WHITESPACE@30..31 " "
|
||||
RECORD_FIELD_DEF@31..47
|
||||
RECORD_FIELD@31..47
|
||||
VISIBILITY@31..36
|
||||
CRATE_KW@31..36 "crate"
|
||||
WHITESPACE@36..37 " "
|
||||
|
@ -46,9 +46,9 @@ SOURCE_FILE@0..71
|
|||
WHITESPACE@56..57 " "
|
||||
NAME@57..58
|
||||
IDENT@57..58 "T"
|
||||
TUPLE_FIELD_DEF_LIST@58..69
|
||||
TUPLE_FIELD_LIST@58..69
|
||||
L_PAREN@58..59 "("
|
||||
TUPLE_FIELD_DEF@59..68
|
||||
TUPLE_FIELD@59..68
|
||||
VISIBILITY@59..64
|
||||
CRATE_KW@59..64 "crate"
|
||||
WHITESPACE@64..65 " "
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..64
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..63
|
||||
RECORD_FIELD_LIST@9..63
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..60
|
||||
RECORD_FIELD@15..60
|
||||
ATTR@15..43
|
||||
POUND@15..16 "#"
|
||||
L_BRACK@16..17 "["
|
||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..51
|
|||
NAME@6..9
|
||||
IDENT@6..9 "Foo"
|
||||
WHITESPACE@9..10 " "
|
||||
RECORD_FIELD_DEF_LIST@10..12
|
||||
RECORD_FIELD_LIST@10..12
|
||||
L_CURLY@10..11 "{"
|
||||
R_CURLY@11..12 "}"
|
||||
WHITESPACE@12..13 "\n"
|
||||
|
@ -15,10 +15,10 @@ SOURCE_FILE@0..51
|
|||
NAME@19..22
|
||||
IDENT@19..22 "Foo"
|
||||
WHITESPACE@22..23 " "
|
||||
RECORD_FIELD_DEF_LIST@23..50
|
||||
RECORD_FIELD_LIST@23..50
|
||||
L_CURLY@23..24 "{"
|
||||
WHITESPACE@24..29 "\n "
|
||||
RECORD_FIELD_DEF@29..35
|
||||
RECORD_FIELD@29..35
|
||||
NAME@29..30
|
||||
IDENT@29..30 "a"
|
||||
COLON@30..31 ":"
|
||||
|
@ -30,7 +30,7 @@ SOURCE_FILE@0..51
|
|||
IDENT@32..35 "i32"
|
||||
COMMA@35..36 ","
|
||||
WHITESPACE@36..41 "\n "
|
||||
RECORD_FIELD_DEF@41..47
|
||||
RECORD_FIELD@41..47
|
||||
NAME@41..42
|
||||
IDENT@41..42 "b"
|
||||
COLON@42..43 ":"
|
||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..106
|
|||
NAME@19..22
|
||||
IDENT@19..22 "Foo"
|
||||
WHITESPACE@22..23 " "
|
||||
RECORD_FIELD_DEF_LIST@23..25
|
||||
RECORD_FIELD_LIST@23..25
|
||||
L_CURLY@23..24 "{"
|
||||
R_CURLY@24..25 "}"
|
||||
WHITESPACE@25..26 "\n"
|
||||
|
@ -21,7 +21,7 @@ SOURCE_FILE@0..106
|
|||
WHITESPACE@32..33 " "
|
||||
NAME@33..36
|
||||
IDENT@33..36 "Foo"
|
||||
TUPLE_FIELD_DEF_LIST@36..38
|
||||
TUPLE_FIELD_LIST@36..38
|
||||
L_PAREN@36..37 "("
|
||||
R_PAREN@37..38 ")"
|
||||
SEMICOLON@38..39 ";"
|
||||
|
@ -31,9 +31,9 @@ SOURCE_FILE@0..106
|
|||
WHITESPACE@46..47 " "
|
||||
NAME@47..50
|
||||
IDENT@47..50 "Foo"
|
||||
TUPLE_FIELD_DEF_LIST@50..65
|
||||
TUPLE_FIELD_LIST@50..65
|
||||
L_PAREN@50..51 "("
|
||||
TUPLE_FIELD_DEF@51..57
|
||||
TUPLE_FIELD@51..57
|
||||
PATH_TYPE@51..57
|
||||
PATH@51..57
|
||||
PATH_SEGMENT@51..57
|
||||
|
@ -41,7 +41,7 @@ SOURCE_FILE@0..106
|
|||
IDENT@51..57 "String"
|
||||
COMMA@57..58 ","
|
||||
WHITESPACE@58..59 " "
|
||||
TUPLE_FIELD_DEF@59..64
|
||||
TUPLE_FIELD@59..64
|
||||
PATH_TYPE@59..64
|
||||
PATH@59..64
|
||||
PATH_SEGMENT@59..64
|
||||
|
@ -56,10 +56,10 @@ SOURCE_FILE@0..106
|
|||
NAME@74..77
|
||||
IDENT@74..77 "Foo"
|
||||
WHITESPACE@77..78 " "
|
||||
RECORD_FIELD_DEF_LIST@78..105
|
||||
RECORD_FIELD_LIST@78..105
|
||||
L_CURLY@78..79 "{"
|
||||
WHITESPACE@79..84 "\n "
|
||||
RECORD_FIELD_DEF@84..90
|
||||
RECORD_FIELD@84..90
|
||||
NAME@84..85
|
||||
IDENT@84..85 "a"
|
||||
COLON@85..86 ":"
|
||||
|
@ -71,7 +71,7 @@ SOURCE_FILE@0..106
|
|||
IDENT@87..90 "i32"
|
||||
COMMA@90..91 ","
|
||||
WHITESPACE@91..96 "\n "
|
||||
RECORD_FIELD_DEF@96..102
|
||||
RECORD_FIELD@96..102
|
||||
NAME@96..97
|
||||
IDENT@96..97 "b"
|
||||
COLON@97..98 ":"
|
||||
|
|
|
@ -10,9 +10,9 @@ SOURCE_FILE@0..53
|
|||
NAME@12..13
|
||||
IDENT@12..13 "T"
|
||||
R_ANGLE@13..14 ">"
|
||||
TUPLE_FIELD_DEF_LIST@14..17
|
||||
TUPLE_FIELD_LIST@14..17
|
||||
L_PAREN@14..15 "("
|
||||
TUPLE_FIELD_DEF@15..16
|
||||
TUPLE_FIELD@15..16
|
||||
PATH_TYPE@15..16
|
||||
PATH@15..16
|
||||
PATH_SEGMENT@15..16
|
||||
|
@ -51,9 +51,9 @@ SOURCE_FILE@0..53
|
|||
NAME@46..47
|
||||
IDENT@46..47 "T"
|
||||
R_ANGLE@47..48 ">"
|
||||
TUPLE_FIELD_DEF_LIST@48..51
|
||||
TUPLE_FIELD_LIST@48..51
|
||||
L_PAREN@48..49 "("
|
||||
TUPLE_FIELD_DEF@49..50
|
||||
TUPLE_FIELD@49..50
|
||||
PATH_TYPE@49..50
|
||||
PATH@49..50
|
||||
PATH_SEGMENT@49..50
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..60
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
TUPLE_FIELD_DEF_LIST@9..58
|
||||
TUPLE_FIELD_LIST@9..58
|
||||
L_PAREN@9..10 "("
|
||||
WHITESPACE@10..15 "\n "
|
||||
TUPLE_FIELD_DEF@15..55
|
||||
TUPLE_FIELD@15..55
|
||||
ATTR@15..43
|
||||
POUND@15..16 "#"
|
||||
L_BRACK@16..17 "["
|
||||
|
|
|
@ -53,7 +53,7 @@ SOURCE_FILE@0..111
|
|||
NAME@103..104
|
||||
IDENT@103..104 "S"
|
||||
WHITESPACE@104..105 " "
|
||||
RECORD_FIELD_DEF_LIST@105..107
|
||||
RECORD_FIELD_LIST@105..107
|
||||
L_CURLY@105..106 "{"
|
||||
R_CURLY@106..107 "}"
|
||||
SEMICOLON@107..108 ";"
|
||||
|
|
|
@ -11,9 +11,9 @@ SOURCE_FILE@0..23
|
|||
ENUM_VARIANT@9..20
|
||||
NAME@9..10
|
||||
IDENT@9..10 "X"
|
||||
TUPLE_FIELD_DEF_LIST@10..15
|
||||
TUPLE_FIELD_LIST@10..15
|
||||
L_PAREN@10..11 "("
|
||||
TUPLE_FIELD_DEF@11..14
|
||||
TUPLE_FIELD@11..14
|
||||
PATH_TYPE@11..14
|
||||
PATH@11..14
|
||||
PATH_SEGMENT@11..14
|
||||
|
|
|
@ -20,10 +20,10 @@ SOURCE_FILE@0..32
|
|||
IDENT@12..16 "Copy"
|
||||
R_ANGLE@16..17 ">"
|
||||
WHITESPACE@17..18 " "
|
||||
RECORD_FIELD_DEF_LIST@18..31
|
||||
RECORD_FIELD_LIST@18..31
|
||||
L_CURLY@18..19 "{"
|
||||
WHITESPACE@19..24 "\n "
|
||||
RECORD_FIELD_DEF@24..28
|
||||
RECORD_FIELD@24..28
|
||||
NAME@24..25
|
||||
IDENT@24..25 "f"
|
||||
COLON@25..26 ":"
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..25
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..25
|
||||
RECORD_FIELD_LIST@9..25
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..23
|
||||
RECORD_FIELD@15..23
|
||||
NAME@15..18
|
||||
IDENT@15..18 "foo"
|
||||
COLON@18..19 ":"
|
||||
|
|
|
@ -46,7 +46,7 @@ SOURCE_FILE@0..118
|
|||
NAME@59..60
|
||||
IDENT@59..60 "S"
|
||||
WHITESPACE@60..61 " "
|
||||
RECORD_FIELD_DEF_LIST@61..63
|
||||
RECORD_FIELD_LIST@61..63
|
||||
L_CURLY@61..62 "{"
|
||||
R_CURLY@62..63 "}"
|
||||
WHITESPACE@63..64 "\n"
|
||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..97
|
|||
NAME@17..18
|
||||
IDENT@17..18 "B"
|
||||
WHITESPACE@18..19 " "
|
||||
RECORD_FIELD_DEF_LIST@19..21
|
||||
RECORD_FIELD_LIST@19..21
|
||||
L_CURLY@19..20 "{"
|
||||
R_CURLY@20..21 "}"
|
||||
WHITESPACE@21..22 "\n"
|
||||
|
@ -21,7 +21,7 @@ SOURCE_FILE@0..97
|
|||
WHITESPACE@28..29 " "
|
||||
NAME@29..30
|
||||
IDENT@29..30 "C"
|
||||
TUPLE_FIELD_DEF_LIST@30..32
|
||||
TUPLE_FIELD_LIST@30..32
|
||||
L_PAREN@30..31 "("
|
||||
R_PAREN@31..32 ")"
|
||||
SEMICOLON@32..33 ";"
|
||||
|
@ -32,10 +32,10 @@ SOURCE_FILE@0..97
|
|||
NAME@42..43
|
||||
IDENT@42..43 "D"
|
||||
WHITESPACE@43..44 " "
|
||||
RECORD_FIELD_DEF_LIST@44..74
|
||||
RECORD_FIELD_LIST@44..74
|
||||
L_CURLY@44..45 "{"
|
||||
WHITESPACE@45..50 "\n "
|
||||
RECORD_FIELD_DEF@50..56
|
||||
RECORD_FIELD@50..56
|
||||
NAME@50..51
|
||||
IDENT@50..51 "a"
|
||||
COLON@51..52 ":"
|
||||
|
@ -47,7 +47,7 @@ SOURCE_FILE@0..97
|
|||
IDENT@53..56 "u32"
|
||||
COMMA@56..57 ","
|
||||
WHITESPACE@57..62 "\n "
|
||||
RECORD_FIELD_DEF@62..72
|
||||
RECORD_FIELD@62..72
|
||||
VISIBILITY@62..65
|
||||
PUB_KW@62..65 "pub"
|
||||
WHITESPACE@65..66 " "
|
||||
|
@ -68,9 +68,9 @@ SOURCE_FILE@0..97
|
|||
WHITESPACE@82..83 " "
|
||||
NAME@83..84
|
||||
IDENT@83..84 "E"
|
||||
TUPLE_FIELD_DEF_LIST@84..95
|
||||
TUPLE_FIELD_LIST@84..95
|
||||
L_PAREN@84..85 "("
|
||||
TUPLE_FIELD_DEF@85..90
|
||||
TUPLE_FIELD@85..90
|
||||
VISIBILITY@85..88
|
||||
PUB_KW@85..88 "pub"
|
||||
WHITESPACE@88..89 " "
|
||||
|
@ -81,7 +81,7 @@ SOURCE_FILE@0..97
|
|||
IDENT@89..90 "x"
|
||||
COMMA@90..91 ","
|
||||
WHITESPACE@91..92 " "
|
||||
TUPLE_FIELD_DEF@92..93
|
||||
TUPLE_FIELD@92..93
|
||||
PATH_TYPE@92..93
|
||||
PATH@92..93
|
||||
PATH_SEGMENT@92..93
|
||||
|
|
|
@ -23,9 +23,9 @@ SOURCE_FILE@0..290
|
|||
NAME@24..25
|
||||
IDENT@24..25 "T"
|
||||
R_ANGLE@25..26 ">"
|
||||
TUPLE_FIELD_DEF_LIST@26..31
|
||||
TUPLE_FIELD_LIST@26..31
|
||||
L_PAREN@26..27 "("
|
||||
TUPLE_FIELD_DEF@27..30
|
||||
TUPLE_FIELD@27..30
|
||||
PATH_TYPE@27..30
|
||||
PATH@27..30
|
||||
PATH_SEGMENT@27..30
|
||||
|
@ -46,10 +46,10 @@ SOURCE_FILE@0..290
|
|||
IDENT@43..44 "T"
|
||||
R_ANGLE@44..45 ">"
|
||||
WHITESPACE@45..46 " "
|
||||
RECORD_FIELD_DEF_LIST@46..56
|
||||
RECORD_FIELD_LIST@46..56
|
||||
L_CURLY@46..47 "{"
|
||||
WHITESPACE@47..48 " "
|
||||
RECORD_FIELD_DEF@48..54
|
||||
RECORD_FIELD@48..54
|
||||
NAME@48..49
|
||||
IDENT@48..49 "u"
|
||||
COLON@49..50 ":"
|
||||
|
|
|
@ -86,10 +86,10 @@ SOURCE_FILE@0..182
|
|||
NAME@101..102
|
||||
IDENT@101..102 "C"
|
||||
WHITESPACE@102..103 " "
|
||||
RECORD_FIELD_DEF_LIST@103..146
|
||||
RECORD_FIELD_LIST@103..146
|
||||
L_CURLY@103..104 "{"
|
||||
WHITESPACE@104..113 "\n "
|
||||
RECORD_FIELD_DEF@113..119
|
||||
RECORD_FIELD@113..119
|
||||
NAME@113..114
|
||||
IDENT@113..114 "a"
|
||||
COLON@114..115 ":"
|
||||
|
@ -101,7 +101,7 @@ SOURCE_FILE@0..182
|
|||
IDENT@116..119 "u32"
|
||||
COMMA@119..120 ","
|
||||
WHITESPACE@120..129 "\n "
|
||||
RECORD_FIELD_DEF@129..139
|
||||
RECORD_FIELD@129..139
|
||||
VISIBILITY@129..132
|
||||
PUB_KW@129..132 "pub"
|
||||
WHITESPACE@132..133 " "
|
||||
|
@ -123,7 +123,7 @@ SOURCE_FILE@0..182
|
|||
NAME@152..153
|
||||
IDENT@152..153 "F"
|
||||
WHITESPACE@153..154 " "
|
||||
RECORD_FIELD_DEF_LIST@154..156
|
||||
RECORD_FIELD_LIST@154..156
|
||||
L_CURLY@154..155 "{"
|
||||
R_CURLY@155..156 "}"
|
||||
COMMA@156..157 ","
|
||||
|
@ -131,9 +131,9 @@ SOURCE_FILE@0..182
|
|||
ENUM_VARIANT@162..169
|
||||
NAME@162..163
|
||||
IDENT@162..163 "D"
|
||||
TUPLE_FIELD_DEF_LIST@163..169
|
||||
TUPLE_FIELD_LIST@163..169
|
||||
L_PAREN@163..164 "("
|
||||
TUPLE_FIELD_DEF@164..167
|
||||
TUPLE_FIELD@164..167
|
||||
PATH_TYPE@164..167
|
||||
PATH@164..167
|
||||
PATH_SEGMENT@164..167
|
||||
|
@ -146,7 +146,7 @@ SOURCE_FILE@0..182
|
|||
ENUM_VARIANT@175..178
|
||||
NAME@175..176
|
||||
IDENT@175..176 "E"
|
||||
TUPLE_FIELD_DEF_LIST@176..178
|
||||
TUPLE_FIELD_LIST@176..178
|
||||
L_PAREN@176..177 "("
|
||||
R_PAREN@177..178 ")"
|
||||
COMMA@178..179 ","
|
||||
|
|
|
@ -1571,10 +1571,10 @@ SOURCE_FILE@0..3813
|
|||
LIFETIME@2863..2869 "\'union"
|
||||
R_ANGLE@2869..2870 ">"
|
||||
WHITESPACE@2870..2871 " "
|
||||
RECORD_FIELD_DEF_LIST@2871..2904
|
||||
RECORD_FIELD_LIST@2871..2904
|
||||
L_CURLY@2871..2872 "{"
|
||||
WHITESPACE@2872..2873 " "
|
||||
RECORD_FIELD_DEF@2873..2901
|
||||
RECORD_FIELD@2873..2901
|
||||
NAME@2873..2878
|
||||
IDENT@2873..2878 "union"
|
||||
COLON@2878..2879 ":"
|
||||
|
|
|
@ -5,10 +5,10 @@ SOURCE_FILE@0..27
|
|||
NAME@7..8
|
||||
IDENT@7..8 "S"
|
||||
WHITESPACE@8..9 " "
|
||||
RECORD_FIELD_DEF_LIST@9..27
|
||||
RECORD_FIELD_LIST@9..27
|
||||
L_CURLY@9..10 "{"
|
||||
WHITESPACE@10..15 "\n "
|
||||
RECORD_FIELD_DEF@15..25
|
||||
RECORD_FIELD@15..25
|
||||
NAME@15..20
|
||||
IDENT@15..20 "r#foo"
|
||||
COLON@20..21 ":"
|
||||
|
|
|
@ -7,10 +7,10 @@ SOURCE_FILE@0..160
|
|||
NAME@69..73
|
||||
IDENT@69..73 "Repr"
|
||||
WHITESPACE@73..74 " "
|
||||
RECORD_FIELD_DEF_LIST@74..90
|
||||
RECORD_FIELD_LIST@74..90
|
||||
L_CURLY@74..75 "{"
|
||||
WHITESPACE@75..76 " "
|
||||
RECORD_FIELD_DEF@76..88
|
||||
RECORD_FIELD@76..88
|
||||
NAME@76..79
|
||||
IDENT@76..79 "raw"
|
||||
COLON@79..80 ":"
|
||||
|
|
|
@ -268,9 +268,9 @@ SOURCE_FILE@0..395
|
|||
ENUM_VARIANT@356..365
|
||||
NAME@356..357
|
||||
IDENT@356..357 "B"
|
||||
TUPLE_FIELD_DEF_LIST@357..365
|
||||
TUPLE_FIELD_LIST@357..365
|
||||
L_PAREN@357..358 "("
|
||||
TUPLE_FIELD_DEF@358..360
|
||||
TUPLE_FIELD@358..360
|
||||
PATH_TYPE@358..360
|
||||
PATH@358..360
|
||||
PATH_SEGMENT@358..360
|
||||
|
@ -278,7 +278,7 @@ SOURCE_FILE@0..395
|
|||
IDENT@358..360 "i8"
|
||||
COMMA@360..361 ","
|
||||
WHITESPACE@361..362 " "
|
||||
TUPLE_FIELD_DEF@362..364
|
||||
TUPLE_FIELD@362..364
|
||||
PATH_TYPE@362..364
|
||||
PATH@362..364
|
||||
PATH_SEGMENT@362..364
|
||||
|
|
|
@ -39,7 +39,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
|
|||
SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
|
||||
SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
|
||||
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::CONST_DEF => lsp_types::SymbolKind::Constant,
|
||||
SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object,
|
||||
|
|
|
@ -180,10 +180,10 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
|
|||
"EXTERN_BLOCK",
|
||||
"EXTERN_ITEM_LIST",
|
||||
"ENUM_VARIANT",
|
||||
"RECORD_FIELD_DEF_LIST",
|
||||
"RECORD_FIELD_DEF",
|
||||
"TUPLE_FIELD_DEF_LIST",
|
||||
"TUPLE_FIELD_DEF",
|
||||
"RECORD_FIELD_LIST",
|
||||
"RECORD_FIELD",
|
||||
"TUPLE_FIELD_LIST",
|
||||
"TUPLE_FIELD",
|
||||
"ENUM_VARIANT_LIST",
|
||||
"ITEM_LIST",
|
||||
"ASSOC_ITEM_LIST",
|
||||
|
|
|
@ -78,30 +78,30 @@ TypeAlias =
|
|||
|
||||
StructDef =
|
||||
Attr* Visibility? 'struct' Name GenericParamList? (
|
||||
WhereClause? (RecordFieldDefList | ';')
|
||||
| TupleFieldDefList WhereClause? ';'
|
||||
WhereClause? (RecordFieldList | ';')
|
||||
| TupleFieldList WhereClause? ';'
|
||||
)
|
||||
|
||||
RecordFieldDefList =
|
||||
'{' fields:RecordFieldDef* '}'
|
||||
RecordFieldList =
|
||||
'{' fields:RecordField* '}'
|
||||
|
||||
RecordFieldDef =
|
||||
RecordField =
|
||||
Attr* Visibility? Name ':' ascribed_type:TypeRef
|
||||
|
||||
TupleFieldDefList =
|
||||
'(' fields:TupleFieldDef* ')'
|
||||
TupleFieldList =
|
||||
'(' fields:TupleField* ')'
|
||||
|
||||
TupleFieldDef =
|
||||
TupleField =
|
||||
Attr* Visibility? Name TypeRef
|
||||
|
||||
FieldDefList =
|
||||
RecordFieldDefList
|
||||
| TupleFieldDefList
|
||||
FieldList =
|
||||
RecordFieldList
|
||||
| TupleFieldList
|
||||
|
||||
|
||||
UnionDef =
|
||||
Attr* Visibility? 'union' Name GenericParamList? WhereClause?
|
||||
RecordFieldDefList
|
||||
RecordFieldList
|
||||
|
||||
EnumDef =
|
||||
Attr* Visibility? 'enum' Name GenericParamList? WhereClause?
|
||||
|
@ -111,7 +111,7 @@ EnumVariantList =
|
|||
'{' variants:EnumVariant* '}'
|
||||
|
||||
EnumVariant =
|
||||
Attr* Visibility? Name FieldDefList ('=' Expr)?
|
||||
Attr* Visibility? Name FieldList ('=' Expr)?
|
||||
|
||||
TraitDef =
|
||||
Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList
|
||||
|
|
Loading…
Reference in a new issue