diff options
author | Aleksey Kladov <[email protected]> | 2018-08-30 18:37:33 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-30 18:37:33 +0100 |
commit | 80ab3433d3376b7c44787d63af6e7b3217ae41d8 (patch) | |
tree | acd067ca08c5155521444d3975f8ba016bcc8424 /crates/libsyntax2/src/ast | |
parent | 49e14a99ed4d0baf849bbd5766f6c16e7d37930c (diff) |
complete imports
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index c2a22c8fc..1bb3b11d1 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -977,6 +977,7 @@ pub enum ModuleItem<'a> { | |||
977 | ExternCrateItem(ExternCrateItem<'a>), | 977 | ExternCrateItem(ExternCrateItem<'a>), |
978 | ConstDef(ConstDef<'a>), | 978 | ConstDef(ConstDef<'a>), |
979 | StaticDef(StaticDef<'a>), | 979 | StaticDef(StaticDef<'a>), |
980 | Module(Module<'a>), | ||
980 | } | 981 | } |
981 | 982 | ||
982 | impl<'a> AstNode<'a> for ModuleItem<'a> { | 983 | impl<'a> AstNode<'a> for ModuleItem<'a> { |
@@ -991,6 +992,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
991 | EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), | 992 | EXTERN_CRATE_ITEM => Some(ModuleItem::ExternCrateItem(ExternCrateItem { syntax })), |
992 | CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), | 993 | CONST_DEF => Some(ModuleItem::ConstDef(ConstDef { syntax })), |
993 | STATIC_DEF => Some(ModuleItem::StaticDef(StaticDef { syntax })), | 994 | STATIC_DEF => Some(ModuleItem::StaticDef(StaticDef { syntax })), |
995 | MODULE => Some(ModuleItem::Module(Module { syntax })), | ||
994 | _ => None, | 996 | _ => None, |
995 | } | 997 | } |
996 | } | 998 | } |
@@ -1005,6 +1007,7 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
1005 | ModuleItem::ExternCrateItem(inner) => inner.syntax(), | 1007 | ModuleItem::ExternCrateItem(inner) => inner.syntax(), |
1006 | ModuleItem::ConstDef(inner) => inner.syntax(), | 1008 | ModuleItem::ConstDef(inner) => inner.syntax(), |
1007 | ModuleItem::StaticDef(inner) => inner.syntax(), | 1009 | ModuleItem::StaticDef(inner) => inner.syntax(), |
1010 | ModuleItem::Module(inner) => inner.syntax(), | ||
1008 | } | 1011 | } |
1009 | } | 1012 | } |
1010 | } | 1013 | } |
@@ -1294,7 +1297,11 @@ impl<'a> AstNode<'a> for Path<'a> { | |||
1294 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | 1297 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } |
1295 | } | 1298 | } |
1296 | 1299 | ||
1297 | impl<'a> Path<'a> {} | 1300 | impl<'a> Path<'a> { |
1301 | pub fn segment(self) -> Option<PathSegment<'a>> { | ||
1302 | super::child_opt(self) | ||
1303 | } | ||
1304 | } | ||
1298 | 1305 | ||
1299 | // PathExpr | 1306 | // PathExpr |
1300 | #[derive(Debug, Clone, Copy)] | 1307 | #[derive(Debug, Clone, Copy)] |
@@ -1332,6 +1339,28 @@ impl<'a> AstNode<'a> for PathPat<'a> { | |||
1332 | 1339 | ||
1333 | impl<'a> PathPat<'a> {} | 1340 | impl<'a> PathPat<'a> {} |
1334 | 1341 | ||
1342 | // PathSegment | ||
1343 | #[derive(Debug, Clone, Copy)] | ||
1344 | pub struct PathSegment<'a> { | ||
1345 | syntax: SyntaxNodeRef<'a>, | ||
1346 | } | ||
1347 | |||
1348 | impl<'a> AstNode<'a> for PathSegment<'a> { | ||
1349 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
1350 | match syntax.kind() { | ||
1351 | PATH_SEGMENT => Some(PathSegment { syntax }), | ||
1352 | _ => None, | ||
1353 | } | ||
1354 | } | ||
1355 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
1356 | } | ||
1357 | |||
1358 | impl<'a> PathSegment<'a> { | ||
1359 | pub fn name_ref(self) -> Option<NameRef<'a>> { | ||
1360 | super::child_opt(self) | ||
1361 | } | ||
1362 | } | ||
1363 | |||
1335 | // PathType | 1364 | // PathType |
1336 | #[derive(Debug, Clone, Copy)] | 1365 | #[derive(Debug, Clone, Copy)] |
1337 | pub struct PathType<'a> { | 1366 | pub struct PathType<'a> { |
@@ -1989,7 +2018,59 @@ impl<'a> AstNode<'a> for UseItem<'a> { | |||
1989 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | 2018 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } |
1990 | } | 2019 | } |
1991 | 2020 | ||
1992 | impl<'a> UseItem<'a> {} | 2021 | impl<'a> UseItem<'a> { |
2022 | pub fn use_tree(self) -> Option<UseTree<'a>> { | ||
2023 | super::child_opt(self) | ||
2024 | } | ||
2025 | } | ||
2026 | |||
2027 | // UseTree | ||
2028 | #[derive(Debug, Clone, Copy)] | ||
2029 | pub struct UseTree<'a> { | ||
2030 | syntax: SyntaxNodeRef<'a>, | ||
2031 | } | ||
2032 | |||
2033 | impl<'a> AstNode<'a> for UseTree<'a> { | ||
2034 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
2035 | match syntax.kind() { | ||
2036 | USE_TREE => Some(UseTree { syntax }), | ||
2037 | _ => None, | ||
2038 | } | ||
2039 | } | ||
2040 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
2041 | } | ||
2042 | |||
2043 | impl<'a> UseTree<'a> { | ||
2044 | pub fn path(self) -> Option<Path<'a>> { | ||
2045 | super::child_opt(self) | ||
2046 | } | ||
2047 | |||
2048 | pub fn use_tree_list(self) -> Option<UseTreeList<'a>> { | ||
2049 | super::child_opt(self) | ||
2050 | } | ||
2051 | } | ||
2052 | |||
2053 | // UseTreeList | ||
2054 | #[derive(Debug, Clone, Copy)] | ||
2055 | pub struct UseTreeList<'a> { | ||
2056 | syntax: SyntaxNodeRef<'a>, | ||
2057 | } | ||
2058 | |||
2059 | impl<'a> AstNode<'a> for UseTreeList<'a> { | ||
2060 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
2061 | match syntax.kind() { | ||
2062 | USE_TREE_LIST => Some(UseTreeList { syntax }), | ||
2063 | _ => None, | ||
2064 | } | ||
2065 | } | ||
2066 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
2067 | } | ||
2068 | |||
2069 | impl<'a> UseTreeList<'a> { | ||
2070 | pub fn use_trees(self) -> impl Iterator<Item = UseTree<'a>> + 'a { | ||
2071 | super::children(self) | ||
2072 | } | ||
2073 | } | ||
1993 | 2074 | ||
1994 | // WhereClause | 2075 | // WhereClause |
1995 | #[derive(Debug, Clone, Copy)] | 2076 | #[derive(Debug, Clone, Copy)] |