From f519c44792429ce52cfab09898701bff9c202770 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 31 Jan 2017 09:53:25 +0200 Subject: Add load generation to global variable_map values --- build2/parser.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'build2/parser.cxx') diff --git a/build2/parser.cxx b/build2/parser.cxx index af6a6f5..7f6b940 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -1658,13 +1658,17 @@ namespace build2 // be the same. Also check that the requested value type doesn't conflict // with the variable type. // - if (type != nullptr && - var != nullptr && - var->type != nullptr && - var->type != type) + if (var != nullptr && var->type != nullptr) { - fail (l) << "conflicting variable " << var->name << " type " - << var->type->name << " and value type " << type->name; + if (type == nullptr) + { + type = var->type; + } + else if (var->type != type) + { + fail (l) << "conflicting variable " << var->name << " type " + << var->type->name << " and value type " << type->name; + } } // What if both LHS and RHS are typed? For now we do lexical conversion: @@ -1682,7 +1686,7 @@ namespace build2 { // Only consider RHS type if there is no explicit or variable type. // - if (type == nullptr && (var == nullptr || var->type == nullptr)) + if (type == nullptr) { type = rhs.type; rhs_type = true; -- cgit v1.1