Yume
Classes | Functions | Variables
yume::semantic Namespace Reference

Classes

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

Functions

static auto join_args (const auto &iter, auto fn, llvm::raw_ostream &stream=errs())
 
static auto overload_name (const ast::AST *ast) -> std::string
 
static auto overload_receiver (const ast::AST *ast) -> optional< ty::Type >
 
static auto literal_cast (ast::AST &arg, ty::Type target_type) -> ty::Compat
 
auto parameter_count_matches (const vector< ast::AST * > &args, const Fn &fn) -> bool
 
static auto generic_base (optional< ty::Type > type) -> optional< ty::Type >
 
static auto cmp (bool a, bool b) -> std::strong_ordering
 
static auto compare_implicit_conversions (ty::Conv a, ty::Conv b) -> std::weak_ordering
 
void wrap_in_implicit_cast (ast::OptionalExpr &expr, ty::Conv conv, optional< ty::Type > target_type)
 
auto try_implicit_conversion (ast::OptionalExpr &expr, optional< ty::Type > target_ty) -> bool
 
void make_implicit_conversion (ast::OptionalExpr &expr, optional< ty::Type > target_ty)
 
static auto for_all_instantiations (std::deque< Struct > &structs, std::invocable< Struct & > auto fn)
 
static auto find_field_ast (const ty::Struct &st, string_view target_name) -> std::pair< nullable< ast::AnyType * >, int >
 
static auto find_field (const ty::Struct &st, string_view target_name) -> std::pair< optional< ty::Type >, int >
 

Variables

static constexpr auto get_val_ty = [](const ast::AST* ast) { return ast->val_ty(); }
 
static constexpr auto indirect = [](const ty::Type& ty) { return &ty; }
 

Function Documentation

◆ cmp()

static auto yume::semantic::cmp ( bool  a,
bool  b 
) -> std::strong_ordering
static

Definition at line 247 of file overload.cpp.

Referenced by compare_implicit_conversions().

◆ compare_implicit_conversions()

static auto yume::semantic::compare_implicit_conversions ( ty::Conv  a,
ty::Conv  b 
) -> std::weak_ordering
static

Definition at line 249 of file overload.cpp.

References cmp().

Referenced by yume::semantic::Overload::better_candidate_than().

◆ find_field()

static auto yume::semantic::find_field ( const ty::Struct st,
string_view  target_name 
) -> std::pair<optional<ty::Type>, int>
static

Definition at line 419 of file type_walker.cpp.

References find_field_ast().

Referenced by yume::semantic::TypeWalker::expression().

◆ find_field_ast()

static auto yume::semantic::find_field_ast ( const ty::Struct st,
string_view  target_name 
) -> std::pair<nullable<ast::AnyType*>, int>
static

Definition at line 402 of file type_walker.cpp.

Referenced by find_field().

◆ for_all_instantiations()

static auto yume::semantic::for_all_instantiations ( std::deque< Struct > &  structs,
std::invocable< Struct & > auto  fn 
)
inlinestatic

◆ generic_base()

static auto yume::semantic::generic_base ( optional< ty::Type type) -> optional<ty::Type>
static

Definition at line 110 of file overload.cpp.

Referenced by yume::semantic::OverloadSet::is_valid_overload().

◆ join_args()

static auto yume::semantic::join_args ( const auto &  iter,
auto  fn,
llvm::raw_ostream &  stream = errs() 
)
static

◆ literal_cast()

static auto yume::semantic::literal_cast ( ast::AST arg,
ty::Type  target_type 
) -> ty::Compat
static

◆ make_implicit_conversion()

void yume::semantic::make_implicit_conversion ( ast::OptionalExpr expr,
optional< ty::Type target_ty 
)

◆ overload_name()

static auto yume::semantic::overload_name ( const ast::AST ast) -> std::string
static

◆ overload_receiver()

static auto yume::semantic::overload_receiver ( const ast::AST ast) -> optional<ty::Type>
static

Definition at line 38 of file overload.cpp.

Referenced by yume::semantic::OverloadSet::is_valid_overload().

◆ parameter_count_matches()

auto yume::semantic::parameter_count_matches ( const vector< ast::AST * > &  args,
const Fn fn 
) -> bool

Definition at line 99 of file overload.cpp.

Referenced by yume::semantic::OverloadSet::is_valid_overload().

◆ try_implicit_conversion()

auto yume::semantic::try_implicit_conversion ( ast::OptionalExpr expr,
optional< ty::Type target_ty 
) -> bool
inline

Definition at line 38 of file type_walker.cpp.

References wrap_in_implicit_cast().

Referenced by make_implicit_conversion().

◆ wrap_in_implicit_cast()

void yume::semantic::wrap_in_implicit_cast ( ast::OptionalExpr expr,
ty::Conv  conv,
optional< ty::Type target_type 
)
inline

Variable Documentation

◆ get_val_ty

constexpr auto yume::semantic::get_val_ty = [](const ast::AST* ast) { return ast->val_ty(); }
inlinestaticconstexpr

◆ indirect

constexpr auto yume::semantic::indirect = [](const ty::Type& ty) { return &ty; }
inlinestaticconstexpr

Definition at line 19 of file overload.cpp.

Referenced by yume::semantic::Overload::dump().