Yume
Public Member Functions | Protected Member Functions | List of all members
yume::ast::Stmt Class Referenceabstract

Statements make up most things in source code. More...

#include <ast.hpp>

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

Public Member Functions

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...
 

Protected Member Functions

 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

Statements make up most things in source code.

This includes declarations (such as function declarations) which must be at the top level of a program; or things such as if statements, which must be inside the bodies of functions, but have no associated value. Expressions (Expr) are subclasses of Stmt, but do have an associated value. Note that in a future version of the language, declarations could be moved to a separate class and the distinction between statements and expressions may be removed.

Definition at line 297 of file ast.hpp.

Member Function Documentation

◆ AST() [1/3]

yume::ast::AST::AST ( AST &&  )
protecteddefault

◆ AST() [2/3]

yume::ast::AST::AST ( const AST )
protecteddelete

◆ AST() [3/3]

yume::ast::AST::AST ( Kind  kind,
span< Token tok 
)
inlineprotected

Definition at line 241 of file ast.hpp.

◆ clone()

auto yume::ast::Stmt::clone ( ) const -> Stmt *override
overridepure virtual

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