CallableArguments
class CallableArguments
constructor CallableArguments
Construct an empty Arguments object.
| CallableArguments | ( | ); |
constructor CallableArguments
| CallableArguments | ( | ScopeEntity * entity, | |
| const std::shared_ptr< StructuredValue > & definition | ); |
| PARAMETER | DESCRIPTION |
|---|---|
entity |
|
definition |
constructor CallableArguments
Construct an Arguments object from a tokenizer.
| CallableArguments | ( | Tokenizer & tokenizer | ); |
| PARAMETER | DESCRIPTION |
|---|---|
tokenizer |
method argument_namesconst
Get the list of argument names.
| const std::vector< Symbol > & argument_names | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
const std::vector< Symbol > & |
The list of argument names. |
method create_argument_constantsconst private
Create constants for the actual arguments and add default arguments as required.
| std::vector< std::shared_ptr< Constant > > create_argument_constants | ( | std::shared_ptr< Scope > scope, | |
| CloneContext * context, | |||
| const std::vector< Expression > & arguments | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
scope |
The scope to create the constants in. |
context |
|
arguments |
The list of argument expressions. |
| RETURNS | DESCRIPTION |
|---|---|
std::vector< std::shared_ptr< Constant > > |
A vector of shared pointers to the created constants. |
method default_argumentconst
Get the default value of the argument at a given index.
| std::optional< Expression > default_argument | ( | size_t index | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
index |
The index of the argument. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
The default value of the argument, if any. |
method default_argument_indexconst
| size_t default_argument_index | ( | size_t index | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
index |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
method emptyconst
Check if callable takes no arguments.
| bool empty | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method enter_arguments
Enter argument placeholder constants into the callable entity's scope.
This also creates constants for the default arguments but doesn't enter them into the scope.
| void enter_arguments | ( | ); |
method initializestatic private
Initialize static members.
| static void initialize | ( | ); |
method maximum_argumentsconst
Get the maximum number of arguments the callable can take.
| size_t maximum_arguments | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The maximum number of arguments. |
method minimum_argumentsconst
Get the minimum number of arguments the callable requires.
| size_t minimum_arguments | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The minimum number of arguments. |
method nameconst
Get the name of the argument at a given index.
| Symbol name | ( | size_t index | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
index |
The index of the argument. |
| RETURNS | DESCRIPTION |
|---|---|
Symbol |
The name of the argument. |
method serializeconst
Print the Arguments object to a stream.
| void serialize | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The stream to print to. |
method serialize_callableconst
| void serialize_callable | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
method set_arguments
Set the arguments for a callable entity.
This creates constants for the actual arguments and adds them to the expansion and their mapping in the context.
Call this function before cloning the callable entity's body.
| void set_arguments | ( | Expansion * expansion, | |
| CloneContext * context, | |||
| const std::vector< Expression > & arguments | ); |
| PARAMETER | DESCRIPTION |
|---|---|
expansion |
The expanded copy. |
context |
The clone context. |
arguments |
The list of argument expressions. |
method set_entity
| void set_entity | ( | ScopeEntity * entity | ); |
| PARAMETER | DESCRIPTION |
|---|---|
entity |
method traverse
| void traverse | ( | std::function< void(Expression &)> expression_callback | ); |
| PARAMETER | DESCRIPTION |
|---|---|
expression_callback |
member argument_constants
The placeholder constants for the arguments.
member default_argument_constants
The constants for the default arguments.
The index in this array is offset by the number of non-optional arguments.
member default_arguments
The default values of the arguments.
The index in this array is offset by the number of non-optional arguments.
member entityprivate
The ScopeEntity the arguments belong to.
member initializedstatic private
Whether static members have been initialized.
member names
The names of the arguments.
member token_argumentsstatic private
The token representing the "arguments" key in a callable's representation in a library.
.h