From 70097504f78c4c41368a0b864a94df95fb9c27f7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 17 Aug 2018 21:10:55 +0300 Subject: hide root --- crates/libsyntax2/src/ast/generated.rs | 63 +++++++++++++++++----------------- crates/libsyntax2/src/ast/mod.rs | 8 ++--- 2 files changed, 34 insertions(+), 37 deletions(-) (limited to 'crates/libsyntax2/src/ast') diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index be3f73f7e..4fc405c8a 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs @@ -1,13 +1,12 @@ -use std::sync::Arc; use { ast, - SyntaxNode, SyntaxRoot, TreeRoot, AstNode, + SyntaxNode, OwnedRoot, TreeRoot, AstNode, SyntaxKind::*, }; // ArrayType #[derive(Debug, Clone, Copy)] -pub struct ArrayType> { +pub struct ArrayType { syntax: SyntaxNode, } @@ -25,7 +24,7 @@ impl ArrayType {} // Attr #[derive(Debug, Clone, Copy)] -pub struct Attr> { +pub struct Attr { syntax: SyntaxNode, } @@ -50,7 +49,7 @@ impl Attr { // ConstDef #[derive(Debug, Clone, Copy)] -pub struct ConstDef> { +pub struct ConstDef { syntax: SyntaxNode, } @@ -70,7 +69,7 @@ impl ConstDef {} // DynTraitType #[derive(Debug, Clone, Copy)] -pub struct DynTraitType> { +pub struct DynTraitType { syntax: SyntaxNode, } @@ -88,7 +87,7 @@ impl DynTraitType {} // EnumDef #[derive(Debug, Clone, Copy)] -pub struct EnumDef> { +pub struct EnumDef { syntax: SyntaxNode, } @@ -108,7 +107,7 @@ impl EnumDef {} // File #[derive(Debug, Clone, Copy)] -pub struct File> { +pub struct File { syntax: SyntaxNode, } @@ -132,7 +131,7 @@ impl File { // FnDef #[derive(Debug, Clone, Copy)] -pub struct FnDef> { +pub struct FnDef { syntax: SyntaxNode, } @@ -152,7 +151,7 @@ impl FnDef {} // FnPointerType #[derive(Debug, Clone, Copy)] -pub struct FnPointerType> { +pub struct FnPointerType { syntax: SyntaxNode, } @@ -170,7 +169,7 @@ impl FnPointerType {} // ForType #[derive(Debug, Clone, Copy)] -pub struct ForType> { +pub struct ForType { syntax: SyntaxNode, } @@ -188,7 +187,7 @@ impl ForType {} // ImplItem #[derive(Debug, Clone, Copy)] -pub struct ImplItem> { +pub struct ImplItem { syntax: SyntaxNode, } @@ -206,7 +205,7 @@ impl ImplItem {} // ImplTraitType #[derive(Debug, Clone, Copy)] -pub struct ImplTraitType> { +pub struct ImplTraitType { syntax: SyntaxNode, } @@ -224,7 +223,7 @@ impl ImplTraitType {} // Module #[derive(Debug, Clone, Copy)] -pub struct Module> { +pub struct Module { syntax: SyntaxNode, } @@ -244,7 +243,7 @@ impl Module {} // Name #[derive(Debug, Clone, Copy)] -pub struct Name> { +pub struct Name { syntax: SyntaxNode, } @@ -262,7 +261,7 @@ impl Name {} // NameRef #[derive(Debug, Clone, Copy)] -pub struct NameRef> { +pub struct NameRef { syntax: SyntaxNode, } @@ -280,7 +279,7 @@ impl NameRef {} // NamedField #[derive(Debug, Clone, Copy)] -pub struct NamedField> { +pub struct NamedField { syntax: SyntaxNode, } @@ -300,7 +299,7 @@ impl NamedField {} // NeverType #[derive(Debug, Clone, Copy)] -pub struct NeverType> { +pub struct NeverType { syntax: SyntaxNode, } @@ -318,7 +317,7 @@ impl NeverType {} // NominalDef #[derive(Debug, Clone, Copy)] -pub enum NominalDef> { +pub enum NominalDef { StructDef(StructDef), EnumDef(EnumDef), } @@ -344,7 +343,7 @@ impl NominalDef {} // ParenType #[derive(Debug, Clone, Copy)] -pub struct ParenType> { +pub struct ParenType { syntax: SyntaxNode, } @@ -362,7 +361,7 @@ impl ParenType {} // PathType #[derive(Debug, Clone, Copy)] -pub struct PathType> { +pub struct PathType { syntax: SyntaxNode, } @@ -380,7 +379,7 @@ impl PathType {} // PlaceholderType #[derive(Debug, Clone, Copy)] -pub struct PlaceholderType> { +pub struct PlaceholderType { syntax: SyntaxNode, } @@ -398,7 +397,7 @@ impl PlaceholderType {} // PointerType #[derive(Debug, Clone, Copy)] -pub struct PointerType> { +pub struct PointerType { syntax: SyntaxNode, } @@ -416,7 +415,7 @@ impl PointerType {} // ReferenceType #[derive(Debug, Clone, Copy)] -pub struct ReferenceType> { +pub struct ReferenceType { syntax: SyntaxNode, } @@ -434,7 +433,7 @@ impl ReferenceType {} // SliceType #[derive(Debug, Clone, Copy)] -pub struct SliceType> { +pub struct SliceType { syntax: SyntaxNode, } @@ -452,7 +451,7 @@ impl SliceType {} // StaticDef #[derive(Debug, Clone, Copy)] -pub struct StaticDef> { +pub struct StaticDef { syntax: SyntaxNode, } @@ -472,7 +471,7 @@ impl StaticDef {} // StructDef #[derive(Debug, Clone, Copy)] -pub struct StructDef> { +pub struct StructDef { syntax: SyntaxNode, } @@ -498,7 +497,7 @@ impl StructDef { // TokenTree #[derive(Debug, Clone, Copy)] -pub struct TokenTree> { +pub struct TokenTree { syntax: SyntaxNode, } @@ -516,7 +515,7 @@ impl TokenTree {} // TraitDef #[derive(Debug, Clone, Copy)] -pub struct TraitDef> { +pub struct TraitDef { syntax: SyntaxNode, } @@ -536,7 +535,7 @@ impl TraitDef {} // TupleType #[derive(Debug, Clone, Copy)] -pub struct TupleType> { +pub struct TupleType { syntax: SyntaxNode, } @@ -554,7 +553,7 @@ impl TupleType {} // TypeDef #[derive(Debug, Clone, Copy)] -pub struct TypeDef> { +pub struct TypeDef { syntax: SyntaxNode, } @@ -574,7 +573,7 @@ impl TypeDef {} // TypeRef #[derive(Debug, Clone, Copy)] -pub enum TypeRef> { +pub enum TypeRef { ParenType(ParenType), TupleType(TupleType), NeverType(NeverType), diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 9b9200f99..b52230e9c 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs @@ -1,12 +1,10 @@ mod generated; -use std::sync::Arc; - use itertools::Itertools; use smol_str::SmolStr; use { - SyntaxNode, SyntaxNodeRef, SyntaxRoot, TreeRoot, SyntaxError, + SyntaxNode, SyntaxNodeRef, OwnedRoot, TreeRoot, SyntaxError, SyntaxKind::*, }; pub use self::generated::*; @@ -37,7 +35,7 @@ pub trait AttrsOwner: AstNode { } } -impl File> { +impl File { pub fn parse(text: &str) -> Self { File::cast(::parse(text)).unwrap() } @@ -45,7 +43,7 @@ impl File> { impl File { pub fn errors(&self) -> Vec { - self.syntax().root.errors.clone() + self.syntax().root.syntax_root().errors.clone() } } -- cgit v1.2.3