Reduce repeated macro tracing and input position work
This commit is contained in:
1 parent
70822cbd94
commit
b681f9791a
5 files changed
+64
-29
No files matched your search
@@ -204,6 +204,7 @@ pub struct Executor {
|
||||
generated_inputs: std::collections::BTreeMap<usize, GeneratedInput>,
|
||||
reads: BTreeSet<Dependency>,
|
||||
meaning_reads: HashSet<CommandName>,
|
||||
reads_tracing_macros: bool,
|
||||
conditionals: Vec<Conditional>,
|
||||
in_csname: bool,
|
||||
command_trace_mode: Option<&'static str>,
|
||||
@@ -373,6 +374,7 @@ impl Executor {
|
||||
generated_inputs: Default::default(),
|
||||
reads: BTreeSet::new(),
|
||||
meaning_reads: HashSet::new(),
|
||||
reads_tracing_macros: false,
|
||||
conditionals: Vec::new(),
|
||||
in_csname: false,
|
||||
command_trace_mode: None,
|
||||
@@ -1791,7 +1793,17 @@ impl Executor {
|
||||
call: &Token,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
self.trace_macro_call(&definition, call, files)?;
|
||||
// A macro only scans raw tokens while matching its arguments, so
|
||||
// assignments cannot change the trace level during this call.
|
||||
if !self.reads_tracing_macros {
|
||||
self.reads
|
||||
.insert(Dependency::Parameter(Parameter::Tracingmacros));
|
||||
self.reads_tracing_macros = true;
|
||||
}
|
||||
let trace = self.state.parameter(Parameter::Tracingmacros).width() > 0;
|
||||
if trace {
|
||||
self.trace_macro_call(&definition, call, files)?;
|
||||
}
|
||||
for expected in &definition.prefix {
|
||||
if self.required_raw(files)?.token.kind != *expected {
|
||||
return self.fail("macro prefix does not match");
|
||||
@@ -1860,7 +1872,9 @@ impl Executor {
|
||||
}
|
||||
argument = Self::strip_outer_group(argument);
|
||||
}
|
||||
self.trace_macro_argument(&definition, index, &argument, files)?;
|
||||
if trace {
|
||||
self.trace_macro_argument(&definition, index, &argument, files)?;
|
||||
}
|
||||
arguments.push(argument);
|
||||
}
|
||||
self.discard_exhausted_tokens();
|
||||
|
||||
Reference in new issue
Block a user