2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/bcontinuation.h"
|
|
|
|
|
#include "bscript/bfuncref.h"
|
|
|
|
|
#include "bscript/executor.h"
|
2024-07-28 22:51:04 +02:00
|
|
|
|
2026-01-17 10:30:21 +01:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript
|
2024-07-28 22:51:04 +02:00
|
|
|
{
|
2024-08-04 17:13:30 +02:00
|
|
|
BContinuation::BContinuation( BObjectRef funcref, BObjectRefVec args,
|
|
|
|
|
ContinuationCallbackWrapper wrapper, void* wrapperData )
|
2024-07-28 22:51:04 +02:00
|
|
|
: BObjectImp( BObjectImp::OTContinuation ),
|
|
|
|
|
funcref_( std::move( funcref ) ),
|
|
|
|
|
wrapper_( wrapper ),
|
2024-08-04 17:13:30 +02:00
|
|
|
wrapperData_( wrapperData ),
|
|
|
|
|
args( std::move( args ) )
|
2024-07-28 22:51:04 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BContinuation::~BContinuation()
|
|
|
|
|
{
|
|
|
|
|
wrapper_.free( wrapperData_ );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BObjectImp* BContinuation::continueWith( Executor& exec, BObjectRef result )
|
|
|
|
|
{
|
|
|
|
|
return wrapper_.call( exec, this, wrapperData_, std::move( result ) );
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-04 17:13:30 +02:00
|
|
|
BFunctionRef* BContinuation::func()
|
|
|
|
|
{
|
|
|
|
|
return funcref_->impptr<BFunctionRef>();
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 13:22:43 +01:00
|
|
|
BObjectImp* BContinuation::copy() const
|
2024-07-28 22:51:04 +02:00
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t BContinuation::sizeEstimate() const
|
|
|
|
|
{
|
|
|
|
|
return sizeof( BContinuation ) + wrapper_.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string BContinuation::getStringRep() const
|
|
|
|
|
{
|
|
|
|
|
return "<continuation>";
|
|
|
|
|
}
|
2026-01-17 10:30:21 +01:00
|
|
|
} // namespace Pol::Bscript
|