Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::mir::FunctionArgument Class Reference

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::stringget_name () const
 Name of the argument.
 
const Typeget_type () const
 Type of the argument.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FunctionArgument() [1/2]

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() [2/2]

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::~FunctionArgument ( )

Move along, nothing to see here.

Move along, nothing to see here.

Member Function Documentation

◆ get_name()

const std::string & FunctionArgument::get_name ( ) const

Name of the argument.

Returns an immutable reference to the name of the argument.

◆ get_type()

const Type * FunctionArgument::get_type ( ) const

Type of the argument.

Returns a pointer to the immutable type of the argument.


The documentation for this class was generated from the following files: