|
Yume
|
A declaration of a function (def).
More...
#include <ast.hpp>


Classes | |
| struct | Body |
Public Types | |
| using | extern_decl_t = { string name |
| using | abstract_decl_t = {} |
| using | body_base_t = visitable_variant< Compound, string, extern_decl_t, abstract_decl_t > |
Public Member Functions | |
| FnDecl (span< Token > tok, string name, vector< TypeName > args, vector< GenericParam > type_args, OptionalType ret, Body body, std::unordered_set< string > annotations) | |
| void | visit (Visitor &visitor) const override |
| Recursively visit this ast node and all its constituents. More... | |
| auto | decl_name () const -> string override |
| auto | varargs () const -> bool |
| auto | primitive () const -> bool |
| auto | extern_decl () const -> bool |
| auto | abstract () const -> bool |
| auto | extern_linkage () const -> bool |
| auto | override () const -> bool |
| void | make_extern_linkage (bool value=true) |
| auto | clone () const -> FnDecl *override |
| Deep copy, except for the type and attachments. More... | |
Public Member Functions inherited from yume::ast::Decl | |
| auto | clone () const -> Decl *override=0 |
| Deep copy, except for the type and attachments. More... | |
| virtual auto | decl_name () const -> string=0 |
| auto | describe () const -> string final |
| A short, string representation for debugging. 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 | |
| bool | varargs |
| string | name |
| std::unordered_set< string > | annotations |
| vector< TypeName > | args |
| vector< GenericParam > | type_args |
| OptionalType | ret |
| Body | body |
| If this function declaration refers to a primitive, this field is a string representing the name of the primitive. If it's an external method, this field is a pair of the extern name and whether the method is varargs. Otherise, this function declaration refers to a regular function and this field holds the body of that function. More... | |
| Fn * | sema_decl {} |
| During semantic analysis, AST nodes are converted to a format better suited for semantic analysis. This field will be set once said conversion is performed. More... | |
Static Public Attributes | |
| static constexpr auto | ANN_EXTERN = "extern" |
| static constexpr auto | ANN_OVERRIDE = "override" |
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) | |
| using yume::ast::FnDecl::abstract_decl_t = {} |
| using yume::ast::FnDecl::body_base_t = visitable_variant<Compound, string, extern_decl_t, abstract_decl_t> |
| using yume::ast::FnDecl::extern_decl_t = { string name |
|
inline |
|
inline |
Definition at line 802 of file ast.hpp.
Referenced by yume::Fn::abstract().
Deep copy, except for the type and attachments.
Implements yume::ast::Decl.
Definition at line 96 of file ast.cpp.
References annotations, args, body, FnDecl(), name, ret, yume::ast::AST::tok(), and type_args.
|
inlineoverridevirtual |
Implements yume::ast::Decl.
|
inline |
Definition at line 801 of file ast.hpp.
Referenced by yume::Fn::extern_decl().
|
inline |
Definition at line 803 of file ast.hpp.
Referenced by yume::Fn::extern_linkage().
|
inline |
Definition at line 805 of file ast.hpp.
Referenced by yume::Fn::make_extern_linkage().
|
inline |
Definition at line 800 of file ast.hpp.
Referenced by yume::Fn::primitive().
|
overridevirtual |
Recursively visit this ast node and all its constituents.
Implements yume::ast::AST.
Definition at line 89 of file visit.cpp.
References annotations, args, body, name, ret, type_args, yume::visitable_variant< Ts >::visit(), and visitor.
|
staticconstexpr |
|
staticconstexpr |
Definition at line 776 of file ast.hpp.
Referenced by yume::DeclLike::opaque_self().
| std::unordered_set<string> yume::ast::FnDecl::annotations |
| vector<TypeName> yume::ast::FnDecl::args |
Definition at line 780 of file ast.hpp.
Referenced by clone(), yume::semantic::TypeWalker::statement(), and visit().
| Body yume::ast::FnDecl::body |
If this function declaration refers to a primitive, this field is a string representing the name of the primitive. If it's an external method, this field is a pair of the extern name and whether the method is varargs. Otherise, this function declaration refers to a regular function and this field holds the body of that function.
Definition at line 786 of file ast.hpp.
Referenced by clone(), yume::Fn::compound_body(), yume::Fn::fn_body(), yume::semantic::TypeWalker::statement(), and visit().
| string yume::ast::FnDecl::name |
| OptionalType yume::ast::FnDecl::ret |
Definition at line 782 of file ast.hpp.
Referenced by clone(), yume::semantic::TypeWalker::statement(), and visit().
| Fn* yume::ast::FnDecl::sema_decl {} |
| vector<GenericParam> yume::ast::FnDecl::type_args |
| bool yume::ast::FnDecl::varargs |
Definition at line 766 of file ast.hpp.
Referenced by yume::semantic::TypeWalker::statement(), and yume::Fn::varargs().