|
Yume
|
Determine the type information of AST nodes. This makes up most of the "semantic" phase of the compiler. More...
#include <type_walker.hpp>


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 |
| Compiler & | compiler |
| DeclLike | current_decl {} |
| scope_t | scope {} |
| vector< scope_t > | enclosing_scopes {} |
| vector< ASTWithName > | closured {} |
| std::queue< DeclLike > | decl_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... | |
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.
Definition at line 44 of file type_walker.hpp.
|
inlineexplicit |
Definition at line 55 of file type_walker.hpp.
| void yume::semantic::TypeWalker::body_expression | ( | ast::Expr & | expr | ) |
Definition at line 760 of file type_walker.cpp.
References yume::CRTPWalker< Derived >::body_expression(), and yume::ast::AST::kind_name().
Referenced by expression(), and statement().
| void yume::semantic::TypeWalker::body_statement | ( | ast::Stmt & | stat | ) |
Definition at line 756 of file type_walker.cpp.
References yume::CRTPWalker< Derived >::body_statement(), and yume::ast::AST::kind_name().
Referenced by expression(), and statement().
| void yume::semantic::TypeWalker::expression | ( | ast::AssignExpr & | expr | ) |
Definition at line 367 of file type_walker.cpp.
References yume::ast::AST::attach_to(), body_expression(), yume::semantic::make_implicit_conversion(), yume::ast::AnyBase< T >::raw_ptr(), yume::ast::AssignExpr::target, and yume::ast::AssignExpr::value.
| void yume::semantic::TypeWalker::expression | ( | ast::BinaryLogicExpr & | expr | ) |
Definition at line 590 of file type_walker.cpp.
References body_expression(), yume::TypeHolder::bool_type, compiler, yume::ast::BinaryLogicExpr::lhs, yume::ast::BinaryLogicExpr::rhs, yume::ast::AST::val_ty(), and YUME_ASSERT.
| 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().
| void yume::semantic::TypeWalker::expression | ( | ast::CallExpr & | expr | ) |
Definition at line 483 of file type_walker.cpp.
References yume::ast::CallExpr::args, yume::ast::AST::attach_to(), body_expression(), body_statement(), yume::semantic::Overload::compatibilities, current_decl, decl_queue, yume::semantic::Overload::dump(), yume::semantic::Overload::fn, yume::Fn::get_or_create_instantiation(), yume::ast::OptionalAnyBase< T >::has_value(), in_depth, yume::ast::CallExpr::name, yume::ast::CallExpr::receiver, resolve_queue(), yume::ast::CallExpr::selected_overload, yume::semantic::Overload::subs, yume::semantic::wrap_in_implicit_cast(), and YUME_ASSERT.
| 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().
| 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().
| void yume::semantic::TypeWalker::expression | ( | ast::CtorExpr & | expr | ) |
Definition at line 107 of file type_walker.cpp.
References yume::ast::CtorExpr::args, body_expression(), body_statement(), compiler, current_decl, decl_queue, yume::semantic::for_all_instantiations(), in_depth, resolve_queue(), yume::ast::CtorExpr::selected_overload, yume::ast::CtorExpr::type, yume::ast::AST::val_ty(), yume::semantic::wrap_in_implicit_cast(), and YUME_ASSERT.
| void yume::semantic::TypeWalker::expression | ( | ast::FieldAccessExpr & | expr | ) |
Definition at line 428 of file type_walker.cpp.
References yume::ast::FieldAccessExpr::base, body_expression(), current_decl, yume::ast::FieldAccessExpr::field, yume::semantic::find_field(), yume::ast::OptionalAnyBase< T >::has_value(), yume::semantic::make_implicit_conversion(), yume::ast::FieldAccessExpr::offset, yume::DeclLike::self_ty(), and yume::ast::AST::val_ty().
| 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().
| void yume::semantic::TypeWalker::expression | ( | ast::LambdaExpr & | expr | ) |
Definition at line 311 of file type_walker.cpp.
References yume::ast::LambdaExpr::args, yume::ast::LambdaExpr::body, body_statement(), yume::ScopeContainer< T >::clear(), closured, yume::ast::LambdaExpr::closured_names, yume::ast::LambdaExpr::closured_nodes, compiler, enclosing_scopes, yume::TypeHolder::find_or_create_fn_type(), yume::ast::OptionalAnyBase< T >::has_value(), yume::ScopeContainer< T >::push_scope_guarded(), yume::ast::LambdaExpr::ret, scope, and yume::ast::AST::val_ty().
| void yume::semantic::TypeWalker::expression | ( | ast::NumberExpr & | expr | ) |
Definition at line 68 of file type_walker.cpp.
References compiler, yume::TypeHolder::int32(), yume::TypeHolder::int64(), yume::ast::NumberExpr::val, and yume::ast::AST::val_ty().
| void yume::semantic::TypeWalker::expression | ( | ast::SliceExpr & | expr | ) |
Definition at line 299 of file type_walker.cpp.
References yume::ast::SliceExpr::args, body_expression(), yume::ast::SliceExpr::type, and yume::ast::AST::val_ty().
| 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().
| void yume::semantic::TypeWalker::expression | ( | ast::Type & | expr | ) |
Definition at line 85 of file type_walker.cpp.
References yume::ast::AST::val_ty().
| void yume::semantic::TypeWalker::expression | ( | ast::TypeExpr & | expr | ) |
Definition at line 600 of file type_walker.cpp.
References yume::ty::Type::is_unqualified(), yume::ty::Type::known_meta(), yume::ast::TypeExpr::type, yume::ast::AST::val_ty(), and YUME_ASSERT.
| 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.
| void yume::semantic::TypeWalker::expression | ( | ast::VarExpr & | expr | ) |
Definition at line 377 of file type_walker.cpp.
References yume::ScopeContainer< T >::add_to_front(), yume::ast::AST::attach_to(), closured, enclosing_scopes, yume::ScopeContainer< T >::find(), yume::ast::VarExpr::name, and scope.
| auto yume::semantic::TypeWalker::make_dup | ( | ast::AnyExpr & | expr | ) | -> Fn* |
Definition at line 204 of file type_walker.cpp.
References yume::semantic::for_all_instantiations(), yume::Struct::name(), yume::semantic::wrap_in_implicit_cast(), and YUME_ASSERT.
| 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().
| void yume::semantic::TypeWalker::statement | ( | ast::Compound & | stat | ) |
Definition at line 607 of file type_walker.cpp.
References body_statement(), yume::ScopeContainer< T >::push_scope_guarded(), and scope.
| void yume::semantic::TypeWalker::statement | ( | ast::ConstDecl & | stat | ) |
Definition at line 730 of file type_walker.cpp.
References body_expression(), in_depth, yume::ast::ConstDecl::init, yume::semantic::make_implicit_conversion(), yume::ast::AnyBase< T >::raw_ptr(), yume::ast::ConstDecl::type, and yume::ast::AST::val_ty().
| void yume::semantic::TypeWalker::statement | ( | ast::CtorDecl & | stat | ) |
Definition at line 660 of file type_walker.cpp.
References yume::ScopeContainer< T >::add(), yume::ast::CtorDecl::args, yume::ast::CtorDecl::body, yume::ScopeContainer< T >::clear(), compiler, current_decl, yume::TypeHolder::find_or_create_fn_ptr_type(), yume::DeclLike::fully_substituted(), in_depth, yume::ScopeContainer< T >::push_scope_guarded(), scope, yume::DeclLike::self_ty(), yume::ScopeContainer< T >::size(), yume::ast::AST::val_ty(), and YUME_ASSERT.
| void yume::semantic::TypeWalker::statement | ( | ast::FnDecl & | stat | ) |
Definition at line 629 of file type_walker.cpp.
References yume::ScopeContainer< T >::add(), yume::ast::FnDecl::args, yume::ast::AST::attach_to(), yume::ast::FnDecl::body, yume::ScopeContainer< T >::clear(), compiler, current_decl, yume::TypeHolder::find_or_create_fn_ptr_type(), yume::DeclLike::fully_substituted(), yume::ast::OptionalAnyBase< T >::has_value(), in_depth, yume::ScopeContainer< T >::push_scope_guarded(), yume::ast::OptionalAnyBase< T >::raw_ptr(), yume::ast::FnDecl::ret, scope, yume::ScopeContainer< T >::size(), yume::ast::FnDecl::varargs, and YUME_ASSERT.
| void yume::semantic::TypeWalker::statement | ( | ast::IfStmt & | stat | ) |
Definition at line 741 of file type_walker.cpp.
References body_expression(), yume::ast::IfStmt::clauses, and yume::ast::IfStmt::else_clause.
| void yume::semantic::TypeWalker::statement | ( | ast::ReturnStmt & | stat | ) |
Definition at line 694 of file type_walker.cpp.
References yume::DeclLike::ast(), body_expression(), current_decl, yume::ast::ReturnStmt::expr, yume::ast::ReturnStmt::extends_lifetime, yume::ScopeContainer< T >::find(), yume::ast::OptionalAnyBase< T >::has_value(), yume::semantic::make_implicit_conversion(), yume::ast::OptionalAnyBase< T >::raw_ptr(), and scope.
| void yume::semantic::TypeWalker::statement | ( | ast::StructDecl & | stat | ) |
Definition at line 613 of file type_walker.cpp.
References current_decl, yume::ast::StructDecl::fields, yume::DeclLike::fully_substituted(), yume::ast::StructDecl::implements, and yume::ast::StructDecl::type_args.
| void yume::semantic::TypeWalker::statement | ( | ast::VarDecl & | stat | ) |
Definition at line 712 of file type_walker.cpp.
References yume::ScopeContainer< T >::add(), body_expression(), yume::ast::OptionalAnyBase< T >::has_value(), yume::ast::VarDecl::init, yume::semantic::make_implicit_conversion(), yume::ast::VarDecl::name, yume::ast::OptionalAnyBase< T >::raw_ptr(), scope, yume::ast::VarDecl::type, and yume::ast::AST::val_ty().
| void yume::semantic::TypeWalker::statement | ( | ast::WhileStmt & | stat | ) |
Definition at line 751 of file type_walker.cpp.
References yume::ast::WhileStmt::body, body_expression(), and yume::ast::WhileStmt::cond.
| vector<ASTWithName> yume::semantic::TypeWalker::closured {} |
Definition at line 47 of file type_walker.hpp.
Referenced by expression().
| Compiler& yume::semantic::TypeWalker::compiler |
Definition at line 42 of file type_walker.hpp.
Referenced by expression(), resolve_queue(), and statement().
| friend yume::semantic::TypeWalker::CRTPWalker |
Definition at line 34 of file type_walker.hpp.
| DeclLike yume::semantic::TypeWalker::current_decl {} |
Definition at line 43 of file type_walker.hpp.
Referenced by expression(), and statement().
| std::queue<DeclLike> yume::semantic::TypeWalker::decl_queue {} |
Definition at line 49 of file type_walker.hpp.
Referenced by expression(), and resolve_queue().
| vector<scope_t> yume::semantic::TypeWalker::enclosing_scopes {} |
Definition at line 46 of file type_walker.hpp.
Referenced by expression().
| 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_t yume::semantic::TypeWalker::scope {} |
Definition at line 45 of file type_walker.hpp.
Referenced by expression(), and statement().