aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-27 22:42:13 +0100
committerAleksey Kladov <[email protected]>2018-08-27 22:42:13 +0100
commit13110f48e948d7554500aefc336e72f96041386b (patch)
tree60796fe2a4de16e37ff844c3360726e526c9b506 /crates/libanalysis/src
parent8f5330cb0796670a93089107c8b15cdef3fa7c94 (diff)
Log errors
Diffstat (limited to 'crates/libanalysis/src')
-rw-r--r--crates/libanalysis/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs
index 7a34d354e..fe2c3c2e6 100644
--- a/crates/libanalysis/src/lib.rs
+++ b/crates/libanalysis/src/lib.rs
@@ -15,6 +15,7 @@ mod module_map;
15use std::{ 15use std::{
16 fmt, 16 fmt,
17 path::{Path, PathBuf}, 17 path::{Path, PathBuf},
18 panic,
18 sync::{ 19 sync::{
19 Arc, 20 Arc,
20 atomic::{AtomicBool, Ordering::SeqCst}, 21 atomic::{AtomicBool, Ordering::SeqCst},
@@ -307,8 +308,15 @@ impl FileData {
307 } 308 }
308 309
309 fn syntax(&self) -> &File { 310 fn syntax(&self) -> &File {
310 self.syntax 311 let text = &self.text;
311 .get_or_init(|| File::parse(&self.text)) 312 let syntax = &self.syntax;
313 match panic::catch_unwind(panic::AssertUnwindSafe(|| syntax.get_or_init(|| File::parse(text)))) {
314 Ok(file) => file,
315 Err(err) => {
316 error!("Parser paniced on:\n------\n{}\n------\n", &self.text);
317 panic::resume_unwind(err)
318 }
319 }
312 } 320 }
313 321
314 fn syntax_transient(&self) -> File { 322 fn syntax_transient(&self) -> File {