MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::ast::LamDecl Class Reference

tag dbg dom_0 ... dom_n-1: codom = body; with LamDecl::tag lam/con/fun or anonymous λ/cn/fn. More...

#include <mim/ast/ast.h>

Inheritance diagram for mim::ast::LamDecl:
[legend]

Classes

class  Dom
 One dom of a LamDecl: ptrn@(filter) with an optional : ret type. More...

Public Types

using VLA_Types = std::tuple<Ptr<Dom>>

Public Member Functions

 LamDecl (Loc loc, Mods mods, Tok::Tag tag, Dbg dbg, Ptr< Expr > codom, Ptr< Expr > body, const NomDecl *nom_sugar)
Tok::Tag tag () const
auto doms () const
const Dom * dom (size_t i) const
size_t num_doms () const
const Expr * codom () const
const NomDecl * nom_sugar () const
 The nom of lam I dom+ = nom I = e; I if nom I dom+ = e desugared to this; within e, I is this LamDecl.
void bind_decl (Scopes &) const override
void bind_body (Scopes &) const override
void emit_decl (Emitter &) const override
void emit_body (Emitter &) const override
void stream_ (fe::Tab &, std::ostream &) const override
 Streams this declaration without modifiers and without the trailing ;.
Public Member Functions inherited from mim::ast::RecDecl
 RecDecl (Loc loc, Mods mods, Dbg dbg, Ptr< Expr > body)
Dbg dbg () const override
 The name this Decl introduces; anonymous if it has none.
const Expr * body () const
bool has_mut_body () const
 Only such a body is emitted as a mutable, so only it may refer to the declaration itself.
void bind (Scopes &) const override
void emit (Emitter &) const override
void stream (fe::Tab &, std::ostream &) const override
std::pair< AnnexInfo *, sub_t > annex_sub () const override
 The (AnnexInfo, sub) slot this decl registered itself under as an annex; {nullptr, 0} if it isn't one.
Public Member Functions inherited from mim::ast::ValDecl
Vis vis () const override
 A ValDecl's own Vis; Pub for anything else (Ptrn, Import, ...), which the priv/pub system ignores.
bool is_extern () const override
 Whether this decl crosses the Mim/native boundary (extern); body presence picks which side supplies it.
bool is_anx () const override
 Whether this decl is registered as a compiler-exposed annex (anx).
const Mods & mods () const
Public Member Functions inherited from mim::ast::Decl
const Def * def () const
virtual const Scope * scope () const
 Non-nullptr if this Decl is a module whose members a Path may walk into.
Public Member Functions inherited from mim::ast::Node
Loc loc () const
void dump () const

Additional Inherited Members

Protected Member Functions inherited from mim::ast::ValDecl
 ValDecl (Loc loc, Mods mods={})
Protected Member Functions inherited from mim::ast::Decl
 Decl (Loc loc)
Protected Member Functions inherited from mim::ast::Node
 Node (Loc loc)
Protected Attributes inherited from mim::ast::RecDecl
AnnexInfo * annex_ = nullptr
sub_t sub_ = 0
Protected Attributes inherited from mim::ast::Decl
const Def * def_ = nullptr

Detailed Description

tag dbg dom_0 ... dom_n-1: codom = body; with LamDecl::tag lam/con/fun or anonymous λ/cn/fn.

Definition at line 1195 of file ast.h.

Member Typedef Documentation

◆ VLA_Types

using mim::ast::LamDecl::VLA_Types = std::tuple<Ptr<Dom>>

Definition at line 1220 of file ast.h.

Constructor & Destructor Documentation

◆ LamDecl()

mim::ast::LamDecl::LamDecl ( Loc loc,
Mods mods,
Tok::Tag tag,
Dbg dbg,
Ptr< Expr > codom,
Ptr< Expr > body,
const NomDecl * nom_sugar )
inline

Member Function Documentation

◆ bind_body()

void mim::ast::LamDecl::bind_body ( Scopes & s) const
overridevirtual

Reimplemented from mim::ast::RecDecl.

Definition at line 583 of file bind.cpp.

References mim::ast::RecDecl::body(), dom(), doms(), and nom_sugar().

◆ bind_decl()

void mim::ast::LamDecl::bind_decl ( Scopes & s) const
overridevirtual

◆ codom()

const Expr * mim::ast::LamDecl::codom ( ) const
inline

Definition at line 1232 of file ast.h.

Referenced by bind_decl(), emit_decl(), LamDecl(), and stream_().

◆ dom()

const Dom * mim::ast::LamDecl::dom ( size_t i) const
inline

Definition at line 1230 of file ast.h.

References doms().

Referenced by bind_body(), bind_decl(), emit_body(), emit_decl(), and stream_().

◆ doms()

auto mim::ast::LamDecl::doms ( ) const
inline

Definition at line 1229 of file ast.h.

Referenced by bind_body(), bind_decl(), dom(), emit_body(), emit_decl(), num_doms(), and stream_().

◆ emit_body()

◆ emit_decl()

void mim::ast::LamDecl::emit_decl ( Emitter & e) const
overridevirtual

◆ nom_sugar()

const NomDecl * mim::ast::LamDecl::nom_sugar ( ) const
inline

The nom of lam I dom+ = nom I = e; I if nom I dom+ = e desugared to this; within e, I is this LamDecl.

Definition at line 1234 of file ast.h.

Referenced by bind_body(), bind_decl(), emit_body(), LamDecl(), and stream_().

◆ num_doms()

size_t mim::ast::LamDecl::num_doms ( ) const
inline

Definition at line 1231 of file ast.h.

References doms().

Referenced by emit_body(), and emit_decl().

◆ stream_()

void mim::ast::LamDecl::stream_ ( fe::Tab & tab,
std::ostream & os ) const
overridevirtual

Streams this declaration without modifiers and without the trailing ;.

Reimplemented from mim::ast::RecDecl.

Definition at line 352 of file stream.cpp.

References mim::ast::RecDecl::body(), codom(), mim::ast::RecDecl::dbg(), dom(), doms(), mim::ast::is_block(), nom_sugar(), mim::ast::S::S(), and tag().

◆ tag()

Tok::Tag mim::ast::LamDecl::tag ( ) const
inline

Definition at line 1228 of file ast.h.

Referenced by bind_decl(), LamDecl(), and stream_().


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