2020-08-24 01:47:38 -07:00
|
|
|
#include "Argument.h"
|
|
|
|
|
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/Expression.h"
|
|
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-08-24 01:47:38 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
Argument::Argument( const SourceLocation& source_location, std::string identifier,
|
|
|
|
|
std::unique_ptr<Expression> expression )
|
|
|
|
|
: Node( source_location, std::move( expression ) ), identifier( std::move( identifier ) )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Argument::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_argument( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void Argument::describe_to( std::string& w ) const
|
2020-08-24 01:47:38 -07:00
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
fmt::format_to( std::back_inserter( w ), "argument({})", identifier );
|
2020-08-24 01:47:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<Expression> Argument::take_expression()
|
|
|
|
|
{
|
|
|
|
|
return take_child<Expression>( 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|