aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/body.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/body.rs')
-rw-r--r--crates/ra_hir_def/src/body.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index a57a0176d..f21937f10 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -6,7 +6,7 @@ pub mod scope;
6use std::{ops::Index, sync::Arc}; 6use std::{ops::Index, sync::Arc};
7 7
8use hir_expand::{ 8use hir_expand::{
9 either::Either, hygiene::Hygiene, AstId, HirFileId, MacroDefId, MacroFileKind, Source, 9 either::Either, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId, MacroFileKind,
10}; 10};
11use ra_arena::{map::ArenaMap, Arena}; 11use ra_arena::{map::ArenaMap, Arena};
12use ra_syntax::{ast, AstNode, AstPtr}; 12use ra_syntax::{ast, AstNode, AstPtr};
@@ -73,8 +73,8 @@ impl Expander {
73 std::mem::forget(mark); 73 std::mem::forget(mark);
74 } 74 }
75 75
76 fn to_source<T>(&self, value: T) -> Source<T> { 76 fn to_source<T>(&self, value: T) -> InFile<T> {
77 Source { file_id: self.current_file_id, value } 77 InFile { file_id: self.current_file_id, value }
78 } 78 }
79 79
80 fn parse_path(&mut self, path: ast::Path) -> Option<Path> { 80 fn parse_path(&mut self, path: ast::Path) -> Option<Path> {
@@ -115,10 +115,10 @@ pub struct Body {
115} 115}
116 116
117pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; 117pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>;
118pub type ExprSource = Source<ExprPtr>; 118pub type ExprSource = InFile<ExprPtr>;
119 119
120pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; 120pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>;
121pub type PatSource = Source<PatPtr>; 121pub type PatSource = InFile<PatPtr>;
122 122
123/// An item body together with the mapping from syntax nodes to HIR expression 123/// An item body together with the mapping from syntax nodes to HIR expression
124/// IDs. This is needed to go from e.g. a position in a file to the HIR 124/// IDs. This is needed to go from e.g. a position in a file to the HIR
@@ -205,7 +205,7 @@ impl BodySourceMap {
205 self.expr_map_back.get(expr).copied() 205 self.expr_map_back.get(expr).copied()
206 } 206 }
207 207
208 pub fn node_expr(&self, node: Source<&ast::Expr>) -> Option<ExprId> { 208 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> {
209 let src = node.map(|it| Either::A(AstPtr::new(it))); 209 let src = node.map(|it| Either::A(AstPtr::new(it)));
210 self.expr_map.get(&src).cloned() 210 self.expr_map.get(&src).cloned()
211 } 211 }
@@ -214,7 +214,7 @@ impl BodySourceMap {
214 self.pat_map_back.get(pat).copied() 214 self.pat_map_back.get(pat).copied()
215 } 215 }
216 216
217 pub fn node_pat(&self, node: Source<&ast::Pat>) -> Option<PatId> { 217 pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> {
218 let src = node.map(|it| Either::A(AstPtr::new(it))); 218 let src = node.map(|it| Either::A(AstPtr::new(it)));
219 self.pat_map.get(&src).cloned() 219 self.pat_map.get(&src).cloned()
220 } 220 }