diff options
Diffstat (limited to 'crates/ra_hir_expand/src/lib.rs')
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 18 |
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 | ||
7 | pub mod db; | 7 | pub mod db; |
8 | pub mod ast_id_map; | 8 | pub mod ast_id_map; |
@@ -116,22 +116,12 @@ pub struct MacroCallLoc { | |||
116 | } | 116 | } |
117 | 117 | ||
118 | impl MacroCallId { | 118 | impl 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 | ||
129 | impl 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. |