aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-13 09:24:09 +0100
committerAleksey Kladov <[email protected]>2019-04-13 09:24:09 +0100
commitf9e825d95624129b66c34f25904f6ae46b9d5760 (patch)
treedd58a7e954b8479abf218a5da5245542c091f529 /crates/ra_hir/src/expr
parentd387bdccba2b5bb681e5b6c84cc1b0efe5c1a79a (diff)
move ScopeEntryWithSyntax
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/scope.rs45
1 files changed, 13 insertions, 32 deletions
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 @@
1use std::sync::Arc; 1use std::sync::Arc;
2 2
3use rustc_hash::{FxHashMap}; 3use rustc_hash::FxHashMap;
4use ra_syntax::{ 4use ra_syntax::TextRange;
5 TextRange, AstPtr,
6 ast,
7};
8use ra_arena::{Arena, RawId, impl_arena_id}; 5use ra_arena::{Arena, RawId, impl_arena_id};
9 6
10use crate::{ 7use crate::{
11 Name, DefWithBody, Either, 8 Name, DefWithBody,
12 expr::{PatId, ExprId, Pat, Expr, Body, Statement}, 9 expr::{PatId, ExprId, Pat, Expr, Body, Statement},
13 HirDatabase, 10 HirDatabase,
14}; 11};
@@ -30,6 +27,16 @@ pub(crate) struct ScopeEntry {
30 pat: PatId, 27 pat: PatId,
31} 28}
32 29
30impl ScopeEntry {
31 pub(crate) fn name(&self) -> &Name {
32 &self.name
33 }
34
35 pub(crate) fn pat(&self) -> PatId {
36 self.pat
37 }
38}
39
33#[derive(Debug, PartialEq, Eq)] 40#[derive(Debug, PartialEq, Eq)]
34pub(crate) struct ScopeData { 41pub(crate) struct ScopeData {
35 parent: Option<ScopeId>, 42 parent: Option<ScopeId>,
@@ -100,32 +107,6 @@ impl ExprScopes {
100 } 107 }
101} 108}
102 109
103#[derive(Debug, Clone, PartialEq, Eq)]
104pub struct ScopeEntryWithSyntax {
105 pub(crate) name: Name,
106 pub(crate) ptr: Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>,
107}
108
109impl ScopeEntryWithSyntax {
110 pub fn name(&self) -> &Name {
111 &self.name
112 }
113
114 pub fn ptr(&self) -> Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>> {
115 self.ptr
116 }
117}
118
119impl ScopeEntry {
120 pub fn name(&self) -> &Name {
121 &self.name
122 }
123
124 pub fn pat(&self) -> PatId {
125 self.pat
126 }
127}
128
129fn compute_block_scopes( 110fn compute_block_scopes(
130 statements: &[Statement], 111 statements: &[Statement],
131 tail: Option<ExprId>, 112 tail: Option<ExprId>,