From c146331b1c92c3a6d58217b61f95e69155a3a4f8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 13 Aug 2018 18:36:16 +0300 Subject: rename --- crates/libsyntax2/src/ast/generated.rs | 88 +++++++++++++++++----------------- crates/libsyntax2/src/ast/mod.rs | 2 +- crates/libsyntax2/src/grammar.ron | 16 +++---- 3 files changed, 53 insertions(+), 53 deletions(-) (limited to 'crates/libsyntax2') diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index a557e6d73..b347a05b4 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs @@ -5,43 +5,43 @@ use { SyntaxKind::*, }; -// ConstItem +// ConstDef #[derive(Debug, Clone, Copy)] -pub struct ConstItem> { +pub struct ConstDef> { syntax: SyntaxNode, } -impl AstNode for ConstItem { +impl AstNode for ConstDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - CONST_DEF => Some(ConstItem { syntax }), + CONST_DEF => Some(ConstDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for ConstItem {} -impl ConstItem {} +impl ast::NameOwner for ConstDef {} +impl ConstDef {} -// Enum +// EnumDef #[derive(Debug, Clone, Copy)] -pub struct Enum> { +pub struct EnumDef> { syntax: SyntaxNode, } -impl AstNode for Enum { +impl AstNode for EnumDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - ENUM_DEF => Some(Enum { syntax }), + ENUM_DEF => Some(EnumDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for Enum {} -impl Enum {} +impl ast::NameOwner for EnumDef {} +impl EnumDef {} // File #[derive(Debug, Clone, Copy)] @@ -60,31 +60,31 @@ impl AstNode for File { } impl File { - pub fn functions<'a>(&'a self) -> impl Iterator> + 'a { + pub fn functions<'a>(&'a self) -> impl Iterator> + 'a { self.syntax() .children() - .filter_map(Function::cast) + .filter_map(FnDef::cast) } } -// Function +// FnDef #[derive(Debug, Clone, Copy)] -pub struct Function> { +pub struct FnDef> { syntax: SyntaxNode, } -impl AstNode for Function { +impl AstNode for FnDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - FN_DEF => Some(Function { syntax }), + FN_DEF => Some(FnDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for Function {} -impl Function {} +impl ast::NameOwner for FnDef {} +impl FnDef {} // Module #[derive(Debug, Clone, Copy)] @@ -141,79 +141,79 @@ impl AstNode for NameRef { impl NameRef {} -// StaticItem +// StaticDef #[derive(Debug, Clone, Copy)] -pub struct StaticItem> { +pub struct StaticDef> { syntax: SyntaxNode, } -impl AstNode for StaticItem { +impl AstNode for StaticDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - STATIC_DEF => Some(StaticItem { syntax }), + STATIC_DEF => Some(StaticDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for StaticItem {} -impl StaticItem {} +impl ast::NameOwner for StaticDef {} +impl StaticDef {} -// Struct +// StructDef #[derive(Debug, Clone, Copy)] -pub struct Struct> { +pub struct StructDef> { syntax: SyntaxNode, } -impl AstNode for Struct { +impl AstNode for StructDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - STRUCT_DEF => Some(Struct { syntax }), + STRUCT_DEF => Some(StructDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for Struct {} -impl Struct {} +impl ast::NameOwner for StructDef {} +impl StructDef {} -// Trait +// TraitDef #[derive(Debug, Clone, Copy)] -pub struct Trait> { +pub struct TraitDef> { syntax: SyntaxNode, } -impl AstNode for Trait { +impl AstNode for TraitDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - TRAIT_DEF => Some(Trait { syntax }), + TRAIT_DEF => Some(TraitDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for Trait {} -impl Trait {} +impl ast::NameOwner for TraitDef {} +impl TraitDef {} -// TypeItem +// TypeDef #[derive(Debug, Clone, Copy)] -pub struct TypeItem> { +pub struct TypeDef> { syntax: SyntaxNode, } -impl AstNode for TypeItem { +impl AstNode for TypeDef { fn cast(syntax: SyntaxNode) -> Option { match syntax.kind() { - TYPE_DEF => Some(TypeItem { syntax }), + TYPE_DEF => Some(TypeDef { syntax }), _ => None, } } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl ast::NameOwner for TypeItem {} -impl TypeItem {} +impl ast::NameOwner for TypeDef {} +impl TypeDef {} diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 2e1fb2d1c..18a9f5d17 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs @@ -36,7 +36,7 @@ impl File { } } -impl Function { +impl FnDef { pub fn has_atom_attr(&self, atom: &str) -> bool { self.syntax() .children() diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron index 16300af41..ef56761fd 100644 --- a/crates/libsyntax2/src/grammar.ron +++ b/crates/libsyntax2/src/grammar.ron @@ -218,17 +218,17 @@ Grammar( ast: { "File": ( collections: [ - ["functions", "Function"] + ["functions", "FnDef"] ] ), - "Function": ( traits: ["NameOwner"] ), - "Struct": ( traits: ["NameOwner"] ), - "Enum": ( traits: ["NameOwner"] ), - "Trait": ( traits: ["NameOwner"] ), + "FnDef": ( traits: ["NameOwner"] ), + "StructDef": ( traits: ["NameOwner"] ), + "EnumDef": ( traits: ["NameOwner"] ), + "TraitDef": ( traits: ["NameOwner"] ), "Module": ( traits: ["NameOwner"] ), - "ConstItem": ( traits: ["NameOwner"] ), - "StaticItem": ( traits: ["NameOwner"] ), - "TypeItem": ( traits: ["NameOwner"] ), + "ConstDef": ( traits: ["NameOwner"] ), + "StaticDef": ( traits: ["NameOwner"] ), + "TypeDef": ( traits: ["NameOwner"] ), "Name": (), "NameRef": (), }, -- cgit v1.2.3