From 7b901f86cd1d0198994e5a2ab7eea18f444dd148 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 17:37:10 +0300 Subject: move SyntaxPtr to ra_syntax --- crates/ra_hir/src/code_model_impl/function/scope.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl/function/scope.rs') diff --git a/crates/ra_hir/src/code_model_impl/function/scope.rs b/crates/ra_hir/src/code_model_impl/function/scope.rs index 3a7d53a93..c5d1de5eb 100644 --- a/crates/ra_hir/src/code_model_impl/function/scope.rs +++ b/crates/ra_hir/src/code_model_impl/function/scope.rs @@ -3,12 +3,11 @@ use std::sync::Arc; use rustc_hash::{FxHashMap, FxHashSet}; use ra_syntax::{ - AstNode, SyntaxNode, TextUnit, TextRange, + AstNode, SyntaxNode, TextUnit, TextRange, SyntaxNodePtr, algo::generate, ast, }; use ra_arena::{Arena, RawId, impl_arena_id}; -use ra_db::LocalSyntaxPtr; use crate::{Name, AsName, expr::{PatId, ExprId, Pat, Expr, Body, Statement, BodySyntaxMapping}}; @@ -126,7 +125,7 @@ pub struct ScopesWithSyntaxMapping { #[derive(Debug, Clone, PartialEq, Eq)] pub struct ScopeEntryWithSyntax { name: Name, - ptr: LocalSyntaxPtr, + ptr: SyntaxNodePtr, } impl ScopeEntryWithSyntax { @@ -134,7 +133,7 @@ impl ScopeEntryWithSyntax { &self.name } - pub fn ptr(&self) -> LocalSyntaxPtr { + pub fn ptr(&self) -> SyntaxNodePtr { self.ptr } } @@ -169,7 +168,7 @@ impl ScopesWithSyntaxMapping { // XXX: during completion, cursor might be outside of any particular // expression. Try to figure out the correct scope... - fn adjust(&self, ptr: LocalSyntaxPtr, original_scope: ScopeId, offset: TextUnit) -> ScopeId { + fn adjust(&self, ptr: SyntaxNodePtr, original_scope: ScopeId, offset: TextUnit) -> ScopeId { let r = ptr.range(); let child_scopes = self .scopes @@ -212,7 +211,7 @@ impl ScopesWithSyntaxMapping { pub fn find_all_refs(&self, pat: &ast::BindPat) -> Vec { let fn_def = pat.syntax().ancestors().find_map(ast::FnDef::cast).unwrap(); - let name_ptr = LocalSyntaxPtr::new(pat.syntax()); + let name_ptr = SyntaxNodePtr::new(pat.syntax()); fn_def .syntax() .descendants() @@ -230,7 +229,7 @@ impl ScopesWithSyntaxMapping { fn scope_for(&self, node: &SyntaxNode) -> Option { node.ancestors() - .map(LocalSyntaxPtr::new) + .map(SyntaxNodePtr::new) .filter_map(|ptr| self.syntax_mapping.syntax_expr(ptr)) .find_map(|it| self.scopes.scope_for(it)) } -- cgit v1.2.3