consolidate recipe table
This commit is contained in:
parent
61f7ab33c6
commit
32d7d2f03d
@ -17,7 +17,7 @@ impl<'src> Analyzer<'src> {
|
||||
) -> CompileResult<'src, Justfile<'src>> {
|
||||
let mut analyzer = Self::default();
|
||||
|
||||
let mut recipes = Vec::new();
|
||||
let mut unprocessed_recipes = Vec::new();
|
||||
|
||||
let mut unprocessed_assignments = Vec::new();
|
||||
|
||||
@ -82,7 +82,7 @@ impl<'src> Analyzer<'src> {
|
||||
Item::Recipe(recipe) => {
|
||||
if recipe.enabled() {
|
||||
Self::analyze_recipe(recipe)?;
|
||||
recipes.push(recipe);
|
||||
unprocessed_recipes.push(recipe);
|
||||
}
|
||||
}
|
||||
Item::Set(set) => {
|
||||
@ -97,8 +97,6 @@ impl<'src> Analyzer<'src> {
|
||||
|
||||
let settings = Settings::from_setting_iter(analyzer.sets.into_iter().map(|(_, set)| set.value));
|
||||
|
||||
let mut recipe_table: Table<'src, UnresolvedRecipe<'src>> = Table::default();
|
||||
|
||||
for assignment in unprocessed_assignments {
|
||||
if !settings.allow_duplicate_variables
|
||||
&& analyzer.assignments.contains_key(assignment.name.lexeme())
|
||||
@ -119,17 +117,20 @@ impl<'src> Analyzer<'src> {
|
||||
|
||||
AssignmentResolver::resolve_assignments(&analyzer.assignments)?;
|
||||
|
||||
for recipe in recipes {
|
||||
define(recipe.name, "recipe", settings.allow_duplicate_recipes)?;
|
||||
if recipe_table
|
||||
.get(recipe.name.lexeme())
|
||||
.map_or(true, |original| recipe.file_depth <= original.file_depth)
|
||||
{
|
||||
recipe_table.insert(recipe.clone());
|
||||
let recipes = {
|
||||
let mut recipe_table: Table<'src, UnresolvedRecipe<'src>> = Table::default();
|
||||
for recipe in unprocessed_recipes {
|
||||
define(recipe.name, "recipe", settings.allow_duplicate_recipes)?;
|
||||
if recipe_table
|
||||
.get(recipe.name.lexeme())
|
||||
.map_or(true, |original| recipe.file_depth <= original.file_depth)
|
||||
{
|
||||
recipe_table.insert(recipe.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let recipes = RecipeResolver::resolve_recipes(recipe_table, &analyzer.assignments)?;
|
||||
RecipeResolver::resolve_recipes(recipe_table, &analyzer.assignments)?
|
||||
};
|
||||
|
||||
let mut aliases = Table::new();
|
||||
while let Some(alias) = analyzer.aliases.pop() {
|
||||
|
Loading…
Reference in New Issue
Block a user