2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/ast/JumpStatement.h"
|
2020-09-04 18:21:08 -07:00
|
|
|
|
|
|
|
|
|
2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-09-04 18:21:08 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
JumpStatement::JumpStatement( const SourceLocation& source_location, JumpType jump_type,
|
|
|
|
|
std::string label )
|
2024-01-12 06:51:44 +01:00
|
|
|
: Statement( source_location ),
|
|
|
|
|
jump_type( jump_type ),
|
|
|
|
|
label( std::move( label ) ),
|
|
|
|
|
flow_control_label(),
|
|
|
|
|
local_variables_to_remove( 0 )
|
2020-09-04 18:21:08 -07:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void JumpStatement::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_jump_statement( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void JumpStatement::describe_to( std::string& w ) const
|
2020-09-04 18:21:08 -07:00
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
fmt::format_to( std::back_inserter( w ), "{}",
|
|
|
|
|
( jump_type == Break ? "break-statement" : "continue-statement" ) );
|
2020-09-04 18:21:08 -07:00
|
|
|
if ( !label.empty() )
|
2024-01-12 06:51:44 +01:00
|
|
|
fmt::format_to( std::back_inserter( w ), "({})", label );
|
2020-09-04 18:21:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|