resolve/expand: Rename some things for clarity and add comments

This commit is contained in:
Vadim Petrochenkov 2019-08-20 00:24:28 +03:00
parent a83c35692f
commit 93d369bc2b
3 changed files with 29 additions and 18 deletions

View file

@ -682,8 +682,9 @@ pub trait Resolver {
fn resolve_imports(&mut self);
fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: ExpnId, force: bool)
-> Result<Option<Lrc<SyntaxExtension>>, Indeterminate>;
fn resolve_macro_invocation(
&mut self, invoc: &Invocation, eager_expansion_root: ExpnId, force: bool
) -> Result<Option<Lrc<SyntaxExtension>>, Indeterminate>;
fn check_unused_macros(&self);

View file

@ -305,9 +305,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
continue
};
let scope =
let eager_expansion_root =
if self.monotonic { invoc.expansion_data.id } else { orig_expansion_data.id };
let ext = match self.cx.resolver.resolve_macro_invocation(&invoc, scope, force) {
let ext = match self.cx.resolver.resolve_macro_invocation(
&invoc, eager_expansion_root, force
) {
Ok(ext) => ext,
Err(Indeterminate) => {
undetermined_invocations.push(invoc);