Moved value_t::set_type into value.cc, since it had grown.

This commit is contained in:
John Wiegley 2009-02-12 02:36:14 -04:00
parent 9344598eb0
commit 433bb11fa9
2 changed files with 21 additions and 18 deletions

View file

@ -104,6 +104,26 @@ value_t::operator bool() const
return false;
}
void value_t::set_type(type_t new_type)
{
assert(new_type >= VOID && new_type <= POINTER);
if (new_type == VOID) {
#if BOOST_VERSION >= 103700
storage.reset();
#else
storage = intrusive_ptr<storage_t>();
#endif
assert(is_null());
} else {
if (! storage || storage->refc > 1)
storage = new storage_t;
else
storage->data = false; // destruct all other types
storage->type = new_type;
assert(is_type(new_type));
}
}
bool value_t::to_boolean() const
{
if (is_boolean()) {

View file

@ -459,24 +459,7 @@ public:
}
private:
void set_type(type_t new_type) {
assert(new_type >= VOID && new_type <= POINTER);
if (new_type == VOID) {
#if BOOST_VERSION >= 103700
storage.reset();
#else
storage = intrusive_ptr<storage_t>();
#endif
assert(is_null());
} else {
if (! storage || storage->refc > 1)
storage = new storage_t;
else
storage->data = false; // destruct all other types
storage->type = new_type;
assert(is_type(new_type));
}
}
void set_type(type_t new_type);
public:
/**