polserver/pol-core/bscript/compiler/representation/DebugStore.cpp
turleypol 1463b76c7c
Includes are now all relative to pol-core basefolder (#906)
* 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
2026-07-25 23:01:18 +02:00

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