diff options
Diffstat (limited to 'libanalysis')
-rw-r--r-- | libanalysis/Cargo.toml | 1 | ||||
-rw-r--r-- | libanalysis/src/lib.rs | 14 |
2 files changed, 11 insertions, 4 deletions
diff --git a/libanalysis/Cargo.toml b/libanalysis/Cargo.toml index bde5043e8..737463258 100644 --- a/libanalysis/Cargo.toml +++ b/libanalysis/Cargo.toml | |||
@@ -4,6 +4,7 @@ version = "0.1.0" | |||
4 | authors = ["Aleksey Kladov <[email protected]>"] | 4 | authors = ["Aleksey Kladov <[email protected]>"] |
5 | 5 | ||
6 | [dependencies] | 6 | [dependencies] |
7 | log = "0.4.2" | ||
7 | failure = "0.1.2" | 8 | failure = "0.1.2" |
8 | parking_lot = "0.6.3" | 9 | parking_lot = "0.6.3" |
9 | libsyntax2 = { path = "../" } | 10 | libsyntax2 = { path = "../" } |
diff --git a/libanalysis/src/lib.rs b/libanalysis/src/lib.rs index 07e7d567d..417a544ca 100644 --- a/libanalysis/src/lib.rs +++ b/libanalysis/src/lib.rs | |||
@@ -1,6 +1,10 @@ | |||
1 | extern crate failure; | 1 | extern crate failure; |
2 | extern crate libsyntax2; | ||
3 | extern crate parking_lot; | 2 | extern crate parking_lot; |
3 | #[macro_use] | ||
4 | extern crate log; | ||
5 | extern crate libsyntax2; | ||
6 | |||
7 | mod arena; | ||
4 | 8 | ||
5 | use std::{ | 9 | use std::{ |
6 | fs, | 10 | fs, |
@@ -66,8 +70,10 @@ impl World { | |||
66 | return Ok(file.clone()); | 70 | return Ok(file.clone()); |
67 | } | 71 | } |
68 | } | 72 | } |
69 | 73 | let file = self.with_file_text(path, |text| { | |
70 | let file = self.with_file_text(path, ast::File::parse)?; | 74 | trace!("parsing file: {}", path.display()); |
75 | ast::File::parse(text) | ||
76 | })?; | ||
71 | let mut guard = self.data.file_map.write(); | 77 | let mut guard = self.data.file_map.write(); |
72 | let file = guard.entry(path.to_owned()) | 78 | let file = guard.entry(path.to_owned()) |
73 | .or_insert(file) | 79 | .or_insert(file) |
@@ -86,7 +92,7 @@ impl World { | |||
86 | return Ok(f(&*text)); | 92 | return Ok(f(&*text)); |
87 | } | 93 | } |
88 | } | 94 | } |
89 | 95 | trace!("loading file from disk: {}", path.display()); | |
90 | let text = fs::read_to_string(path)?; | 96 | let text = fs::read_to_string(path)?; |
91 | { | 97 | { |
92 | let mut guard = self.data.fs_map.write(); | 98 | let mut guard = self.data.fs_map.write(); |