aboutsummaryrefslogtreecommitdiff
path: root/src/makefile/eval_context.rs
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2024-11-11 00:07:33 -0700
committerMelody Horn <melody@boringcactus.com>2024-11-11 00:07:33 -0700
commitec2c18171cd316a8b1f69baf92f67980820dfc9a (patch)
tree007add1cd59aec07098134b018efededee463d97 /src/makefile/eval_context.rs
parent825ff799a2154ffb94ef21bbc14e2afe2afa2006 (diff)
downloadmakers-ec2c18171cd316a8b1f69baf92f67980820dfc9a.tar.gz
makers-ec2c18171cd316a8b1f69baf92f67980820dfc9a.zip
overhaul macro inheritance
i was really proud of the lifetimes i had going on in the previous code. i should not have been.
Diffstat (limited to 'src/makefile/eval_context.rs')
-rw-r--r--src/makefile/eval_context.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/makefile/eval_context.rs b/src/makefile/eval_context.rs
index 06f4fbf..ba5f4a0 100644
--- a/src/makefile/eval_context.rs
+++ b/src/makefile/eval_context.rs
@@ -2,8 +2,7 @@ use eyre::{Result, WrapErr};
use std::io::{BufRead, Cursor};
use std::rc::Rc;
-use crate::makefile::input::FinishedMakefileReader;
-use crate::makefile::MakefileReader;
+use super::{FinishedMakefileReader, MacroSet, MakefileReader};
pub struct DeferredEvalContext<'parent, 'args, 'grandparent, R: BufRead> {
parent: &'parent MakefileReader<'args, 'grandparent, R>,
@@ -25,9 +24,11 @@ impl<'parent, 'args, 'grandparent, R: BufRead>
}
pub fn eval(&mut self, to_eval: String) -> Result<()> {
- let child_macros = self.parent.macros.with_overlay();
+ let child_stack = self.parent.stack.with_scope(&self.parent.macros);
+ let child_macros = MacroSet::new();
let child = MakefileReader::read(
self.parent.args,
+ child_stack,
child_macros,
Cursor::new(to_eval),
"<eval>",