From 23172a116c3cc4ca9a692dfdd05051d1a4aee2b2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Jan 2019 00:24:12 +0300 Subject: rename POS_FIELD -> POS_FIELD_DEF to match NAMED_FIELD_DEF --- crates/ra_syntax/src/ast.rs | 4 +-- crates/ra_syntax/src/ast/generated.rs | 42 +++++++++++++------------- crates/ra_syntax/src/grammar.ron | 8 ++--- crates/ra_syntax/src/grammar/items/nominal.rs | 10 +++--- crates/ra_syntax/src/syntax_kinds/generated.rs | 8 ++--- 5 files changed, 36 insertions(+), 36 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 165b308d1..00c60ebf3 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -407,7 +407,7 @@ impl<'a, N: AstNode + 'a> Iterator for AstChildren<'a, N> { #[derive(Debug, Clone, PartialEq, Eq)] pub enum StructFlavor<'a> { - Tuple(&'a PosFieldList), + Tuple(&'a PosFieldDefList), Named(&'a NamedFieldDefList), Unit, } @@ -416,7 +416,7 @@ impl StructFlavor<'_> { fn from_node(node: &N) -> StructFlavor { if let Some(nfdl) = child_opt::<_, NamedFieldDefList>(node) { StructFlavor::Named(nfdl) - } else if let Some(pfl) = child_opt::<_, PosFieldList>(node) { + } else if let Some(pfl) = child_opt::<_, PosFieldDefList>(node) { StructFlavor::Tuple(pfl) } else { StructFlavor::Unit diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index e936c2a6d..3ace6533c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -2851,68 +2851,68 @@ impl PointerType { } } -// PosField +// PosFieldDef #[derive(Debug, PartialEq, Eq, Hash)] #[repr(transparent)] -pub struct PosField { +pub struct PosFieldDef { pub(crate) syntax: SyntaxNode, } -unsafe impl TransparentNewType for PosField { +unsafe impl TransparentNewType for PosFieldDef { type Repr = rowan::SyntaxNode; } -impl AstNode for PosField { +impl AstNode for PosFieldDef { fn cast(syntax: &SyntaxNode) -> Option<&Self> { match syntax.kind() { - POS_FIELD => Some(PosField::from_repr(syntax.into_repr())), + POS_FIELD_DEF => Some(PosFieldDef::from_repr(syntax.into_repr())), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ToOwned for PosField { - type Owned = TreeArc; - fn to_owned(&self) -> TreeArc { TreeArc::cast(self.syntax.to_owned()) } +impl ToOwned for PosFieldDef { + type Owned = TreeArc; + fn to_owned(&self) -> TreeArc { TreeArc::cast(self.syntax.to_owned()) } } -impl ast::VisibilityOwner for PosField {} -impl ast::AttrsOwner for PosField {} -impl PosField { +impl ast::VisibilityOwner for PosFieldDef {} +impl ast::AttrsOwner for PosFieldDef {} +impl PosFieldDef { pub fn type_ref(&self) -> Option<&TypeRef> { super::child_opt(self) } } -// PosFieldList +// PosFieldDefList #[derive(Debug, PartialEq, Eq, Hash)] #[repr(transparent)] -pub struct PosFieldList { +pub struct PosFieldDefList { pub(crate) syntax: SyntaxNode, } -unsafe impl TransparentNewType for PosFieldList { +unsafe impl TransparentNewType for PosFieldDefList { type Repr = rowan::SyntaxNode; } -impl AstNode for PosFieldList { +impl AstNode for PosFieldDefList { fn cast(syntax: &SyntaxNode) -> Option<&Self> { match syntax.kind() { - POS_FIELD_LIST => Some(PosFieldList::from_repr(syntax.into_repr())), + POS_FIELD_DEF_LIST => Some(PosFieldDefList::from_repr(syntax.into_repr())), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ToOwned for PosFieldList { - type Owned = TreeArc; - fn to_owned(&self) -> TreeArc { TreeArc::cast(self.syntax.to_owned()) } +impl ToOwned for PosFieldDefList { + type Owned = TreeArc; + fn to_owned(&self) -> TreeArc { TreeArc::cast(self.syntax.to_owned()) } } -impl PosFieldList { - pub fn fields(&self) -> impl Iterator { +impl PosFieldDefList { + pub fn fields(&self) -> impl Iterator { super::children(self) } } diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index a92d9bbda..85fc79038 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -205,8 +205,8 @@ Grammar( "ENUM_VARIANT", "NAMED_FIELD_DEF_LIST", "NAMED_FIELD_DEF", - "POS_FIELD_LIST", - "POS_FIELD", + "POS_FIELD_DEF_LIST", + "POS_FIELD_DEF", "ENUM_VARIANT_LIST", "ITEM_LIST", "ATTR", @@ -269,8 +269,8 @@ Grammar( ), "NamedFieldDefList": (collections: [["fields", "NamedFieldDef"]]), "NamedFieldDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"], options: ["TypeRef"] ), - "PosFieldList": (collections: [["fields", "PosField"]]), - "PosField": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]), + "PosFieldDefList": (collections: [["fields", "PosFieldDef"]]), + "PosFieldDef": ( traits: ["VisibilityOwner", "AttrsOwner"], options: ["TypeRef"]), "EnumDef": ( traits: [ "VisibilityOwner", "NameOwner", diff --git a/crates/ra_syntax/src/grammar/items/nominal.rs b/crates/ra_syntax/src/grammar/items/nominal.rs index 0784fb7b1..ff9b38f9c 100644 --- a/crates/ra_syntax/src/grammar/items/nominal.rs +++ b/crates/ra_syntax/src/grammar/items/nominal.rs @@ -28,7 +28,7 @@ pub(super) fn struct_def(p: &mut Parser, kind: SyntaxKind) { } L_CURLY => named_field_def_list(p), L_PAREN if kind == STRUCT_KW => { - pos_field_list(p); + pos_field_def_list(p); // test tuple_struct_where // struct Test(T) where T: Clone; // struct Test(T); @@ -74,7 +74,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { name(p); match p.current() { L_CURLY => named_field_def_list(p), - L_PAREN => pos_field_list(p), + L_PAREN => pos_field_def_list(p), EQ => { p.bump(); expressions::expr(p); @@ -132,7 +132,7 @@ pub(crate) fn named_field_def_list(p: &mut Parser) { } } -fn pos_field_list(p: &mut Parser) { +fn pos_field_def_list(p: &mut Parser) { assert!(p.at(L_PAREN)); let m = p.start(); if !p.expect(L_PAREN) { @@ -157,12 +157,12 @@ fn pos_field_list(p: &mut Parser) { break; } types::type_(p); - m.complete(p, POS_FIELD); + m.complete(p, POS_FIELD_DEF); if !p.at(R_PAREN) { p.expect(COMMA); } } p.expect(R_PAREN); - m.complete(p, POS_FIELD_LIST); + m.complete(p, POS_FIELD_DEF_LIST); } diff --git a/crates/ra_syntax/src/syntax_kinds/generated.rs b/crates/ra_syntax/src/syntax_kinds/generated.rs index 06faf7557..14f610891 100644 --- a/crates/ra_syntax/src/syntax_kinds/generated.rs +++ b/crates/ra_syntax/src/syntax_kinds/generated.rs @@ -195,8 +195,8 @@ pub enum SyntaxKind { ENUM_VARIANT, NAMED_FIELD_DEF_LIST, NAMED_FIELD_DEF, - POS_FIELD_LIST, - POS_FIELD, + POS_FIELD_DEF_LIST, + POS_FIELD_DEF, ENUM_VARIANT_LIST, ITEM_LIST, ATTR, @@ -458,8 +458,8 @@ impl SyntaxKind { ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, NAMED_FIELD_DEF_LIST => &SyntaxInfo { name: "NAMED_FIELD_DEF_LIST" }, NAMED_FIELD_DEF => &SyntaxInfo { name: "NAMED_FIELD_DEF" }, - POS_FIELD_LIST => &SyntaxInfo { name: "POS_FIELD_LIST" }, - POS_FIELD => &SyntaxInfo { name: "POS_FIELD" }, + POS_FIELD_DEF_LIST => &SyntaxInfo { name: "POS_FIELD_DEF_LIST" }, + POS_FIELD_DEF => &SyntaxInfo { name: "POS_FIELD_DEF" }, ENUM_VARIANT_LIST => &SyntaxInfo { name: "ENUM_VARIANT_LIST" }, ITEM_LIST => &SyntaxInfo { name: "ITEM_LIST" }, ATTR => &SyntaxInfo { name: "ATTR" }, -- cgit v1.2.3