polserver/pol-core/bscript/compiler/ast/UnaryOperator.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

38 lines
888 B
C++

#include "bscript/compiler/ast/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