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

39 lines
1.1 KiB
C++

#include "bscript/compiler/ast/Argument.h"
#include "bscript/compiler/ast/Expression.h"
#include "bscript/compiler/ast/NodeVisitor.h"
namespace Pol::Bscript::Compiler
{
Argument::Argument( const SourceLocation& source_location, const ScopableName& identifier,
std::unique_ptr<Expression> expression, bool spread )
: Node( source_location, std::move( expression ) ),
identifier( std::make_unique<ScopableName>( identifier ) ),
spread( spread )
{
}
Argument::Argument( const SourceLocation& source_location, std::unique_ptr<Expression> expression,
bool spread )
: Node( source_location, std::move( expression ) ), identifier( nullptr ), spread( spread )
{
}
void Argument::accept( NodeVisitor& visitor )
{
visitor.visit_argument( *this );
}
void Argument::describe_to( std::string& w ) const
{
fmt::format_to( std::back_inserter( w ), "argument({}{})", spread ? "..." : "",
identifier ? identifier->string() : "" );
}
std::unique_ptr<Expression> Argument::take_expression()
{
return take_child<Expression>( 0 );
}
} // namespace Pol::Bscript::Compiler