aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-01-05 21:37:59 +0000
committerFlorian Diebold <[email protected]>2019-01-05 23:29:36 +0000
commit8e3e5ab2c81f238ea4e731f55eac79b74d9d84c3 (patch)
treee0388878b4d94ae71fbf82d3e3163c49c8e69c16 /crates/ra_syntax/src/ast
parent136aba1cf32646278c4034541ee415f656f8bb5e (diff)
Make FnScopes use hir::Expr
This was a bit complicated. I've added a wrapper type for now that does the LocalSyntaxPtr <-> ExprId translation; we might want to get rid of that or give it a nicer interface.
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs25
1 files changed, 9 insertions, 16 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index deb4dea88..24f72393a 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -927,12 +927,7 @@ pub enum Expr<'a> {
927 BlockExpr(BlockExpr<'a>), 927 BlockExpr(BlockExpr<'a>),
928 ReturnExpr(ReturnExpr<'a>), 928 ReturnExpr(ReturnExpr<'a>),
929 MatchExpr(MatchExpr<'a>), 929 MatchExpr(MatchExpr<'a>),
930 MatchArmList(MatchArmList<'a>),
931 MatchArm(MatchArm<'a>),
932 MatchGuard(MatchGuard<'a>),
933 StructLit(StructLit<'a>), 930 StructLit(StructLit<'a>),
934 NamedFieldList(NamedFieldList<'a>),
935 NamedField(NamedField<'a>),
936 CallExpr(CallExpr<'a>), 931 CallExpr(CallExpr<'a>),
937 IndexExpr(IndexExpr<'a>), 932 IndexExpr(IndexExpr<'a>),
938 MethodCallExpr(MethodCallExpr<'a>), 933 MethodCallExpr(MethodCallExpr<'a>),
@@ -964,12 +959,7 @@ impl<'a> AstNode<'a> for Expr<'a> {
964 BLOCK_EXPR => Some(Expr::BlockExpr(BlockExpr { syntax })), 959 BLOCK_EXPR => Some(Expr::BlockExpr(BlockExpr { syntax })),
965 RETURN_EXPR => Some(Expr::ReturnExpr(ReturnExpr { syntax })), 960 RETURN_EXPR => Some(Expr::ReturnExpr(ReturnExpr { syntax })),
966 MATCH_EXPR => Some(Expr::MatchExpr(MatchExpr { syntax })), 961 MATCH_EXPR => Some(Expr::MatchExpr(MatchExpr { syntax })),
967 MATCH_ARM_LIST => Some(Expr::MatchArmList(MatchArmList { syntax })),
968 MATCH_ARM => Some(Expr::MatchArm(MatchArm { syntax })),
969 MATCH_GUARD => Some(Expr::MatchGuard(MatchGuard { syntax })),
970 STRUCT_LIT => Some(Expr::StructLit(StructLit { syntax })), 962 STRUCT_LIT => Some(Expr::StructLit(StructLit { syntax })),
971 NAMED_FIELD_LIST => Some(Expr::NamedFieldList(NamedFieldList { syntax })),
972 NAMED_FIELD => Some(Expr::NamedField(NamedField { syntax })),
973 CALL_EXPR => Some(Expr::CallExpr(CallExpr { syntax })), 963 CALL_EXPR => Some(Expr::CallExpr(CallExpr { syntax })),
974 INDEX_EXPR => Some(Expr::IndexExpr(IndexExpr { syntax })), 964 INDEX_EXPR => Some(Expr::IndexExpr(IndexExpr { syntax })),
975 METHOD_CALL_EXPR => Some(Expr::MethodCallExpr(MethodCallExpr { syntax })), 965 METHOD_CALL_EXPR => Some(Expr::MethodCallExpr(MethodCallExpr { syntax })),
@@ -1001,12 +991,7 @@ impl<'a> AstNode<'a> for Expr<'a> {
1001 Expr::BlockExpr(inner) => inner.syntax(), 991 Expr::BlockExpr(inner) => inner.syntax(),
1002 Expr::ReturnExpr(inner) => inner.syntax(), 992 Expr::ReturnExpr(inner) => inner.syntax(),
1003 Expr::MatchExpr(inner) => inner.syntax(), 993 Expr::MatchExpr(inner) => inner.syntax(),
1004 Expr::MatchArmList(inner) => inner.syntax(),
1005 Expr::MatchArm(inner) => inner.syntax(),
1006 Expr::MatchGuard(inner) => inner.syntax(),
1007 Expr::StructLit(inner) => inner.syntax(), 994 Expr::StructLit(inner) => inner.syntax(),
1008 Expr::NamedFieldList(inner) => inner.syntax(),
1009 Expr::NamedField(inner) => inner.syntax(),
1010 Expr::CallExpr(inner) => inner.syntax(), 995 Expr::CallExpr(inner) => inner.syntax(),
1011 Expr::IndexExpr(inner) => inner.syntax(), 996 Expr::IndexExpr(inner) => inner.syntax(),
1012 Expr::MethodCallExpr(inner) => inner.syntax(), 997 Expr::MethodCallExpr(inner) => inner.syntax(),
@@ -4155,7 +4140,15 @@ impl<R: TreeRoot<RaTypes>> TupleStructPatNode<R> {
4155} 4140}
4156 4141
4157 4142
4158impl<'a> TupleStructPat<'a> {} 4143impl<'a> TupleStructPat<'a> {
4144 pub fn args(self) -> impl Iterator<Item = Pat<'a>> + 'a {
4145 super::children(self)
4146 }
4147
4148 pub fn path(self) -> Option<Path<'a>> {
4149 super::child_opt(self)
4150 }
4151}
4159 4152
4160// TupleType 4153// TupleType
4161#[derive(Debug, Clone, Copy,)] 4154#[derive(Debug, Clone, Copy,)]