Precompute macro fragment kind

This commit is contained in:
Jonas Schievink 2021-05-09 01:36:06 +02:00
parent cf4d4f646b
commit 9cf8d325a2
9 changed files with 113 additions and 74 deletions

View file

@ -175,8 +175,13 @@ fn lazy_expand(
) -> ExpandResult<Option<InFile<SyntaxNode>>> {
let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value);
let fragment = crate::to_fragment_kind(&macro_call.value);
let id: MacroCallId = def
.as_lazy_macro(db, krate, MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id) })
.as_lazy_macro(
db,
krate,
MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
)
.into();
let err = db.macro_expand_error(id);