tcalc 0.2.0
 
Loading...
Searching...
No Matches
tcalc::ast::FdefNode Class Reference

Function definition node. More...

#include <function.hpp>

Inheritance diagram for tcalc::ast::FdefNode:
tcalc::ast::Node

Public Member Functions

 FdefNode (std::string name)
 Construct a new Fdef Node object only with name.
 
 FdefNode (std::string name, std::vector< std::string > args, NodePtr<> body)
 Construct a new Fdef Node object with arguments and body.
 
TCALC_INLINE auto & args () const noexcept
 Get function arguments.
 
TCALC_INLINE auto & args () noexcept
 Get function arguments.
 
TCALC_INLINE void push_arg (const std::string &arg)
 Push a function argument.
 
TCALC_INLINE auto & body () const noexcept
 Get function body.
 
TCALC_INLINE auto & body () noexcept
 Get function body.
 
TCALC_INLINE void body (NodePtr<> body)
 Set function body.
 
TCALC_INLINE auto & name () const noexcept
 Get function name.
 
TCALC_INLINE void name (std::string name)
 Set function name.
 
- Public Member Functions inherited from tcalc::ast::Node
 Node (NodeType type)
 Construct a new Node object.
 
TCALC_INLINE auto type () const noexcept
 Get the node type.
 

Detailed Description

Function definition node.

Constructor & Destructor Documentation

◆ FdefNode() [1/2]

tcalc::ast::FdefNode::FdefNode ( std::string  name)
inlineexplicit

Construct a new Fdef Node object only with name.

Parameters
nameFunction name.

◆ FdefNode() [2/2]

tcalc::ast::FdefNode::FdefNode ( std::string  name,
std::vector< std::string >  args,
NodePtr<>  body 
)
inline

Construct a new Fdef Node object with arguments and body.

Parameters
nameFunction name.
argsFunction arguments.
bodyFunction body.

Member Function Documentation

◆ args() [1/2]

TCALC_INLINE auto & tcalc::ast::FdefNode::args ( ) const
inlinenoexcept

Get function arguments.

Returns
const std::vector<std::string>& Function arguments.

◆ args() [2/2]

TCALC_INLINE auto & tcalc::ast::FdefNode::args ( )
inlinenoexcept

Get function arguments.

Returns
std::vector<std::string>& Function arguments.

◆ body() [1/3]

TCALC_INLINE auto & tcalc::ast::FdefNode::body ( ) const
inlinenoexcept

Get function body.

Returns
const NodePtr<>& Function body.

◆ body() [2/3]

TCALC_INLINE auto & tcalc::ast::FdefNode::body ( )
inlinenoexcept

Get function body.

Returns
NodePtr<>& Function body.

◆ body() [3/3]

TCALC_INLINE void tcalc::ast::FdefNode::body ( NodePtr<>  body)
inline

Set function body.

Parameters
bodyFunction body.

◆ name() [1/2]

TCALC_INLINE auto & tcalc::ast::FdefNode::name ( ) const
inlinenoexcept

Get function name.

Returns
const std::string& Function name.

◆ name() [2/2]

TCALC_INLINE void tcalc::ast::FdefNode::name ( std::string  name)
inline

Set function name.

Parameters
nameFunction name.

◆ push_arg()

TCALC_INLINE void tcalc::ast::FdefNode::push_arg ( const std::string &  arg)
inline

Push a function argument.

Parameters
argArgument to push.

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