From 0b8fbb4fad97d2980f0070a23f5365a5ed887e2a Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Wed, 9 Jan 2019 00:47:12 +0100 Subject: Fix typos in ARCHITECTURE.md and a number of crates specifically: gen_lsp_server, ra_arena, ra_cli, ra_db, ra_hir --- crates/ra_hir/src/expr.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/expr.rs') diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index a31f086f7..ebb83d084 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -33,8 +33,7 @@ pub struct Body { /// IDs. This is needed to go from e.g. a position in a file to the HIR /// expression containing it; but for type inference etc., we want to operate on /// a structure that is agnostic to the actual positions of expressions in the -/// file, so that we don't recompute the type inference whenever some whitespace -/// is typed. +/// file, so that we don't recompute types whenever some whitespace is typed. #[derive(Debug, Eq, PartialEq)] pub struct BodySyntaxMapping { body: Arc, @@ -74,20 +73,25 @@ impl BodySyntaxMapping { pub fn expr_syntax(&self, expr: ExprId) -> Option { self.expr_syntax_mapping_back.get(expr).cloned() } + pub fn syntax_expr(&self, ptr: LocalSyntaxPtr) -> Option { self.expr_syntax_mapping.get(&ptr).cloned() } + pub fn node_expr(&self, node: &ast::Expr) -> Option { self.expr_syntax_mapping .get(&LocalSyntaxPtr::new(node.syntax())) .cloned() } + pub fn pat_syntax(&self, pat: PatId) -> Option { self.pat_syntax_mapping_back.get(pat).cloned() } + pub fn syntax_pat(&self, ptr: LocalSyntaxPtr) -> Option { self.pat_syntax_mapping.get(&ptr).cloned() } + pub fn node_pat(&self, node: &ast::Pat) -> Option { self.pat_syntax_mapping .get(&LocalSyntaxPtr::new(node.syntax())) -- cgit v1.2.3