2026-07-25 23:01:18 +02:00
|
|
|
#include "bscript/compiler/ast/StructMemberInitializer.h"
|
2020-09-06 23:24:53 -07:00
|
|
|
|
|
|
|
|
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/ast/Expression.h"
|
|
|
|
|
#include "bscript/compiler/ast/NodeVisitor.h"
|
2020-09-06 23:24:53 -07:00
|
|
|
|
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
|
|
|
{
|
|
|
|
|
StructMemberInitializer::StructMemberInitializer( const SourceLocation& source_location,
|
|
|
|
|
std::string name )
|
|
|
|
|
: Node( source_location ), name( std::move( name ) )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StructMemberInitializer::StructMemberInitializer( const SourceLocation& source_location,
|
|
|
|
|
std::string name,
|
|
|
|
|
std::unique_ptr<Expression> initializer )
|
|
|
|
|
: Node( source_location, std::move( initializer ) ), name( std::move( name ) )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void StructMemberInitializer::accept( NodeVisitor& visitor )
|
|
|
|
|
{
|
|
|
|
|
visitor.visit_struct_member_initializer( *this );
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 06:51:44 +01:00
|
|
|
void StructMemberInitializer::describe_to( std::string& w ) const
|
2020-09-06 23:24:53 -07:00
|
|
|
{
|
2024-01-12 06:51:44 +01:00
|
|
|
fmt::format_to( std::back_inserter( w ), "struct-member-initializer({})", name );
|
2020-09-06 23:24:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Pol::Bscript::Compiler
|