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,7 +117,9 @@ impl<'src> Analyzer<'src> {
|
||||
|
||||
AssignmentResolver::resolve_assignments(&analyzer.assignments)?;
|
||||
|
||||
for recipe in recipes {
|
||||
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())
|
||||
@ -129,7 +129,8 @@ impl<'src> Analyzer<'src> {
|
||||
}
|
||||
}
|
||||
|
||||
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