diff options
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index a8e115e47..3806a3605 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -117,31 +117,27 @@ impl Index<PatId> for Body { | |||
117 | } | 117 | } |
118 | 118 | ||
119 | impl BodySourceMap { | 119 | impl BodySourceMap { |
120 | pub fn expr_syntax(&self, expr: ExprId) -> Option<SyntaxNodePtr> { | 120 | pub(crate) fn expr_syntax(&self, expr: ExprId) -> Option<SyntaxNodePtr> { |
121 | self.expr_map_back.get(expr).cloned() | 121 | self.expr_map_back.get(expr).cloned() |
122 | } | 122 | } |
123 | 123 | ||
124 | pub fn syntax_expr(&self, ptr: SyntaxNodePtr) -> Option<ExprId> { | 124 | pub(crate) fn syntax_expr(&self, ptr: SyntaxNodePtr) -> Option<ExprId> { |
125 | self.expr_map.get(&ptr).cloned() | 125 | self.expr_map.get(&ptr).cloned() |
126 | } | 126 | } |
127 | 127 | ||
128 | pub fn node_expr(&self, node: &ast::Expr) -> Option<ExprId> { | 128 | pub(crate) fn node_expr(&self, node: &ast::Expr) -> Option<ExprId> { |
129 | self.expr_map.get(&SyntaxNodePtr::new(node.syntax())).cloned() | 129 | self.expr_map.get(&SyntaxNodePtr::new(node.syntax())).cloned() |
130 | } | 130 | } |
131 | 131 | ||
132 | pub fn pat_syntax(&self, pat: PatId) -> Option<PatPtr> { | 132 | pub(crate) fn pat_syntax(&self, pat: PatId) -> Option<PatPtr> { |
133 | self.pat_map_back.get(pat).cloned() | 133 | self.pat_map_back.get(pat).cloned() |
134 | } | 134 | } |
135 | 135 | ||
136 | pub fn syntax_pat(&self, ptr: PatPtr) -> Option<PatId> { | 136 | pub(crate) fn node_pat(&self, node: &ast::Pat) -> Option<PatId> { |
137 | self.pat_map.get(&ptr).cloned() | ||
138 | } | ||
139 | |||
140 | pub fn node_pat(&self, node: &ast::Pat) -> Option<PatId> { | ||
141 | self.pat_map.get(&Either::A(AstPtr::new(node))).cloned() | 137 | self.pat_map.get(&Either::A(AstPtr::new(node))).cloned() |
142 | } | 138 | } |
143 | 139 | ||
144 | pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::NamedField> { | 140 | pub(crate) fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::NamedField> { |
145 | self.field_map[&(expr, field)].clone() | 141 | self.field_map[&(expr, field)].clone() |
146 | } | 142 | } |
147 | } | 143 | } |