aboutsummaryrefslogtreecommitdiff
path: root/build2/context.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/context.cxx')
-rw-r--r--build2/context.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index 142a99d..31e01d7 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -460,11 +460,14 @@ namespace build2
set ("build.version.minor", uint64_t (v.minor ()));
set ("build.version.patch", uint64_t (v.patch ()));
- set ("build.version.alpha", v.alpha ()); // bool
- set ("build.version.beta", v.beta ()); // bool
- set ("build.version.pre_release", v.alpha () || v.beta ());
+ optional<uint16_t> a (v.alpha ());
+ optional<uint16_t> b (v.beta ());
+
+ set ("build.version.alpha", a.has_value ());
+ set ("build.version.beta", b.has_value ());
+ set ("build.version.pre_release", v.pre_release ().has_value ());
set ("build.version.pre_release_string", v.string_pre_release ());
- set ("build.version.pre_release_number", uint64_t (v.pre_release ()));
+ set ("build.version.pre_release_number", uint64_t (a ? *a : b ? *b : 0));
set ("build.version.snapshot", v.snapshot ()); // bool
set ("build.version.snapshot_sn", v.snapshot_sn); // uint64