|
Yume
|
A function declaration in the compiler. More...
#include <vals.hpp>

Public Member Functions | |
| Fn (Def def, ast::Program *member, optional< ty::Type > parent, Substitutions subs) | |
| Fn (Def def, ast::Program *member, optional< ty::Type > parent, nullable< Substitutions * > parent_subs, vector< GenericKey > generic={}, vector< unique_ptr< ty::Generic > > primary_generics={}) | |
| auto | fn_body () -> ast::FnDecl::Body & |
| auto | compound_body () -> ast::Compound & |
| auto | ast () const -> const ast::Stmt & |
| auto | ast () -> ast::Stmt & |
| auto | get_self_ty () const -> optional< ty::Type > |
| auto | get_subs () const -> const Substitutions & |
| auto | get_subs () -> Substitutions & |
| auto | ret () const -> optional< ty::Type > |
| auto | arg_count () const -> size_t |
| auto | arg_types () const -> vector< ty::Type > |
| auto | arg_names () const -> vector< string > |
| auto | arg_nodes () const -> const vector< ast::TypeName > & |
| auto | args () const -> vector< FnArg > |
| auto | varargs () const -> bool |
| auto | primitive () const -> bool |
| auto | abstract () const -> bool |
| auto | extern_decl () const -> bool |
| auto | local () const -> bool |
| auto | extern_linkage () const -> bool |
| void | make_extern_linkage (bool value=true) |
| auto | has_annotation (const string &name) const -> bool |
| auto | name () const noexcept -> string |
| auto | get_or_create_instantiation (Substitutions &subs) noexcept -> std::pair< bool, Fn & > |
| auto | create_instantiation (Substitutions &subs) noexcept -> Fn & |
Public Attributes | |
| Def | def |
| The ast node that defines this declaration. More... | |
| const ty::Function * | fn_ty {} |
| optional< ty::Type > | self_ty {} |
If this function is in the body of a struct, this points to its type. Used for the self type. More... | |
| ast::Program * | member {} |
| The program this declaration is a member of. More... | |
| vector< unique_ptr< ty::Generic > > | primary_generics {} |
| Substitutions | subs |
| If this is an instantiation of a template, a mapping between type variables and their substitutions. More... | |
| llvm::Function * | llvm {} |
| The LLVM function definition corresponding to this function or constructor. More... | |
| std::unordered_map< Substitutions, unique_ptr< Fn > > | instantiations {} |
A function declaration in the compiler.
The primary use of this structure is to bind together the AST declaration of a function (ast::FnDecl) and the bytecode body of a function (llvm::Function). A function template may also be a Fn. Since a template doesn't actually have a body, its m_llvm_fn is nullptr. All the instantiations of a template are stored in instantiations.
|
inline |
|
inline |
| auto yume::Fn::abstract | ( | ) | const -> bool |
Definition at line 106 of file vals.cpp.
References yume::ast::FnDecl::abstract(), yume::always_false, def, and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::define(), and yume::DeclLike::opaque_self().
| auto yume::Fn::arg_count | ( | ) | const -> size_t |
Definition at line 87 of file vals.cpp.
References def, and yume::visitable_variant< Ts >::visit().
| auto yume::Fn::arg_names | ( | ) | const -> vector<string> |
Definition at line 92 of file vals.cpp.
Referenced by yume::Compiler::declare().
| auto yume::Fn::arg_nodes | ( | ) | const -> const vector<ast::TypeName>& |
Definition at line 93 of file vals.cpp.
References ast(), def, and yume::visitable_variant< Ts >::visit().
| auto yume::Fn::arg_types | ( | ) | const -> vector<ty::Type> |
Definition at line 91 of file vals.cpp.
Referenced by yume::semantic::Overload::dump(), and yume::vtable_entry_for().
| auto yume::Fn::ast | ( | ) | -> ast::Stmt& |
Definition at line 71 of file vals.cpp.
References yume::ast::AST::visit().
| auto yume::Fn::ast | ( | ) | const -> const ast::Stmt& |
Definition at line 74 of file vals.cpp.
References ast(), def, and yume::visitable_variant< Ts >::visit().
Referenced by arg_nodes(), ast(), yume::Compiler::declare(), yume::Compiler::define(), yume::semantic::Overload::dump(), yume::semantic::Overload::location(), name(), and ret().
| auto yume::Fn::compound_body | ( | ) | -> ast::Compound& |
Definition at line 128 of file vals.cpp.
References yume::ast::FnDecl::body, and yume::ast::Compound::visit().
Referenced by yume::Compiler::define().
|
noexcept |
| auto yume::Fn::extern_decl | ( | ) | const -> bool |
Definition at line 109 of file vals.cpp.
References yume::always_false, def, yume::ast::FnDecl::extern_decl(), and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::declare(), and yume::Compiler::run().
| auto yume::Fn::extern_linkage | ( | ) | const -> bool |
Definition at line 115 of file vals.cpp.
References yume::always_false, def, yume::ast::FnDecl::extern_linkage(), and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::declare(), and yume::Compiler::run().
| auto yume::Fn::fn_body | ( | ) | -> ast::FnDecl::Body& |
Definition at line 134 of file vals.cpp.
References yume::always_throw, yume::ast::FnDecl::body, and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::define().
|
noexcept |
Definition at line 36 of file vals.cpp.
Referenced by yume::semantic::TypeWalker::expression().
|
inline |
|
inline |
|
inline |
| auto yume::Fn::has_annotation | ( | const string & | name | ) | const -> bool |
Definition at line 118 of file vals.cpp.
Referenced by yume::Compiler::declare(), and yume::DeclLike::opaque_self().
| auto yume::Fn::local | ( | ) | const -> bool |
Definition at line 112 of file vals.cpp.
References yume::always_false, def, and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::declare().
| void yume::Fn::make_extern_linkage | ( | bool | value = true | ) |
Definition at line 123 of file vals.cpp.
References yume::always_throw, def, yume::ast::FnDecl::make_extern_linkage(), and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::run().
|
noexcept |
Definition at line 64 of file vals.cpp.
References ast(), def, and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::declare(), yume::semantic::Overload::dump(), yume::Compiler::run(), and yume::vtable_entry_for().
| auto yume::Fn::primitive | ( | ) | const -> bool |
Definition at line 103 of file vals.cpp.
References yume::always_false, def, yume::ast::FnDecl::primitive(), and yume::visitable_variant< Ts >::visit().
Referenced by yume::Compiler::declare().
| auto yume::Fn::ret | ( | ) | const -> optional<ty::Type> |
Definition at line 78 of file vals.cpp.
References ast(), def, ret(), self_ty, and yume::visitable_variant< Ts >::visit().
Referenced by ret(), and yume::vtable_entry_for().
| auto yume::Fn::varargs | ( | ) | const -> bool |
Definition at line 100 of file vals.cpp.
References yume::always_false, def, yume::ast::FnDecl::varargs, and yume::visitable_variant< Ts >::visit().
| Def yume::Fn::def |
The ast node that defines this declaration.
Definition at line 54 of file vals.hpp.
Referenced by abstract(), arg_count(), arg_nodes(), ast(), extern_decl(), extern_linkage(), local(), make_extern_linkage(), name(), primitive(), ret(), and varargs().
| const ty::Function* yume::Fn::fn_ty {} |
Definition at line 55 of file vals.hpp.
Referenced by yume::Compiler::declare(), and yume::Compiler::expression().
| std::unordered_map<Substitutions, unique_ptr<Fn> > yume::Fn::instantiations {} |
| llvm::Function* yume::Fn::llvm {} |
The LLVM function definition corresponding to this function or constructor.
Definition at line 65 of file vals.hpp.
Referenced by yume::Compiler::declare(), yume::Compiler::define(), and yume::Compiler::statement().
| ast::Program* yume::Fn::member {} |
The program this declaration is a member of.
Definition at line 59 of file vals.hpp.
Referenced by yume::Compiler::declare(), and yume::Compiler::expression().
| vector<unique_ptr<ty::Generic> > yume::Fn::primary_generics {} |
| optional<ty::Type> yume::Fn::self_ty {} |
If this function is in the body of a struct, this points to its type. Used for the self type.
Definition at line 57 of file vals.hpp.
Referenced by yume::Compiler::define(), yume::semantic::Overload::dump(), get_self_ty(), and ret().
| Substitutions yume::Fn::subs |
If this is an instantiation of a template, a mapping between type variables and their substitutions.
Definition at line 63 of file vals.hpp.
Referenced by get_subs().