polserver/pol-core/bscript/compiler/model/FlowControlLabel.h
Kevin Eady a953a37fa7 Support function reference calls with default parameters (#710)
* Support default args in funcref calls
- Simplify BFunctionRef by using funcref index
- Emit default args when visiting function reference

* Move default args gen to second-pass visit

* Better error message on param count errors

* Check for constructor in MTH_NEW

* Address self-review comments
- Update code comments

* Introduce ResourceManager to pol testsuite
- Create a new class-based resource manager for deleting resources
(item NPCs, multis) after each test.
- Migrate house_set_multiid test to use new ResourceManager.

* Move resource cleanup
2024-10-10 18:06:04 +02:00

36 lines
856 B
C++

#ifndef POLSERVER_FLOWCONTROLLABEL_H
#define POLSERVER_FLOWCONTROLLABEL_H
#include <optional>
#include <string>
#include <vector>
namespace Pol::Bscript::Compiler
{
class FunctionParameterDeclaration;
class InstructionEmitter;
class UserFunction;
class FlowControlLabel
{
public:
FlowControlLabel();
bool has_address() const;
unsigned address() const;
const std::vector<unsigned>& get_referencing_instruction_addresses() const;
void assign_address( unsigned );
void add_referencing_instruction_address( unsigned );
static std::string label_for_user_function_default_argument(
const UserFunction&, const FunctionParameterDeclaration& );
private:
std::optional<unsigned> maybe_address;
std::vector<unsigned> referencing_instruction_addresses;
};
} // namespace Pol::Bscript::Compiler
#endif // POLSERVER_FLOWCONTROLLABEL_H