diff options
author | ice1000 <[email protected]> | 2019-12-03 16:07:56 +0000 |
---|---|---|
committer | ice1000 <[email protected]> | 2019-12-03 16:07:56 +0000 |
commit | 009437f5d9949d2276aa26040e03af0ab328acf3 (patch) | |
tree | 74a889d70e201d6997c6baf179261ab3ed8bf23c /crates/ra_hir_def/src/body/lower.rs | |
parent | 15f143f0c33cbd382a2ad7a407d9601cb843d164 (diff) |
Replace `ra_hir_expand::either` with crate
Diffstat (limited to 'crates/ra_hir_def/src/body/lower.rs')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index be1eaa523..71c08f024 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -1,10 +1,8 @@ | |||
1 | //! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` | 1 | //! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` |
2 | //! representation. | 2 | //! representation. |
3 | 3 | ||
4 | use hir_expand::{ | 4 | use either::Either; |
5 | either::Either, | 5 | use hir_expand::name::{self, AsName, Name}; |
6 | name::{self, AsName, Name}, | ||
7 | }; | ||
8 | use ra_arena::Arena; | 6 | use ra_arena::Arena; |
9 | use ra_syntax::{ | 7 | use ra_syntax::{ |
10 | ast::{ | 8 | ast::{ |
@@ -74,7 +72,7 @@ where | |||
74 | mode: BindingAnnotation::Unannotated, | 72 | mode: BindingAnnotation::Unannotated, |
75 | subpat: None, | 73 | subpat: None, |
76 | }, | 74 | }, |
77 | Either::B(ptr), | 75 | Either::Right(ptr), |
78 | ); | 76 | ); |
79 | self.body.params.push(param_pat); | 77 | self.body.params.push(param_pat); |
80 | } | 78 | } |
@@ -94,7 +92,7 @@ where | |||
94 | } | 92 | } |
95 | 93 | ||
96 | fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { | 94 | fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { |
97 | let ptr = Either::A(ptr); | 95 | let ptr = Either::Left(ptr); |
98 | let id = self.body.exprs.alloc(expr); | 96 | let id = self.body.exprs.alloc(expr); |
99 | let src = self.expander.to_source(ptr); | 97 | let src = self.expander.to_source(ptr); |
100 | self.source_map.expr_map.insert(src, id); | 98 | self.source_map.expr_map.insert(src, id); |
@@ -107,7 +105,7 @@ where | |||
107 | self.body.exprs.alloc(expr) | 105 | self.body.exprs.alloc(expr) |
108 | } | 106 | } |
109 | fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId { | 107 | fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId { |
110 | let ptr = Either::B(ptr); | 108 | let ptr = Either::Right(ptr); |
111 | let id = self.body.exprs.alloc(expr); | 109 | let id = self.body.exprs.alloc(expr); |
112 | let src = self.expander.to_source(ptr); | 110 | let src = self.expander.to_source(ptr); |
113 | self.source_map.expr_map.insert(src, id); | 111 | self.source_map.expr_map.insert(src, id); |
@@ -277,7 +275,7 @@ where | |||
277 | ast::Expr::ParenExpr(e) => { | 275 | ast::Expr::ParenExpr(e) => { |
278 | let inner = self.collect_expr_opt(e.expr()); | 276 | let inner = self.collect_expr_opt(e.expr()); |
279 | // make the paren expr point to the inner expression as well | 277 | // make the paren expr point to the inner expression as well |
280 | let src = self.expander.to_source(Either::A(syntax_ptr)); | 278 | let src = self.expander.to_source(Either::Left(syntax_ptr)); |
281 | self.source_map.expr_map.insert(src, inner); | 279 | self.source_map.expr_map.insert(src, inner); |
282 | inner | 280 | inner |
283 | } | 281 | } |
@@ -550,7 +548,7 @@ where | |||
550 | ast::Pat::SlicePat(_) | ast::Pat::RangePat(_) => Pat::Missing, | 548 | ast::Pat::SlicePat(_) | ast::Pat::RangePat(_) => Pat::Missing, |
551 | }; | 549 | }; |
552 | let ptr = AstPtr::new(&pat); | 550 | let ptr = AstPtr::new(&pat); |
553 | self.alloc_pat(pattern, Either::A(ptr)) | 551 | self.alloc_pat(pattern, Either::Left(ptr)) |
554 | } | 552 | } |
555 | 553 | ||
556 | fn collect_pat_opt(&mut self, pat: Option<ast::Pat>) -> PatId { | 554 | fn collect_pat_opt(&mut self, pat: Option<ast::Pat>) -> PatId { |