aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-29 13:01:14 +0000
committerAleksey Kladov <[email protected]>2019-10-29 13:01:14 +0000
commit7de6eaa58ae994a5c5d39a66253e347fb039fa94 (patch)
tree20b346ced3beb9572574d2e7590b0ce26ead2461 /crates/ra_hir_expand/src
parentb8b7969bfb261fa86b4c38024f873444145fe7a2 (diff)
remove not that useful indirection
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r--crates/ra_hir_expand/src/lib.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index a31b9fa4c..9100bd15c 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -1,8 +1,8 @@
1//! `ra_hir_def` contains initial "phases" of the compiler. Roughly, everything 1//! `ra_hir_expand` deals with macro expansion.
2//! before types.
3//! 2//!
4//! Note that we are in the process of moving parts of `ra_hir` into 3//! Specifically, it implements a concept of `MacroFile` -- a file whose syntax
5//! `ra_hir_def`, so this crates doesn't contain a lot at the moment. 4//! tree originates not from the text of some `FileId`, but from some macro
5//! expansion.
6 6
7pub mod db; 7pub mod db;
8pub mod ast_id_map; 8pub mod ast_id_map;
@@ -116,22 +116,12 @@ pub struct MacroCallLoc {
116} 116}
117 117
118impl MacroCallId { 118impl MacroCallId {
119 pub fn loc(self, db: &impl AstDatabase) -> MacroCallLoc {
120 db.lookup_intern_macro(self)
121 }
122
123 pub fn as_file(self, kind: MacroFileKind) -> HirFileId { 119 pub fn as_file(self, kind: MacroFileKind) -> HirFileId {
124 let macro_file = MacroFile { macro_call_id: self, macro_file_kind: kind }; 120 let macro_file = MacroFile { macro_call_id: self, macro_file_kind: kind };
125 macro_file.into() 121 macro_file.into()
126 } 122 }
127} 123}
128 124
129impl MacroCallLoc {
130 pub fn id(self, db: &impl AstDatabase) -> MacroCallId {
131 db.intern_macro(self)
132 }
133}
134
135/// `AstId` points to an AST node in any file. 125/// `AstId` points to an AST node in any file.
136/// 126///
137/// It is stable across reparses, and can be used as salsa key/value. 127/// It is stable across reparses, and can be used as salsa key/value.