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

nom dbg = body; - a nominal newtype. More...

#include <mim/ast/ast.h>

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

Public Member Functions

 NomDecl (Loc loc, Mods mods, Dbg dbg, Ptr< Expr > body)
Vis rep_vis () const
 The visibility of this nom's representation: that of the enclosing top-level declaration.
void bind_body (Scopes &) const override
void emit_decl (Emitter &) const override
void emit_body (Emitter &) const override
const Def * emit_ahead (Emitter &) const
 Emits a nom without a mutable body as soon as a sibling refers to it; nullptr on a cycle.
void emit_sugar (Emitter &, Lam *lam) const
 Sets lam's body to this LamDecl::nom_sugar before emitting the latter's body.
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
virtual void bind_decl (Scopes &) const
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

nom dbg = body; - a nominal newtype.

Definition at line 1170 of file ast.h.

Constructor & Destructor Documentation

◆ NomDecl()

mim::ast::NomDecl::NomDecl ( Loc loc,
Mods mods,
Dbg dbg,
Ptr< Expr > body )
inline

Member Function Documentation

◆ bind_body()

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

Reimplemented from mim::ast::RecDecl.

Definition at line 542 of file bind.cpp.

References mim::ast::RecDecl::bind_body(), and mim::ast::Pub.

◆ emit_ahead()

const Def * mim::ast::NomDecl::emit_ahead ( Emitter & e) const

Emits a nom without a mutable body as soon as a sibling refers to it; nullptr on a cycle.

Definition at line 992 of file emit.cpp.

References mim::ast::Decl::def_, emit_body(), and mim::ast::RecDecl::has_mut_body().

Referenced by emit_sugar().

◆ emit_body()

◆ emit_decl()

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

Reimplemented from mim::ast::RecDecl.

Definition at line 974 of file emit.cpp.

References mim::ast::RecDecl::body(), emit_decl(), mim::ast::RecDecl::has_mut_body(), and mim::ast::Node::loc().

Referenced by emit_decl(), and emit_sugar().

◆ emit_sugar()

void mim::ast::NomDecl::emit_sugar ( Emitter & e,
Lam * lam ) const

Sets lam's body to this LamDecl::nom_sugar before emitting the latter's body.

Definition at line 997 of file emit.cpp.

References emit_ahead(), emit_body(), emit_decl(), and mim::Lam::set_body().

◆ rep_vis()

Vis mim::ast::NomDecl::rep_vis ( ) const
inline

The visibility of this nom's representation: that of the enclosing top-level declaration.

Definition at line 1176 of file ast.h.

Referenced by mim::ast::Emitter::add_nom().

◆ stream_()

void mim::ast::NomDecl::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 326 of file stream.cpp.

References mim::ast::RecDecl::body(), mim::ast::RecDecl::dbg(), and mim::ast::S::S().


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