From fc1e543f7abb69b8cab308410fa0a127950ee1c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 23 Nov 2019 14:44:43 +0300 Subject: Get rid of DefDatabase2 --- crates/ra_hir_def/src/body/lower.rs | 6 +++--- crates/ra_hir_def/src/body/scope.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir_def/src/body') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index d8e911aa5..f4640dfa4 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -17,7 +17,7 @@ use test_utils::tested_by; use crate::{ body::{Body, BodySourceMap, Expander, PatPtr}, builtin_type::{BuiltinFloat, BuiltinInt}, - db::DefDatabase2, + db::DefDatabase, expr::{ ArithOp, Array, BinaryOp, BindingAnnotation, CmpOp, Expr, ExprId, Literal, LogicOp, MatchArm, Ordering, Pat, PatId, RecordFieldPat, RecordLitField, Statement, @@ -28,7 +28,7 @@ use crate::{ }; pub(super) fn lower( - db: &impl DefDatabase2, + db: &impl DefDatabase, expander: Expander, params: Option, body: Option, @@ -57,7 +57,7 @@ struct ExprCollector { impl<'a, DB> ExprCollector<&'a DB> where - DB: DefDatabase2, + DB: DefDatabase, { fn collect( mut self, diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 58740b679..20d707bc4 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -7,7 +7,7 @@ use rustc_hash::FxHashMap; use crate::{ body::Body, - db::DefDatabase2, + db::DefDatabase, expr::{Expr, ExprId, Pat, PatId, Statement}, DefWithBodyId, }; @@ -45,7 +45,7 @@ pub struct ScopeData { } impl ExprScopes { - pub(crate) fn expr_scopes_query(db: &impl DefDatabase2, def: DefWithBodyId) -> Arc { + pub(crate) fn expr_scopes_query(db: &impl DefDatabase, def: DefWithBodyId) -> Arc { let body = db.body(def); Arc::new(ExprScopes::new(&*body)) } @@ -176,7 +176,7 @@ mod tests { use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; use test_utils::{assert_eq_text, covers, extract_offset}; - use crate::{db::DefDatabase2, test_db::TestDB, FunctionId, ModuleDefId}; + use crate::{db::DefDatabase, test_db::TestDB, FunctionId, ModuleDefId}; fn find_function(db: &TestDB, file_id: FileId) -> FunctionId { let krate = db.test_crate(); -- cgit v1.2.3 From 434f108adad75b7c5e25db745a9f9fefa5cdaa31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 18:48:29 +0300 Subject: Simplify --- crates/ra_hir_def/src/body/scope.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/body') diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 20d707bc4..5240a59d5 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -54,8 +54,8 @@ impl ExprScopes { let mut scopes = ExprScopes { scopes: Arena::default(), scope_by_expr: FxHashMap::default() }; let root = scopes.root_scope(); - scopes.add_params_bindings(body, root, body.params()); - compute_expr_scopes(body.body_expr(), body, &mut scopes, root); + scopes.add_params_bindings(body, root, &body.params); + compute_expr_scopes(body.body_expr, body, &mut scopes, root); scopes } -- cgit v1.2.3 From d157812cd16f58128646c05bf1b80522d43acfd8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 20:39:48 +0300 Subject: Docs --- crates/ra_hir_def/src/body/lower.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_def/src/body') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index f4640dfa4..331736cb2 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -1,4 +1,5 @@ -//! FIXME: write short doc here +//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` +//! representation. use hir_expand::{ either::Either, -- cgit v1.2.3 From d87c16bea60f4972b0adf4dd69bbb9abcfca12d6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 21:00:50 +0300 Subject: hir_def is fully doc'ed! --- crates/ra_hir_def/src/body/scope.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_hir_def/src/body') diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 5240a59d5..625aa39dd 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs @@ -1,4 +1,4 @@ -//! FIXME: write short doc here +//! Name resolution for expressions. use std::sync::Arc; use hir_expand::name::Name; -- cgit v1.2.3