From 7253ffee27f6cae34e63a72b2d3d10db10571ecc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 31 Mar 2016 10:59:45 +0200 Subject: Clean up variable lookup interfaces --- build2/file.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'build2/file.cxx') diff --git a/build2/file.cxx b/build2/file.cxx index 1f4e517..10461c4 100644 --- a/build2/file.cxx +++ b/build2/file.cxx @@ -263,9 +263,9 @@ namespace build2 source_once (bf, root, root); } - // Extract the specified variable value from a buildfile. It is - // expected to be the first non-comment line and not to rely on - // any variable expansion other than those from the global scope. + // Extract the specified variable value from a buildfile. It is expected to + // be the first non-comment line and not to rely on any variable expansion + // other than those from the global scope or any variable overrides. // static value extract_variable (const path& bf, const char* name) @@ -297,10 +297,9 @@ namespace build2 temp_scope tmp (*global_scope); p.parse_variable (lex, tmp, var, tt); - auto l (tmp.vars[var]); - assert (l.defined ()); - value& v (*l); - return move (v); // Steal the value, the scope is going away. + value* v (tmp.vars.find (var)); + assert (v != nullptr); + return move (*v); // Steal the value, the scope is going away. } catch (const ifstream::failure&) { -- cgit v1.1