From f9e825d95624129b66c34f25904f6ae46b9d5760 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 13 Apr 2019 11:24:09 +0300 Subject: move ScopeEntryWithSyntax --- crates/ra_hir/src/expr/scope.rs | 45 ++++++++++++----------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'crates/ra_hir/src/expr') diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index 6a6de5772..090343d12 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs @@ -1,14 +1,11 @@ use std::sync::Arc; -use rustc_hash::{FxHashMap}; -use ra_syntax::{ - TextRange, AstPtr, - ast, -}; +use rustc_hash::FxHashMap; +use ra_syntax::TextRange; use ra_arena::{Arena, RawId, impl_arena_id}; use crate::{ - Name, DefWithBody, Either, + Name, DefWithBody, expr::{PatId, ExprId, Pat, Expr, Body, Statement}, HirDatabase, }; @@ -30,6 +27,16 @@ pub(crate) struct ScopeEntry { pat: PatId, } +impl ScopeEntry { + pub(crate) fn name(&self) -> &Name { + &self.name + } + + pub(crate) fn pat(&self) -> PatId { + self.pat + } +} + #[derive(Debug, PartialEq, Eq)] pub(crate) struct ScopeData { parent: Option, @@ -100,32 +107,6 @@ impl ExprScopes { } } -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct ScopeEntryWithSyntax { - pub(crate) name: Name, - pub(crate) ptr: Either, AstPtr>, -} - -impl ScopeEntryWithSyntax { - pub fn name(&self) -> &Name { - &self.name - } - - pub fn ptr(&self) -> Either, AstPtr> { - self.ptr - } -} - -impl ScopeEntry { - pub fn name(&self) -> &Name { - &self.name - } - - pub fn pat(&self) -> PatId { - self.pat - } -} - fn compute_block_scopes( statements: &[Statement], tail: Option, -- cgit v1.2.3