mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Update grammar * Update parser and AST generator * Update semantic analysis * Executor implementation - Move Executor stack modification logic to BFunctionRef - Handle user function calls - Handle expression function calls * Tests * Update existing listfile snapshots - Adds variadic boolean to instruction stack - Changes instruction counts and offsets * Fix test issue * Better implementation of calling user functions * Add var-args-captures test * Refactor continuation handling + handle variadic args - Move stack modifications from make/withContinuation into the executor's handling of the continuation - Only trim args in continuation call if function is not variadic * Add var-args-continuation test (via array.filter) * update escriptguide + formatting, docs * Fix CI annotations - '=': conversion from 'size_t' to 'unsigned int', possible loss of data - declaration of 'continuation' hides previous local declaration
44 lines
937 B
C++
44 lines
937 B
C++
#pragma once
|
|
|
|
#include "bobject.h"
|
|
#include "exectype.h"
|
|
|
|
namespace Pol
|
|
{
|
|
namespace Bscript
|
|
{
|
|
class Executor;
|
|
class BContinuation;
|
|
class BFunctionRef;
|
|
|
|
struct ContinuationCallbackWrapper
|
|
{
|
|
BObjectImp* ( *call )( Executor&, BContinuation*, void* /*wrapper data*/, BObjectRef /*result*/ );
|
|
void ( *free )( void* );
|
|
size_t ( *size )();
|
|
};
|
|
|
|
class BContinuation : public BObjectImp
|
|
{
|
|
public:
|
|
BContinuation( BObjectRef funcref, BObjectRefVec args, ContinuationCallbackWrapper wrapper,
|
|
void* wrapperData );
|
|
~BContinuation();
|
|
|
|
BObjectImp* continueWith( Executor& exec, BObjectRef result );
|
|
BFunctionRef* func();
|
|
|
|
BObjectImp* copy( void ) const override;
|
|
size_t sizeEstimate() const override;
|
|
std::string getStringRep() const override;
|
|
|
|
private:
|
|
BObjectRef funcref_;
|
|
ContinuationCallbackWrapper wrapper_;
|
|
void* wrapperData_;
|
|
|
|
public:
|
|
BObjectRefVec args;
|
|
};
|
|
} // namespace Bscript
|
|
} // namespace Pol
|