mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* all except pol * pol and includes under defines * something weird has happened * remove own folder from include searchpath * fixed remaining, adapted include style for external headers * missing include
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#include "bscript/compiler/representation/DebugStore.h"
|
|
|
|
#include "bscript/compiler/model/LocalVariableScopeInfo.h"
|
|
#include "bscript/compiler/model/Variable.h"
|
|
#include "bscript/compiler/representation/DebugBlock.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
DebugStore::DebugStore( std::vector<std::string> filenames ) : filenames( std::move( filenames ) )
|
|
{
|
|
std::vector<std::string> empty;
|
|
blocks.emplace_back( 0, 0, empty );
|
|
}
|
|
|
|
DebugStore::DebugStore( DebugStore&& ) noexcept = default;
|
|
DebugStore::~DebugStore() = default;
|
|
|
|
unsigned DebugStore::add_block( unsigned parent_block_index,
|
|
const LocalVariableScopeInfo& local_variable_scope_info )
|
|
{
|
|
unsigned base_index = local_variable_scope_info.base_index;
|
|
std::vector<std::string> local_variable_names;
|
|
local_variable_names.reserve( local_variable_scope_info.variables.size() );
|
|
for ( auto& var : local_variable_scope_info.variables )
|
|
{
|
|
local_variable_names.push_back( var->name );
|
|
}
|
|
|
|
blocks.emplace_back( parent_block_index, base_index, std::move( local_variable_names ) );
|
|
return static_cast<unsigned>( blocks.size() - 1 );
|
|
}
|
|
|
|
void DebugStore::add_instruction( const DebugStore::InstructionInfo& info )
|
|
{
|
|
instructions.push_back( info );
|
|
}
|
|
|
|
void DebugStore::add_user_function( UserFunctionInfo uf )
|
|
{
|
|
user_functions.push_back( std::move( uf ) );
|
|
}
|
|
|
|
} // namespace Pol::Bscript::Compiler
|