diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-31 09:53:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:41 +0200 |
commit | f519c44792429ce52cfab09898701bff9c202770 (patch) | |
tree | 436ad143530ba0b7bd6b69b39fe1bb9f1e389751 /build2/parser.cxx | |
parent | 450c5c09ed7898a800bf5c9328799a43aba78e48 (diff) |
Add load generation to global variable_map values
Diffstat (limited to 'build2/parser.cxx')
-rw-r--r-- | build2/parser.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
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; |