aboutsummaryrefslogtreecommitdiff
path: root/libanalysis/src/lib.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-10 19:13:39 +0100
committerAleksey Kladov <[email protected]>2018-08-10 19:13:39 +0100
commit120789804d5483f14c9682b2b777adf6d2992547 (patch)
treebccbe4a72e648516f838499b91e5158484b5cbcd /libanalysis/src/lib.rs
parent1be7af26a83b79863efb0d66a77b1fb7c0235bd2 (diff)
Add line index
Diffstat (limited to 'libanalysis/src/lib.rs')
-rw-r--r--libanalysis/src/lib.rs14
1 files changed, 10 insertions, 4 deletions
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();