From cdca39706121b2d1734a94938a2372da881e10c6 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 25 Dec 2018 21:14:13 +0100 Subject: Add a hir::TypeRef as an intermediate between ast::TypeRef and ty::Ty --- crates/ra_syntax/src/ast/generated.rs | 38 ++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'crates/ra_syntax/src/ast') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 535dcc975..c22e026cf 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -131,7 +131,15 @@ impl> ArrayTypeNode { } -impl<'a> ArrayType<'a> {} +impl<'a> ArrayType<'a> { + pub fn type_ref(self) -> Option> { + super::child_opt(self) + } + + pub fn expr(self) -> Option> { + super::child_opt(self) + } +} // Attr #[derive(Debug, Clone, Copy,)] @@ -1258,7 +1266,15 @@ impl> FnPointerTypeNode { } -impl<'a> FnPointerType<'a> {} +impl<'a> FnPointerType<'a> { + pub fn param_list(self) -> Option> { + super::child_opt(self) + } + + pub fn ret_type(self) -> Option> { + super::child_opt(self) + } +} // ForExpr #[derive(Debug, Clone, Copy,)] @@ -1341,7 +1357,11 @@ impl> ForTypeNode { } -impl<'a> ForType<'a> {} +impl<'a> ForType<'a> { + pub fn type_ref(self) -> Option> { + super::child_opt(self) + } +} // IfExpr #[derive(Debug, Clone, Copy,)] @@ -3490,7 +3510,11 @@ impl> SliceTypeNode { } -impl<'a> SliceType<'a> {} +impl<'a> SliceType<'a> { + pub fn type_ref(self) -> Option> { + super::child_opt(self) + } +} // SourceFile #[derive(Debug, Clone, Copy,)] @@ -4025,7 +4049,11 @@ impl> TupleTypeNode { } -impl<'a> TupleType<'a> {} +impl<'a> TupleType<'a> { + pub fn fields(self) -> impl Iterator> + 'a { + super::children(self) + } +} // TypeDef #[derive(Debug, Clone, Copy,)] -- cgit v1.2.3