From 9a0f07035b34a356ce9b5601d71d388595762184 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 May 2020 15:43:13 +0200 Subject: Generalize to adhoc_rule/adhoc_script_rule --- libbuild2/recipe.hxx | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'libbuild2/recipe.hxx') diff --git a/libbuild2/recipe.hxx b/libbuild2/recipe.hxx index 4c903b5..efd184a 100644 --- a/libbuild2/recipe.hxx +++ b/libbuild2/recipe.hxx @@ -51,29 +51,17 @@ namespace build2 // Ad hoc recipe. // + // A recipe is a fragment of a rule so we handle ad hoc recipies by + // "completing" them to rules. + // + class adhoc_rule; + struct adhoc_recipe { - using action_type = build2::action; - using location_type = build2::location; - - action_type action; - string script; - optional diag; // Command name for low-verbosity diagnostics. - - // Diagnostics-related information. + // @@ TODO: maybe we should have a small vector of actions (for dump). // - path_name_value file; // Buildfile of recipe. - location_type location; // Buildfile location of recipe. - size_t braces; // Number of braces in multi-brace tokens. - - adhoc_recipe (action_type a, - string s, - optional d, - const location_type& l, size_t b) - : action (a), - script (move (s)), - diag (move (d)), - file (l.file), location (file, l.line, l.column), braces (b) {} + build2::action action; + shared_ptr rule; }; } -- cgit v1.1