Yume
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
yume::semantic::TypeWalker Struct Reference

Determine the type information of AST nodes. This makes up most of the "semantic" phase of the compiler. More...

#include <type_walker.hpp>

Inheritance diagram for yume::semantic::TypeWalker:
Inheritance graph
[legend]
Collaboration diagram for yume::semantic::TypeWalker:
Collaboration graph
[legend]

Classes

struct  ASTWithName
 

Public Types

using scope_t = ScopeContainer< nonnull< ast::AST * > >
 

Public Member Functions

 TypeWalker (Compiler &compiler)
 
void body_statement (ast::Stmt &)
 
void body_expression (ast::Expr &)
 
void resolve_queue ()
 
auto make_dup (ast::AnyExpr &expr) -> Fn *
 
template<>
void expression (ast::NumberExpr &expr)
 
template<>
void expression (ast::StringExpr &expr)
 
template<>
void expression (ast::CharExpr &expr)
 
template<>
void expression (ast::BoolExpr &expr)
 
template<>
void expression (ast::Type &expr)
 
template<>
void expression (ast::TypeName &expr)
 
template<>
void expression (ast::ImplicitCastExpr &expr)
 
template<>
void expression (ast::CtorExpr &expr)
 
template<>
void expression (ast::SliceExpr &expr)
 
template<>
void expression (ast::LambdaExpr &expr)
 
template<>
void expression (ast::AssignExpr &expr)
 
template<>
void expression (ast::VarExpr &expr)
 
template<>
void expression (ast::ConstExpr &expr)
 
template<>
void expression (ast::FieldAccessExpr &expr)
 
template<>
void expression (ast::CallExpr &expr)
 
template<>
void expression (ast::BinaryLogicExpr &expr)
 
template<>
void expression (ast::TypeExpr &expr)
 
template<>
void statement (ast::Compound &stat)
 
template<>
void statement (ast::StructDecl &stat)
 
template<>
void statement (ast::FnDecl &stat)
 
template<>
void statement (ast::CtorDecl &stat)
 
template<>
void statement (ast::ReturnStmt &stat)
 
template<>
void statement (ast::VarDecl &stat)
 
template<>
void statement (ast::ConstDecl &stat)
 
template<>
void statement (ast::IfStmt &stat)
 
template<>
void statement (ast::WhileStmt &stat)
 
- Public Member Functions inherited from yume::CRTPWalker< TypeWalker >
auto body_statement (ast::Stmt &stat, auto &&... args)
 
auto body_expression (ast::Expr &expr, auto &&... args)
 

Public Attributes

friend CRTPWalker
 
Compilercompiler
 
DeclLike current_decl {}
 
scope_t scope {}
 
vector< scope_tenclosing_scopes {}
 
vector< ASTWithNameclosured {}
 
std::queue< DeclLikedecl_queue {}
 
bool in_depth = false
 Whether or not to compile the bodies of methods. Initially, on the parameter types of methods are traversed and converted, then everything else in a second pass. More...
 

Detailed Description

Determine the type information of AST nodes. This makes up most of the "semantic" phase of the compiler.

Definition at line 33 of file type_walker.hpp.

Member Typedef Documentation

◆ scope_t

Definition at line 44 of file type_walker.hpp.

Constructor & Destructor Documentation

◆ TypeWalker()

yume::semantic::TypeWalker::TypeWalker ( Compiler compiler)
inlineexplicit

Definition at line 55 of file type_walker.hpp.

Member Function Documentation

◆ body_expression()

void yume::semantic::TypeWalker::body_expression ( ast::Expr expr)

◆ body_statement()

void yume::semantic::TypeWalker::body_statement ( ast::Stmt stat)

◆ expression() [1/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::AssignExpr expr)

◆ expression() [2/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::BinaryLogicExpr expr)

◆ expression() [3/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::BoolExpr expr)

Definition at line 83 of file type_walker.cpp.

References yume::TypeHolder::bool_type, compiler, and yume::ast::AST::val_ty().

◆ expression() [4/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::CallExpr expr)

◆ expression() [5/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::CharExpr expr)

Definition at line 81 of file type_walker.cpp.

References compiler, yume::TypeHolder::int8(), and yume::ast::AST::val_ty().

◆ expression() [6/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::ConstExpr expr)

Definition at line 395 of file type_walker.cpp.

References compiler, yume::ast::ConstExpr::name, and yume::ast::AST::val_ty().

◆ expression() [7/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::CtorExpr expr)

◆ expression() [8/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::FieldAccessExpr expr)

◆ expression() [9/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::ImplicitCastExpr expr)

Definition at line 97 of file type_walker.cpp.

References yume::ast::ImplicitCastExpr::base, and body_expression().

◆ expression() [10/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::LambdaExpr expr)

◆ expression() [11/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::NumberExpr expr)

◆ expression() [12/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::SliceExpr expr)

◆ expression() [13/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::StringExpr expr)

Definition at line 76 of file type_walker.cpp.

References compiler, yume::TypeHolder::int8(), and yume::ast::AST::val_ty().

◆ expression() [14/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::Type expr)

Definition at line 85 of file type_walker.cpp.

References yume::ast::AST::val_ty().

◆ expression() [15/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::TypeExpr expr)

◆ expression() [16/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::TypeName expr)

Definition at line 91 of file type_walker.cpp.

References yume::ast::AST::attach_to(), and yume::ast::TypeName::type.

◆ expression() [17/17]

template<>
void yume::semantic::TypeWalker::expression ( ast::VarExpr expr)

◆ make_dup()

auto yume::semantic::TypeWalker::make_dup ( ast::AnyExpr expr) -> Fn*

◆ resolve_queue()

void yume::semantic::TypeWalker::resolve_queue ( )

Definition at line 877 of file type_walker.cpp.

References compiler, decl_queue, yume::Compiler::declare(), and in_depth.

Referenced by expression().

◆ statement() [1/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::Compound stat)

◆ statement() [2/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::ConstDecl stat)

◆ statement() [3/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::CtorDecl stat)

◆ statement() [4/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::FnDecl stat)

◆ statement() [5/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::IfStmt stat)

◆ statement() [6/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::ReturnStmt stat)

◆ statement() [7/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::StructDecl stat)

◆ statement() [8/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::VarDecl stat)

◆ statement() [9/9]

template<>
void yume::semantic::TypeWalker::statement ( ast::WhileStmt stat)

Member Data Documentation

◆ closured

vector<ASTWithName> yume::semantic::TypeWalker::closured {}

Definition at line 47 of file type_walker.hpp.

Referenced by expression().

◆ compiler

Compiler& yume::semantic::TypeWalker::compiler

Definition at line 42 of file type_walker.hpp.

Referenced by expression(), resolve_queue(), and statement().

◆ CRTPWalker

friend yume::semantic::TypeWalker::CRTPWalker

Definition at line 34 of file type_walker.hpp.

◆ current_decl

DeclLike yume::semantic::TypeWalker::current_decl {}

Definition at line 43 of file type_walker.hpp.

Referenced by expression(), and statement().

◆ decl_queue

std::queue<DeclLike> yume::semantic::TypeWalker::decl_queue {}

Definition at line 49 of file type_walker.hpp.

Referenced by expression(), and resolve_queue().

◆ enclosing_scopes

vector<scope_t> yume::semantic::TypeWalker::enclosing_scopes {}

Definition at line 46 of file type_walker.hpp.

Referenced by expression().

◆ in_depth

bool yume::semantic::TypeWalker::in_depth = false

Whether or not to compile the bodies of methods. Initially, on the parameter types of methods are traversed and converted, then everything else in a second pass.

Definition at line 53 of file type_walker.hpp.

Referenced by expression(), resolve_queue(), and statement().

◆ scope

scope_t yume::semantic::TypeWalker::scope {}

Definition at line 45 of file type_walker.hpp.

Referenced by expression(), and statement().


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