#include "BranchSelector.h" #include #include "bscript/compiler/ast/Expression.h" #include "bscript/compiler/ast/NodeVisitor.h" #include "bscript/compiler/model/FlowControlLabel.h" namespace Pol::Bscript::Compiler { BranchSelector::BranchSelector( const SourceLocation& source_location, BranchType branch_type, std::unique_ptr predicate ) : Node( source_location, std::move( predicate ) ), branch_type( branch_type ), flow_control_label( std::make_shared() ) { } BranchSelector::BranchSelector( const SourceLocation& source_location, BranchType branch_type ) : Node( source_location ), branch_type( branch_type ), flow_control_label( std::make_shared() ) { } void BranchSelector::accept( NodeVisitor& visitor ) { visitor.visit_branch_selector( *this ); } void BranchSelector::describe_to( fmt::Writer& w ) const { w << "branch-selector(" << branch_type << ")"; } Expression* BranchSelector::predicate() { return children.empty() ? nullptr : &child( 0 ); } } // namespace Pol::Bscript::Compiler