Yume
Public Member Functions | Public Attributes | List of all members
yume::ast::LambdaExpr Struct Referencefinal

A local definition of an anonymous function. More...

#include <ast.hpp>

Inheritance diagram for yume::ast::LambdaExpr:
Inheritance graph
[legend]
Collaboration diagram for yume::ast::LambdaExpr:
Collaboration graph
[legend]

Public Member Functions

 LambdaExpr (span< Token > tok, vector< TypeName > args, OptionalType ret, Compound body, std::set< string > annotations)
 
void visit (Visitor &visitor) const override
 Recursively visit this ast node and all its constituents. More...
 
auto clone () const -> LambdaExpr *override
 Deep copy, except for the type and attachments. More...
 
auto clone () const -> Expr *override=0
 Deep copy, except for the type and attachments. More...
 
auto clone () const -> Stmt *override=0
 Deep copy, except for the type and attachments. More...
 
- Public Member Functions inherited from yume::ast::AST
 AST (const AST &)=delete
 
 AST (AST &&)=default
 
auto operator= (const AST &) -> AST &=delete
 
auto operator= (AST &&) -> AST &=delete
 
virtual ~AST ()=default
 
virtual void visit (Visitor &visitor) const =0
 Recursively visit this ast node and all its constituents. More...
 
auto val_ty () const noexcept -> optional< ty::Type >
 
auto ensure_ty () const -> ty::Type
 
void val_ty (optional< ty::Type > type)
 
void attach_to (nonnull< AST * > other)
 Make the type of this node depend on the type of other. More...
 
auto kind () const -> Kind
 
auto kind_name () const -> string
 Human-readable string representation of the Kind of this node. More...
 
auto token_range () const -> const span< Token > &
 
auto equals_by_hash (ast::AST &other) const -> bool
 
auto location () const -> Loc
 The union of the locations of the Tokens making up this node. More...
 
virtual auto describe () const -> string
 A short, string representation for debugging. More...
 
virtual auto clone () const -> AST *=0
 Deep copy, except for the type and attachments. More...
 

Public Attributes

vector< TypeNameargs
 
OptionalType ret
 
Compound body
 
std::set< string > annotations
 
vector< string > closured_names {}
 
vector< AST * > closured_nodes {}
 
llvm::Function * llvm_fn {}
 

Additional Inherited Members

- Protected Member Functions inherited from yume::ast::Stmt
 AST (Kind kind, span< Token > tok)
 
 AST (const AST &)=delete
 
 AST (AST &&)=default
 
- Protected Member Functions inherited from yume::ast::AST
void unify_val_ty ()
 Verify the type compatibility of the depends of this node, and merge the types if possible. This is called every time the node's type is updated. More...
 
auto tok () const noexcept -> span< Token >
 
 AST (Kind kind, span< Token > tok)
 

Detailed Description

A local definition of an anonymous function.

Definition at line 729 of file ast.hpp.

Constructor & Destructor Documentation

◆ LambdaExpr()

yume::ast::LambdaExpr::LambdaExpr ( span< Token tok,
vector< TypeName args,
OptionalType  ret,
Compound  body,
std::set< string >  annotations 
)
inline

Definition at line 739 of file ast.hpp.

Referenced by clone().

Member Function Documentation

◆ clone()

auto yume::ast::LambdaExpr::clone ( ) const -> LambdaExpr *override
overridevirtual

Deep copy, except for the type and attachments.

Implements yume::ast::Expr.

Definition at line 122 of file ast.cpp.

References annotations, args, body, LambdaExpr(), ret, and yume::ast::AST::tok().

◆ visit()

void yume::ast::LambdaExpr::visit ( Visitor visitor) const
overridevirtual

Recursively visit this ast node and all its constituents.

See also
Visitor

Implements yume::ast::AST.

Definition at line 134 of file visit.cpp.

References annotations, args, body, ret, and visitor.

Member Data Documentation

◆ annotations

std::set<string> yume::ast::LambdaExpr::annotations

Definition at line 734 of file ast.hpp.

Referenced by clone(), and visit().

◆ args

vector<TypeName> yume::ast::LambdaExpr::args

Definition at line 731 of file ast.hpp.

Referenced by clone(), yume::semantic::TypeWalker::expression(), and visit().

◆ body

Compound yume::ast::LambdaExpr::body

Definition at line 733 of file ast.hpp.

Referenced by clone(), yume::semantic::TypeWalker::expression(), and visit().

◆ closured_names

vector<string> yume::ast::LambdaExpr::closured_names {}

Definition at line 735 of file ast.hpp.

Referenced by yume::semantic::TypeWalker::expression().

◆ closured_nodes

vector<AST*> yume::ast::LambdaExpr::closured_nodes {}

Definition at line 736 of file ast.hpp.

Referenced by yume::semantic::TypeWalker::expression().

◆ llvm_fn

llvm::Function* yume::ast::LambdaExpr::llvm_fn {}

Definition at line 737 of file ast.hpp.

◆ ret

OptionalType yume::ast::LambdaExpr::ret

Definition at line 732 of file ast.hpp.

Referenced by clone(), yume::semantic::TypeWalker::expression(), and visit().


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