aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-15 18:55:03 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-15 18:55:03 +0100
commite929355eca10b1d8d4e55ddd41549d5bf0a685aa (patch)
tree872ab3701dcd27207fab5531269a66d205c74539 /crates/ra_analysis
parenta230b438e025c5878b8d17e11d3928cbad95bb28 (diff)
parent9a98d8e99acf8acd40b2153847a37551d2a8d0f4 (diff)
Merge #129
129: 2018 r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r--crates/ra_analysis/Cargo.toml1
-rw-r--r--crates/ra_analysis/src/db/imp.rs4
-rw-r--r--crates/ra_analysis/src/db/mod.rs6
-rw-r--r--crates/ra_analysis/src/descriptors.rs4
-rw-r--r--crates/ra_analysis/src/imp.rs4
-rw-r--r--crates/ra_analysis/src/lib.rs8
-rw-r--r--crates/ra_analysis/src/module_map.rs4
-rw-r--r--crates/ra_analysis/src/queries.rs4
-rw-r--r--crates/ra_analysis/src/roots.rs12
-rw-r--r--crates/ra_analysis/src/symbol_index.rs2
10 files changed, 26 insertions, 23 deletions
diff --git a/crates/ra_analysis/Cargo.toml b/crates/ra_analysis/Cargo.toml
index a82e1761c..28d95c581 100644
--- a/crates/ra_analysis/Cargo.toml
+++ b/crates/ra_analysis/Cargo.toml
@@ -1,4 +1,5 @@
1[package] 1[package]
2edition = "2018"
2name = "ra_analysis" 3name = "ra_analysis"
3version = "0.1.0" 4version = "0.1.0"
4authors = ["Aleksey Kladov <[email protected]>"] 5authors = ["Aleksey Kladov <[email protected]>"]
diff --git a/crates/ra_analysis/src/db/imp.rs b/crates/ra_analysis/src/db/imp.rs
index 36f6cf290..7669b6184 100644
--- a/crates/ra_analysis/src/db/imp.rs
+++ b/crates/ra_analysis/src/db/imp.rs
@@ -7,7 +7,7 @@ use std::{
7}; 7};
8use rustc_hash::FxHashMap; 8use rustc_hash::FxHashMap;
9use salsa; 9use salsa;
10use {FileId, imp::FileResolverImp}; 10use crate::{FileId, imp::FileResolverImp};
11use super::{State, Query, QueryCtx}; 11use super::{State, Query, QueryCtx};
12 12
13pub(super) type Data = Arc<Any + Send + Sync + 'static>; 13pub(super) type Data = Arc<Any + Send + Sync + 'static>;
@@ -51,7 +51,7 @@ pub(crate) trait EvalQuery {
51 type Output; 51 type Output;
52 fn query_type(&self) -> salsa::QueryTypeId; 52 fn query_type(&self) -> salsa::QueryTypeId;
53 fn f(&self) -> salsa::QueryFn<State, Data>; 53 fn f(&self) -> salsa::QueryFn<State, Data>;
54 fn get(&self, &QueryCtx, Self::Params) -> Arc<Self::Output>; 54 fn get(&self, ctx: &QueryCtx, params: Self::Params) -> Arc<Self::Output>;
55} 55}
56 56
57impl<T, R> EvalQuery for Query<T, R> 57impl<T, R> EvalQuery for Query<T, R>
diff --git a/crates/ra_analysis/src/db/mod.rs b/crates/ra_analysis/src/db/mod.rs
index 22769d112..4eb7d922d 100644
--- a/crates/ra_analysis/src/db/mod.rs
+++ b/crates/ra_analysis/src/db/mod.rs
@@ -5,7 +5,7 @@ use std::{
5}; 5};
6use im; 6use im;
7use salsa; 7use salsa;
8use {FileId, imp::FileResolverImp}; 8use crate::{FileId, imp::FileResolverImp};
9 9
10#[derive(Debug, Default, Clone)] 10#[derive(Debug, Default, Clone)]
11pub(crate) struct State { 11pub(crate) struct State {
@@ -75,8 +75,8 @@ pub(crate) fn file_set(ctx: QueryCtx) -> Arc<(Vec<FileId>, FileResolverImp)> {
75impl QueryRegistry { 75impl QueryRegistry {
76 fn new() -> QueryRegistry { 76 fn new() -> QueryRegistry {
77 let mut reg = QueryRegistry { imp: imp::QueryRegistry::new() }; 77 let mut reg = QueryRegistry { imp: imp::QueryRegistry::new() };
78 ::queries::register_queries(&mut reg); 78 crate::queries::register_queries(&mut reg);
79 ::module_map::register_queries(&mut reg); 79 crate::module_map::register_queries(&mut reg);
80 reg 80 reg
81 } 81 }
82 pub(crate) fn add<Q: imp::EvalQuery>(&mut self, q: Q, name: &'static str) { 82 pub(crate) fn add<Q: imp::EvalQuery>(&mut self, q: Q, name: &'static str) {
diff --git a/crates/ra_analysis/src/descriptors.rs b/crates/ra_analysis/src/descriptors.rs
index faf945a41..f26dac875 100644
--- a/crates/ra_analysis/src/descriptors.rs
+++ b/crates/ra_analysis/src/descriptors.rs
@@ -7,7 +7,7 @@ use ra_syntax::{
7 ast::{self, NameOwner, AstNode}, 7 ast::{self, NameOwner, AstNode},
8 text_utils::is_subrange 8 text_utils::is_subrange
9}; 9};
10use { 10use crate::{
11 FileId, 11 FileId,
12 imp::FileResolverImp, 12 imp::FileResolverImp,
13}; 13};
@@ -271,4 +271,4 @@ impl FnDescriptor {
271 } 271 }
272 res 272 res
273 } 273 }
274} \ No newline at end of file 274}
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index aad54b977..26f5e175b 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -17,7 +17,7 @@ use ra_syntax::{
17 ast::{self, NameOwner, ArgListOwner, Expr}, 17 ast::{self, NameOwner, ArgListOwner, Expr},
18}; 18};
19 19
20use { 20use crate::{
21 FileId, FileResolver, Query, Diagnostic, SourceChange, SourceFileEdit, Position, FileSystemEdit, 21 FileId, FileResolver, Query, Diagnostic, SourceChange, SourceFileEdit, Position, FileSystemEdit,
22 JobToken, CrateGraph, CrateId, 22 JobToken, CrateGraph, CrateId,
23 roots::{SourceRoot, ReadonlySourceRoot, WritableSourceRoot}, 23 roots::{SourceRoot, ReadonlySourceRoot, WritableSourceRoot},
@@ -458,4 +458,4 @@ impl<'a> FnCallNode<'a> {
458 FnCallNode::MethodCallExpr(expr) => expr.arg_list() 458 FnCallNode::MethodCallExpr(expr) => expr.arg_list()
459 } 459 }
460 } 460 }
461} \ No newline at end of file 461}
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 1aca72ae0..86c66236c 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -29,16 +29,18 @@ use std::{
29 29
30use relative_path::{RelativePath, RelativePathBuf}; 30use relative_path::{RelativePath, RelativePathBuf};
31use ra_syntax::{File, TextRange, TextUnit, AtomEdit}; 31use ra_syntax::{File, TextRange, TextUnit, AtomEdit};
32use imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp};
33use rustc_hash::FxHashMap; 32use rustc_hash::FxHashMap;
33use crate::imp::{AnalysisImpl, AnalysisHostImpl, FileResolverImp};
34 34
35pub use ra_editor::{ 35pub use ra_editor::{
36 StructureNode, LineIndex, FileSymbol, 36 StructureNode, LineIndex, FileSymbol,
37 Runnable, RunnableKind, HighlightedRange, CompletionItem, 37 Runnable, RunnableKind, HighlightedRange, CompletionItem,
38 Fold, FoldKind 38 Fold, FoldKind
39}; 39};
40pub use job::{JobToken, JobHandle}; 40pub use crate::{
41pub use descriptors::FnDescriptor; 41 job::{JobToken, JobHandle},
42 descriptors::FnDescriptor,
43};
42 44
43#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 45#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
44pub struct FileId(pub u32); 46pub struct FileId(pub u32);
diff --git a/crates/ra_analysis/src/module_map.rs b/crates/ra_analysis/src/module_map.rs
index a21f55fff..c77c5cec6 100644
--- a/crates/ra_analysis/src/module_map.rs
+++ b/crates/ra_analysis/src/module_map.rs
@@ -1,5 +1,5 @@
1use std::sync::Arc; 1use std::sync::Arc;
2use { 2use crate::{
3 FileId, 3 FileId,
4 db::{ 4 db::{
5 Query, QueryRegistry, QueryCtx, 5 Query, QueryRegistry, QueryCtx,
@@ -38,7 +38,7 @@ mod tests {
38 use std::collections::HashMap; 38 use std::collections::HashMap;
39 use im; 39 use im;
40 use relative_path::{RelativePath, RelativePathBuf}; 40 use relative_path::{RelativePath, RelativePathBuf};
41 use { 41 use crate::{
42 db::{Db}, 42 db::{Db},
43 imp::FileResolverImp, 43 imp::FileResolverImp,
44 FileId, FileResolver, 44 FileId, FileResolver,
diff --git a/crates/ra_analysis/src/queries.rs b/crates/ra_analysis/src/queries.rs
index 062a2f420..613bf1e61 100644
--- a/crates/ra_analysis/src/queries.rs
+++ b/crates/ra_analysis/src/queries.rs
@@ -1,13 +1,13 @@
1use std::sync::Arc; 1use std::sync::Arc;
2use ra_syntax::File; 2use ra_syntax::File;
3use ra_editor::LineIndex; 3use ra_editor::LineIndex;
4use { 4use crate::{
5 FileId, 5 FileId,
6 db::{Query, QueryCtx, QueryRegistry}, 6 db::{Query, QueryCtx, QueryRegistry},
7 symbol_index::SymbolIndex, 7 symbol_index::SymbolIndex,
8}; 8};
9 9
10pub(crate) use db::{file_text, file_set}; 10pub(crate) use crate::db::{file_text, file_set};
11 11
12pub(crate) fn file_syntax(ctx: QueryCtx, file_id: FileId) -> File { 12pub(crate) fn file_syntax(ctx: QueryCtx, file_id: FileId) -> File {
13 (&*ctx.get(FILE_SYNTAX, file_id)).clone() 13 (&*ctx.get(FILE_SYNTAX, file_id)).clone()
diff --git a/crates/ra_analysis/src/roots.rs b/crates/ra_analysis/src/roots.rs
index 32a8c5bd0..208acc4c2 100644
--- a/crates/ra_analysis/src/roots.rs
+++ b/crates/ra_analysis/src/roots.rs
@@ -9,7 +9,7 @@ use rustc_hash::FxHashMap;
9use ra_editor::LineIndex; 9use ra_editor::LineIndex;
10use ra_syntax::File; 10use ra_syntax::File;
11 11
12use { 12use crate::{
13 FileId, 13 FileId,
14 imp::FileResolverImp, 14 imp::FileResolverImp,
15 symbol_index::SymbolIndex, 15 symbol_index::SymbolIndex,
@@ -62,23 +62,23 @@ impl WritableSourceRoot {
62 62
63impl SourceRoot for WritableSourceRoot { 63impl SourceRoot for WritableSourceRoot {
64 fn module_tree(&self) -> Arc<ModuleTreeDescriptor> { 64 fn module_tree(&self) -> Arc<ModuleTreeDescriptor> {
65 self.db.make_query(::module_map::module_tree) 65 self.db.make_query(crate::module_map::module_tree)
66 } 66 }
67 67
68 fn contains(&self, file_id: FileId) -> bool { 68 fn contains(&self, file_id: FileId) -> bool {
69 self.db.state().file_map.contains_key(&file_id) 69 self.db.state().file_map.contains_key(&file_id)
70 } 70 }
71 fn lines(&self, file_id: FileId) -> Arc<LineIndex> { 71 fn lines(&self, file_id: FileId) -> Arc<LineIndex> {
72 self.db.make_query(|ctx| ::queries::file_lines(ctx, file_id)) 72 self.db.make_query(|ctx| crate::queries::file_lines(ctx, file_id))
73 } 73 }
74 fn syntax(&self, file_id: FileId) -> File { 74 fn syntax(&self, file_id: FileId) -> File {
75 self.db.make_query(|ctx| ::queries::file_syntax(ctx, file_id)) 75 self.db.make_query(|ctx| crate::queries::file_syntax(ctx, file_id))
76 } 76 }
77 fn symbols<'a>(&'a self, acc: &mut Vec<Arc<SymbolIndex>>) { 77 fn symbols<'a>(&'a self, acc: &mut Vec<Arc<SymbolIndex>>) {
78 self.db.make_query(|ctx| { 78 self.db.make_query(|ctx| {
79 let file_set = ::queries::file_set(ctx); 79 let file_set = crate::queries::file_set(ctx);
80 let syms = file_set.0.iter() 80 let syms = file_set.0.iter()
81 .map(|file_id| ::queries::file_symbols(ctx, *file_id)); 81 .map(|file_id| crate::queries::file_symbols(ctx, *file_id));
82 acc.extend(syms); 82 acc.extend(syms);
83 }); 83 });
84 } 84 }
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs
index ffbb6a29f..e5d83d365 100644
--- a/crates/ra_analysis/src/symbol_index.rs
+++ b/crates/ra_analysis/src/symbol_index.rs
@@ -9,7 +9,7 @@ use ra_syntax::{
9}; 9};
10use fst::{self, Streamer}; 10use fst::{self, Streamer};
11use rayon::prelude::*; 11use rayon::prelude::*;
12use {Query, FileId, JobToken}; 12use crate::{Query, FileId, JobToken};
13 13
14#[derive(Debug)] 14#[derive(Debug)]
15pub(crate) struct SymbolIndex { 15pub(crate) struct SymbolIndex {