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

A declaration of a struct (struct) or an interface (interface). More...

#include <ast.hpp>

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

Public Member Functions

 StructDecl (span< Token > tok, string name, vector< TypeName > fields, vector< GenericParam > type_args, Compound body, OptionalType implements, std::unordered_set< string > annotations, bool is_interface=false)
 
void visit (Visitor &visitor) const override
 Recursively visit this ast node and all its constituents. More...
 
auto decl_name () const -> string override
 
auto clone () const -> StructDecl *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

string name
 
vector< TypeNamefields
 
vector< GenericParamtype_args
 
Compound body
 
OptionalType implements
 
std::unordered_set< string > annotations
 
bool is_interface
 

Static Public Attributes

static constexpr auto BUILTIN_TYPE_SLICE = "__builtin_type_Slice"
 
static constexpr auto BUILTIN_TYPE_STATIC_ARRAY = "__builtin_type_StaticArray"
 

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 declaration of a struct (struct) or an interface (interface).

Definition at line 847 of file ast.hpp.

Constructor & Destructor Documentation

◆ StructDecl()

yume::ast::StructDecl::StructDecl ( span< Token tok,
string  name,
vector< TypeName fields,
vector< GenericParam type_args,
Compound  body,
OptionalType  implements,
std::unordered_set< string >  annotations,
bool  is_interface = false 
)
inline

Definition at line 860 of file ast.hpp.

Referenced by clone().

Member Function Documentation

◆ clone()

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

Deep copy, except for the type and attachments.

Implements yume::ast::Decl.

Definition at line 100 of file ast.cpp.

References annotations, body, fields, implements, is_interface, name, StructDecl(), yume::ast::AST::tok(), and type_args.

◆ decl_name()

auto yume::ast::StructDecl::decl_name ( ) const -> string
inlineoverridevirtual

Implements yume::ast::Decl.

Definition at line 865 of file ast.hpp.

◆ visit()

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

Recursively visit this ast node and all its constituents.

See also
Visitor

Implements yume::ast::AST.

Definition at line 103 of file visit.cpp.

References annotations, body, fields, implements, is_interface, name, type_args, and visitor.

Member Data Documentation

◆ annotations

std::unordered_set<string> yume::ast::StructDecl::annotations

Definition at line 854 of file ast.hpp.

Referenced by clone(), yume::Struct::has_annotation(), and visit().

◆ body

Compound yume::ast::StructDecl::body

Definition at line 852 of file ast.hpp.

Referenced by yume::Struct::body(), clone(), and visit().

◆ BUILTIN_TYPE_SLICE

constexpr auto yume::ast::StructDecl::BUILTIN_TYPE_SLICE = "__builtin_type_Slice"
staticconstexpr

Definition at line 857 of file ast.hpp.

Referenced by yume::Compiler::decl_statement(), and yume::ty::Type::is_slice().

◆ BUILTIN_TYPE_STATIC_ARRAY

constexpr auto yume::ast::StructDecl::BUILTIN_TYPE_STATIC_ARRAY = "__builtin_type_StaticArray"
staticconstexpr

Definition at line 858 of file ast.hpp.

◆ fields

vector<TypeName> yume::ast::StructDecl::fields

Definition at line 850 of file ast.hpp.

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

◆ implements

OptionalType yume::ast::StructDecl::implements

Definition at line 853 of file ast.hpp.

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

◆ is_interface

bool yume::ast::StructDecl::is_interface

Definition at line 855 of file ast.hpp.

Referenced by clone(), and visit().

◆ name

string yume::ast::StructDecl::name

Definition at line 849 of file ast.hpp.

Referenced by clone(), yume::Struct::name(), and visit().

◆ type_args

vector<GenericParam> yume::ast::StructDecl::type_args

Definition at line 851 of file ast.hpp.

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


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