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