diff options
author | Edwin Cheng <[email protected]> | 2020-03-04 19:02:51 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-04 19:02:51 +0000 |
commit | 0c79e1d304d2498abfceefec4d5907b187596c6a (patch) | |
tree | 742cfe238aefd01aef9cbbc317a9b7ed94296c62 /crates/ra_hir_expand | |
parent | c7b0c72dd7d288f066e916f3e217e51c26e3aa47 (diff) |
Add comment for parents logging
Diffstat (limited to 'crates/ra_hir_expand')
-rw-r--r-- | crates/ra_hir_expand/src/db.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index 73137f33b..f3a84cacc 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -176,16 +176,21 @@ pub(crate) fn parse_macro( | |||
176 | MacroCallId::LazyMacro(id) => { | 176 | MacroCallId::LazyMacro(id) => { |
177 | let loc: MacroCallLoc = db.lookup_intern_macro(id); | 177 | let loc: MacroCallLoc = db.lookup_intern_macro(id); |
178 | let node = loc.kind.node(db); | 178 | let node = loc.kind.node(db); |
179 | |||
180 | // collect parent information for warning log | ||
181 | let parents = std::iter::successors(loc.kind.file_id().call_node(db), |it| { | ||
182 | it.file_id.call_node(db) | ||
183 | }) | ||
184 | .map(|n| format!("{:#}", n.value)) | ||
185 | .collect::<Vec<_>>() | ||
186 | .join("\n"); | ||
187 | |||
179 | log::warn!( | 188 | log::warn!( |
180 | "fail on macro_parse: (reason: {} macro_call: {:#})", | 189 | "fail on macro_parse: (reason: {} macro_call: {:#}) parents: {}", |
181 | err, | 190 | err, |
182 | node.value | 191 | node.value, |
192 | parents | ||
183 | ); | 193 | ); |
184 | let mut parent = loc.kind.file_id().call_node(db); | ||
185 | while let Some(node) = parent.clone() { | ||
186 | log::warn!("parent: macro_call: {:#})", node.value); | ||
187 | parent = node.file_id.call_node(db); | ||
188 | } | ||
189 | } | 194 | } |
190 | _ => { | 195 | _ => { |
191 | log::warn!("fail on macro_parse: (reason: {})", err); | 196 | log::warn!("fail on macro_parse: (reason: {})", err); |