diff options
author | Jonas Schievink <[email protected]> | 2021-03-18 15:11:18 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-18 15:11:18 +0000 |
commit | c05a1a6e37156b956380d57049a72cfe6f21095d (patch) | |
tree | cecbf9cb7ee8b6706d2d70aeb04bbf67a6c43ac0 /crates/hir_expand/src | |
parent | 3ab9b39dd47d99ffd97f485c27f38b8944e12a3e (diff) |
Store an `AstId` for procedural macros
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r-- | crates/hir_expand/src/db.rs | 4 | ||||
-rw-r--r-- | crates/hir_expand/src/eager.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/hygiene.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/lib.rs | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 4107d7781..2748e25cf 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs | |||
@@ -157,7 +157,7 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option<Arc<(TokenExpander, | |||
157 | Some(Arc::new((TokenExpander::BuiltinDerive(expander), mbe::TokenMap::default()))) | 157 | Some(Arc::new((TokenExpander::BuiltinDerive(expander), mbe::TokenMap::default()))) |
158 | } | 158 | } |
159 | MacroDefKind::BuiltInEager(..) => None, | 159 | MacroDefKind::BuiltInEager(..) => None, |
160 | MacroDefKind::ProcMacro(expander) => { | 160 | MacroDefKind::ProcMacro(expander, ..) => { |
161 | Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default()))) | 161 | Some(Arc::new((TokenExpander::ProcMacro(expander), mbe::TokenMap::default()))) |
162 | } | 162 | } |
163 | } | 163 | } |
@@ -269,7 +269,7 @@ fn expand_proc_macro( | |||
269 | }; | 269 | }; |
270 | 270 | ||
271 | let expander = match loc.def.kind { | 271 | let expander = match loc.def.kind { |
272 | MacroDefKind::ProcMacro(expander) => expander, | 272 | MacroDefKind::ProcMacro(expander, ..) => expander, |
273 | _ => unreachable!(), | 273 | _ => unreachable!(), |
274 | }; | 274 | }; |
275 | 275 | ||
diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index ddadaffd3..04f374a29 100644 --- a/crates/hir_expand/src/eager.rs +++ b/crates/hir_expand/src/eager.rs | |||
@@ -209,7 +209,7 @@ fn eager_macro_recur( | |||
209 | MacroDefKind::Declarative(_) | 209 | MacroDefKind::Declarative(_) |
210 | | MacroDefKind::BuiltIn(..) | 210 | | MacroDefKind::BuiltIn(..) |
211 | | MacroDefKind::BuiltInDerive(..) | 211 | | MacroDefKind::BuiltInDerive(..) |
212 | | MacroDefKind::ProcMacro(_) => { | 212 | | MacroDefKind::ProcMacro(..) => { |
213 | let res = lazy_expand(db, &def, curr.with_value(child.clone()), krate); | 213 | let res = lazy_expand(db, &def, curr.with_value(child.clone()), krate); |
214 | let val = diagnostic_sink.expand_result_option(res)?; | 214 | let val = diagnostic_sink.expand_result_option(res)?; |
215 | 215 | ||
diff --git a/crates/hir_expand/src/hygiene.rs b/crates/hir_expand/src/hygiene.rs index e758b3c0a..20cda1683 100644 --- a/crates/hir_expand/src/hygiene.rs +++ b/crates/hir_expand/src/hygiene.rs | |||
@@ -182,7 +182,7 @@ impl HygieneFrame { | |||
182 | MacroDefKind::BuiltIn(..) => (info, Some(loc.def.krate), false), | 182 | MacroDefKind::BuiltIn(..) => (info, Some(loc.def.krate), false), |
183 | MacroDefKind::BuiltInDerive(..) => (info, None, false), | 183 | MacroDefKind::BuiltInDerive(..) => (info, None, false), |
184 | MacroDefKind::BuiltInEager(..) => (info, None, false), | 184 | MacroDefKind::BuiltInEager(..) => (info, None, false), |
185 | MacroDefKind::ProcMacro(_) => (info, None, false), | 185 | MacroDefKind::ProcMacro(..) => (info, None, false), |
186 | } | 186 | } |
187 | } | 187 | } |
188 | }, | 188 | }, |
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 83e11019f..0a379651f 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -245,7 +245,7 @@ impl MacroDefId { | |||
245 | MacroDefKind::BuiltIn(_, id) => id, | 245 | MacroDefKind::BuiltIn(_, id) => id, |
246 | MacroDefKind::BuiltInDerive(_, id) => id, | 246 | MacroDefKind::BuiltInDerive(_, id) => id, |
247 | MacroDefKind::BuiltInEager(_, id) => id, | 247 | MacroDefKind::BuiltInEager(_, id) => id, |
248 | MacroDefKind::ProcMacro(_) => return None, | 248 | MacroDefKind::ProcMacro(..) => return None, |
249 | }; | 249 | }; |
250 | Some(*id) | 250 | Some(*id) |
251 | } | 251 | } |
@@ -258,7 +258,7 @@ pub enum MacroDefKind { | |||
258 | // FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander | 258 | // FIXME: maybe just Builtin and rename BuiltinFnLikeExpander to BuiltinExpander |
259 | BuiltInDerive(BuiltinDeriveExpander, AstId<ast::Macro>), | 259 | BuiltInDerive(BuiltinDeriveExpander, AstId<ast::Macro>), |
260 | BuiltInEager(EagerExpander, AstId<ast::Macro>), | 260 | BuiltInEager(EagerExpander, AstId<ast::Macro>), |
261 | ProcMacro(ProcMacroExpander), | 261 | ProcMacro(ProcMacroExpander, AstId<ast::Fn>), |
262 | } | 262 | } |
263 | 263 | ||
264 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 264 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |