Store modules on analyzer struct
This commit is contained in:
parent
ed11e76600
commit
ed2c5c45e5
@ -6,6 +6,7 @@ pub(crate) struct Analyzer<'src> {
|
||||
aliases: Table<'src, Alias<'src, Name<'src>>>,
|
||||
sets: Table<'src, Set<'src>>,
|
||||
warnings: Vec<Warning>,
|
||||
modules: Table<'src, Justfile<'src>>,
|
||||
}
|
||||
|
||||
impl<'src> Analyzer<'src> {
|
||||
@ -24,8 +25,6 @@ impl<'src> Analyzer<'src> {
|
||||
let mut stack = Vec::new();
|
||||
stack.push(asts.get(root).unwrap());
|
||||
|
||||
let mut modules: Table<Justfile> = Table::new();
|
||||
|
||||
let mut definitions: HashMap<&str, (&'static str, Name)> = HashMap::new();
|
||||
|
||||
let mut define = |name: Name<'src>,
|
||||
@ -74,7 +73,9 @@ impl<'src> Analyzer<'src> {
|
||||
Item::Module { absolute, name, .. } => {
|
||||
if let Some(absolute) = absolute {
|
||||
define(*name, "module", false)?;
|
||||
modules.insert(Self::analyze(loaded, paths, asts, absolute, Some(*name))?);
|
||||
analyzer
|
||||
.modules
|
||||
.insert(Self::analyze(loaded, paths, asts, absolute, Some(*name))?);
|
||||
}
|
||||
}
|
||||
Item::Recipe(recipe) => {
|
||||
@ -152,7 +153,7 @@ impl<'src> Analyzer<'src> {
|
||||
}),
|
||||
}),
|
||||
loaded: loaded.into(),
|
||||
modules,
|
||||
modules: analyzer.modules,
|
||||
name,
|
||||
recipes,
|
||||
settings,
|
||||
|
Loading…
Reference in New Issue
Block a user