move ScopeEntryWithSyntax

This commit is contained in:
Aleksey Kladov 2019-04-13 11:24:09 +03:00
parent d387bdccba
commit f9e825d956
4 changed files with 34 additions and 37 deletions

View file

@ -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<ScopeId>,
@ -100,32 +107,6 @@ impl ExprScopes {
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ScopeEntryWithSyntax {
pub(crate) name: Name,
pub(crate) ptr: Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>,
}
impl ScopeEntryWithSyntax {
pub fn name(&self) -> &Name {
&self.name
}
pub fn ptr(&self) -> Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>> {
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<ExprId>,