aboutsummaryrefslogtreecommitdiff
path: root/libanalysis
diff options
context:
space:
mode:
Diffstat (limited to 'libanalysis')
-rw-r--r--libanalysis/Cargo.toml1
-rw-r--r--libanalysis/src/lib.rs14
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"
4authors = ["Aleksey Kladov <[email protected]>"] 4authors = ["Aleksey Kladov <[email protected]>"]
5 5
6[dependencies] 6[dependencies]
7log = "0.4.2"
7failure = "0.1.2" 8failure = "0.1.2"
8parking_lot = "0.6.3" 9parking_lot = "0.6.3"
9libsyntax2 = { path = "../" } 10libsyntax2 = { 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 @@
1extern crate failure; 1extern crate failure;
2extern crate libsyntax2;
3extern crate parking_lot; 2extern crate parking_lot;
3#[macro_use]
4extern crate log;
5extern crate libsyntax2;
6
7mod arena;
4 8
5use std::{ 9use 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();