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

41 lines
1.2 KiB
C++

#include "bscript/compiler/ast/MethodCall.h"
#include <utility>
#include "bscript/compiler/ast/MethodCallArgumentList.h"
#include "bscript/compiler/ast/NodeVisitor.h"
#include "bscript/compilercfg.h"
namespace Pol::Bscript::Compiler
{
MethodCall::MethodCall( const SourceLocation& source_location, std::unique_ptr<Expression> lhs,
std::string methodname,
std::unique_ptr<MethodCallArgumentList> argument_list )
: Expression( source_location ),
methodname( std::move( methodname ) ),
known_method( compilercfg.OptimizeObjectMembers
? getKnownObjMethod( this->methodname.c_str() )
: nullptr )
{
children.reserve( 2 );
children.push_back( std::move( lhs ) );
children.push_back( std::move( argument_list ) );
}
void MethodCall::accept( NodeVisitor& visitor )
{
visitor.visit_method_call( *this );
}
void MethodCall::describe_to( std::string& w ) const
{
fmt::format_to( std::back_inserter( w ), "method-call({})", methodname );
}
unsigned MethodCall::argument_count() const
{
return static_cast<unsigned>( children.at( 1 )->children.size() );
}
} // namespace Pol::Bscript::Compiler