diff options
-rw-r--r-- | libbuild2/build/script/parser.cxx | 2 | ||||
-rw-r--r-- | libbuild2/parser.hxx | 15 | ||||
-rw-r--r-- | libbuild2/script/parser.cxx | 4 |
3 files changed, 18 insertions, 3 deletions
diff --git a/libbuild2/build/script/parser.cxx b/libbuild2/build/script/parser.cxx index 0199137..c362776 100644 --- a/libbuild2/build/script/parser.cxx +++ b/libbuild2/build/script/parser.cxx @@ -1529,7 +1529,7 @@ namespace build2 { // Copy the tokens and start playing. // - replay_data (replay_tokens (dl.tokens)); + replay_data (dl.tokens); token t; build2::script::token_type tt; diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index 3e1d0a0..b68bf7e 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -893,6 +893,9 @@ namespace build2 // Set the data and start playing. // + // Note that using the const reference version is better than making a + // copy since it may reuse the existing capacity. + // void replay_data (replay_tokens&& d) { @@ -905,6 +908,18 @@ namespace build2 replay_ = replay::play; } + void + replay_data (const replay_tokens& d) + { + assert (replay_ == replay::stop); + + replay_path_ = path_; // Save old path. + + replay_data_ = d; + replay_i_ = 0; + replay_ = replay::play; + } + // Implementation details, don't call directly. // replay_token diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index 96b454f..30c7ff6 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -2218,7 +2218,7 @@ namespace build2 // Copy the tokens and start playing. // - replay_data (replay_tokens (ln.tokens)); + replay_data (ln.tokens); // We don't really need to change the mode since we already know // the line type. @@ -2433,7 +2433,7 @@ namespace build2 // Prepare for the condition reevaluation. // - replay_data (replay_tokens (ln.tokens)); + replay_data (ln.tokens); next (t, tt); li = wli; } |