mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* 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
38 lines
867 B
C++
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
|