Gyoji Compiler
|
A single named argument to a function. More...
#include <functions.hpp>
Public Member Functions | |
FunctionArgument (std::string &_name, const Type *_type, const Gyoji::context::SourceReference &_name_source_ref, const Gyoji::context::SourceReference &_type_source_ref) | |
Create new argument from a name and a type. | |
FunctionArgument (const FunctionArgument &_other) | |
copy constructor | |
~FunctionArgument () | |
Move along, nothing to see here. | |
const std::string & | get_name () const |
Name of the argument. | |
const Type * | get_type () const |
Type of the argument. | |
A single named argument to a function.
Each function may take zero or more arguments which are represented as a name and a Type. The name represents the local variable that it will be accessible as in the function and the Type is the data-type it is interpreted as.
FunctionArgument::FunctionArgument | ( | std::string & | _name, |
const Type * | _type, | ||
const Gyoji::context::SourceReference & | _name_source_ref, | ||
const Gyoji::context::SourceReference & | _type_source_ref | ||
) |
Create new argument from a name and a type.
This creates a new argument from a name and a type. The name is the name of the variable that is referenced in the function by load and store opcodes. The type is a pointer to a type defined in the Types table. It must live at least as long as the Function itself, so it must be a part of the MIR container in order to guarantee that it is always valid in this scope.
FunctionArgument::FunctionArgument | ( | const FunctionArgument & | _other | ) |
copy constructor
The copy constructor is provided so that this object may be used inside std::vector and copied when needed to manipulate the list.
FunctionArgument::~FunctionArgument | ( | ) |
Move along, nothing to see here.
Move along, nothing to see here.
const std::string & FunctionArgument::get_name | ( | ) | const |
Name of the argument.
Returns an immutable reference to the name of the argument.
const Type * FunctionArgument::get_type | ( | ) | const |
Type of the argument.
Returns a pointer to the immutable type of the argument.