polserver/pol-core/bscript/compiler/ast/UnaryOperator.cpp
turleypol d848deae18
POLLOG* macros use the new formatting (#598)
* POLLOG* macros use the new formatting
removed all old logging functions

* removed old fmt lib from everything except StreamWriter
removed unneeded functions

* fixed review comments
2024-01-16 17:55:42 +01:00

38 lines
867 B
C++

#include "UnaryOperator.h"
#include <utility>
#include "bscript/compiler/ast/NodeVisitor.h"
namespace Pol::Bscript::Compiler
{
UnaryOperator::UnaryOperator( const SourceLocation& source_location, std::string op,
BTokenId token_id, std::unique_ptr<Expression> operand )
: Expression( source_location, std::move( operand ) ),
op( std::move( op ) ),
token_id( token_id )
{
}
void UnaryOperator::accept( NodeVisitor& visitor )
{
visitor.visit_unary_operator( *this );
}
void UnaryOperator::describe_to( std::string& w ) const
{
fmt::format_to( std::back_inserter( w ), "unary-operator({})", op );
}
Expression& UnaryOperator::operand()
{
return child<Expression>( 0 );
}
std::unique_ptr<Expression> UnaryOperator::take_operand()
{
return take_child<Expression>( 0 );
}
} // namespace Pol::Bscript::Compiler