aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-15 17:43:19 +0000
committerJonas Schievink <[email protected]>2020-12-15 17:43:34 +0000
commitc31c3246a8c87a3639623c30b692a57e728bb046 (patch)
treee66cdc459e249767c69c1b29b13e85fe30bdc935 /crates/hir
parentbd4c352831662762ee7a66da77ec9adf623b0a0a (diff)
Basic support for decl macros 2.0
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/has_source.rs4
-rw-r--r--crates/hir/src/semantics/source_to_def.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 107ad0690..ecf3194c6 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -110,8 +110,8 @@ impl HasSource for TypeAlias {
110 } 110 }
111} 111}
112impl HasSource for MacroDef { 112impl HasSource for MacroDef {
113 type Ast = ast::MacroRules; 113 type Ast = ast::Macro;
114 fn source(self, db: &dyn HirDatabase) -> InFile<ast::MacroRules> { 114 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Macro> {
115 InFile { 115 InFile {
116 file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id, 116 file_id: self.id.ast_id.expect("MacroDef without ast_id").file_id,
117 value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()), 117 value: self.id.ast_id.expect("MacroDef without ast_id").to_node(db.upcast()),
diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs
index a333d7aea..d499ae340 100644
--- a/crates/hir/src/semantics/source_to_def.rs
+++ b/crates/hir/src/semantics/source_to_def.rs
@@ -157,7 +157,7 @@ impl SourceToDefCtx<'_, '_> {
157 let file_id = src.file_id.original_file(self.db.upcast()); 157 let file_id = src.file_id.original_file(self.db.upcast());
158 let krate = self.file_to_def(file_id)?.krate; 158 let krate = self.file_to_def(file_id)?.krate;
159 let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value); 159 let file_ast_id = self.db.ast_id_map(src.file_id).ast_id(&src.value);
160 let ast_id = Some(AstId::new(src.file_id, file_ast_id)); 160 let ast_id = Some(AstId::new(src.file_id, file_ast_id.upcast()));
161 Some(MacroDefId { krate: Some(krate), ast_id, kind, local_inner: false }) 161 Some(MacroDefId { krate: Some(krate), ast_id, kind, local_inner: false })
162 } 162 }
163 163