aboutsummaryrefslogtreecommitdiff
path: root/build/variable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/variable.cxx')
-rw-r--r--build/variable.cxx29
1 files changed, 27 insertions, 2 deletions
diff --git a/build/variable.cxx b/build/variable.cxx
index 6a40bc7..d00fcf6 100644
--- a/build/variable.cxx
+++ b/build/variable.cxx
@@ -15,6 +15,17 @@ namespace build
// value_proxy
//
template <>
+ string& value_proxy::
+ as<string&> () const
+ {
+ list_value& lv (as<list_value&> ());
+ assert (lv.size () == 1);
+ name& n (lv.front ());
+ assert (n.simple ());
+ return n.value;
+ }
+
+ template <>
const string& value_proxy::
as<const string&> () const
{
@@ -26,11 +37,22 @@ namespace build
const name& n (lv.front ());
- assert (n.type.empty () && n.dir.empty ());
+ assert (n.simple ());
return n.value;
}
template <>
+ dir_path& value_proxy::
+ as<dir_path&> () const
+ {
+ list_value& lv (as<list_value&> ());
+ assert (lv.size () == 1);
+ name& n (lv.front ());
+ assert (n.directory ());
+ return n.dir;
+ }
+
+ template <>
const dir_path& value_proxy::
as<const dir_path&> () const
{
@@ -42,7 +64,10 @@ namespace build
const name& n (lv.front ());
- assert (n.type.empty () && n.value.empty ());
+ if (n.empty ())
+ return empty_dir_path;
+
+ assert (n.directory ());
return n.dir;
}
}