diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-30 12:00:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-08-30 12:00:49 +0200 |
commit | dee70af1d3b6ca4caf1027b79eb471b28624fff8 (patch) | |
tree | 97c72ca8b9234abac491e16c8f73165f305f454e /build2 | |
parent | ec01212ebb80a21e34237176b5fde6063b36a415 (diff) |
Add support for using '*' as target type in variable assignment
So these three are equivalent:
*: foo = 1
{*}: foo = 2
*{*}: foo = 3
Diffstat (limited to 'build2')
-rw-r--r-- | build2/parser.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx index 526a905..689db66 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -522,11 +522,16 @@ namespace build2 if (!n.dir.empty ()) sg = enter_scope (*this, move (n.dir)); - // Resolve target type. If none is specified, use the root - // of the hierarchy. + // Resolve target type. If none is specified or if it is + // '*', use the root of the hierarchy. So these are all + // equivalent: + // + // *: foo = bar + // {*}: foo = bar + // *{*}: foo = bar // const target_type* ti ( - n.untyped () + n.untyped () || n.type == "*" ? &target::static_type : scope_->find_target_type (n.type)); |