Spicy
Public Member Functions | Static Public Member Functions | List of all members
hilti::declaration::LocalVariable Class Reference

#include <local-variable.h>

Inheritance diagram for hilti::declaration::LocalVariable:
hilti::NodeBase hilti::trait::isDeclaration hilti::trait::isNode hilti::trait::isNode

Public Member Functions

 LocalVariable (ID id, ::hilti::Type type, std::optional< hilti::Expression > init={}, bool const_=false, Meta m=Meta())
 
 LocalVariable (ID id, ::hilti::Type type, std::vector< hilti::Expression > args, std::optional< hilti::Expression > init={}, bool const_=false, Meta m=Meta())
 
 LocalVariable (ID id, hilti::Expression init, bool const_=false, Meta m=Meta())
 
auto init () const
 
auto typeArguments () const
 
::hilti::Type type () const
 
auto hasAutomaticType () const
 
bool operator== (const LocalVariable &other) const
 
bool isConstant () const
 
const IDid () const
 
Linkage linkage () const
 
std::string displayName () const
 
auto isEqual (const Declaration &other) const
 
auto properties () const
 
- Public Member Functions inherited from hilti::NodeBase
 NodeBase (Meta meta)
 
 NodeBase (std::vector< Node > childs, Meta meta)
 
template<typename T >
const T & child (int i) const
 
template<typename T >
void assertChildIsA (int i)
 
template<typename T >
std::vector< T > childs (int begin, int end) const
 
template<typename T >
std::vector< T > childsOfType () const
 
template<typename T >
auto nodesOfType () const
 
template<typename T >
auto nodesOfType ()
 
void addChild (Node n)
 
auto & childs () const
 
auto & childs ()
 
auto & meta () const
 
void setMeta (Meta m)
 
const NodeReforiginalNode () const
 
void setOriginalNode (const NodeRef &n)
 
void clearCache ()
 

Static Public Member Functions

static Declaration setType (const LocalVariable &d, std::optional< hilti::Type > t)
 
static Declaration setInit (const LocalVariable &d, std::optional< hilti::Expression > i)
 
static Declaration setTypeArguments (const LocalVariable &d, std::vector< hilti::Expression > args)
 

Detailed Description

AST node for a declaration of a local variable.

Member Function Documentation

◆ displayName()

std::string hilti::declaration::LocalVariable::displayName ( ) const
inline

Implements Declaration interface.

◆ hasAutomaticType()

auto hilti::declaration::LocalVariable::hasAutomaticType ( ) const
inline

Returns true if this is an auto variable, i.e., the type is derived from the initialization expression.

◆ id()

const ID& hilti::declaration::LocalVariable::id ( ) const
inline

Implements Declaration interface.

◆ isConstant()

bool hilti::declaration::LocalVariable::isConstant ( ) const
inline

Implements Declaration interface.

◆ isEqual()

auto hilti::declaration::LocalVariable::isEqual ( const Declaration &  other) const
inline

Implements Declaration interface.

◆ linkage()

Linkage hilti::declaration::LocalVariable::linkage ( ) const
inline

Implements Declaration interface.

◆ properties()

auto hilti::declaration::LocalVariable::properties ( ) const
inline

Implements Node interface.

◆ setInit()

static Declaration hilti::declaration::LocalVariable::setInit ( const LocalVariable d,
std::optional< hilti::Expression >  i 
)
inlinestatic

Returns a new local variable declaration with the init expression replaced.

Parameters
doriginal declaration
inew init expresssion
Returns
new declaration that's equal to original one but with the init expression replaced

◆ setType()

static Declaration hilti::declaration::LocalVariable::setType ( const LocalVariable d,
std::optional< hilti::Type >  t 
)
inlinestatic

Returns a new local variable declaration with the type replaced.

Parameters
doriginal declaration
bnew type
Returns
new declaration that's equal to original one but with the type replaced

◆ setTypeArguments()

static Declaration hilti::declaration::LocalVariable::setTypeArguments ( const LocalVariable d,
std::vector< hilti::Expression >  args 
)
inlinestatic

Returns a new local variable declaration with the type argument expressions replaced.

Parameters
doriginal declaration
inew init expresssion
Returns
new declaration that's equal to original one but with the init expression replaced

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