aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-01-11 08:37:42 +0000
committerEdwin Cheng <[email protected]>2020-01-11 08:37:42 +0000
commit9f65ae20c2eb862ffd73d0389e4efc272d52ce39 (patch)
treee597b50df617c7b17e202697e5c2cb5e09f93232 /crates
parenta9ba32e2e659dbbe78f7921f5b0abe7288c83aa9 (diff)
Use dummy value for macro file in bulitin macros
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs
index 2c119269c..e9e275670 100644
--- a/crates/ra_hir_expand/src/builtin_macro.rs
+++ b/crates/ra_hir_expand/src/builtin_macro.rs
@@ -62,8 +62,13 @@ register_builtin! {
62} 62}
63 63
64fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize { 64fn to_line_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
65 // FIXME: Use expansion info
66 let file_id = file.original_file(db); 65 let file_id = file.original_file(db);
66
67 // FIXME: if the file is coming from macro, we return a dummy value for now.
68 if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
69 return 0;
70 }
71
67 let text = db.file_text(file_id); 72 let text = db.file_text(file_id);
68 let mut line_num = 1; 73 let mut line_num = 1;
69 74
@@ -150,8 +155,11 @@ fn option_env_expand(
150} 155}
151 156
152fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize { 157fn to_col_number(db: &dyn AstDatabase, file: HirFileId, pos: TextUnit) -> usize {
153 // FIXME: Use expansion info
154 let file_id = file.original_file(db); 158 let file_id = file.original_file(db);
159 // FIXME: if the file is coming from macro, we return a dummy value for now.
160 if file.call_node(db).map(|it| it.file_id != file_id.into()).unwrap_or(true) {
161 return 0;
162 }
155 let text = db.file_text(file_id); 163 let text = db.file_text(file_id);
156 164
157 let pos = pos.to_usize(); 165 let pos = pos.to_usize();