Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@717 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2014-04-26 07:06:00 +00:00
parent 58c27a4f0c
commit eecd48b72f
2 changed files with 13 additions and 8 deletions

View file

@ -127,6 +127,17 @@ namespace detail
return error_type::abort(); return error_type::abort();
} }
void add( context& c, const void* p,
boost::unit_test::const_string instance,
boost::optional< type_name > type,
boost::unit_test::const_string name )
{
if( ! context_ )
c.add( *this );
c.add( p, *this, instance, type, name );
context_ = &c;
}
friend std::ostream& operator<<( friend std::ostream& operator<<(
std::ostream& s, const function_impl& impl ) std::ostream& s, const function_impl& impl )
{ {

View file

@ -89,10 +89,7 @@ namespace detail
function& operator()( context& c, function& operator()( context& c,
boost::unit_test::const_string instance ) boost::unit_test::const_string instance )
{ {
if( ! impl_->context_ ) impl_->add( c, impl_.get(), instance, boost::none, "" );
c.add( *impl_ );
c.add( impl_.get(), *impl_, instance, boost::none, "" );
impl_->context_ = &c;
return *this; return *this;
} }
@ -101,10 +98,7 @@ namespace detail
boost::optional< type_name > type, boost::optional< type_name > type,
boost::unit_test::const_string name ) const boost::unit_test::const_string name ) const
{ {
if( ! impl_->context_ ) impl_->add( c, p, instance, type, name );
c.add( *impl_ );
c.add( p, *impl_, instance, type, name );
impl_->context_ = &c;
} }
private: private: