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

rec dbg = body; More...

#include <mim/ast/ast.h>

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

Public Member Functions

 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
virtual void bind_body (Scopes &) const
void emit (Emitter &) const override
virtual void emit_decl (Emitter &) const
virtual void emit_body (Emitter &) const
void stream (fe::Tab &, std::ostream &) const override
virtual void stream_ (fe::Tab &, std::ostream &) const
 Streams this declaration without modifiers and without the trailing ;.
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

Protected Attributes

AnnexInfo * annex_ = nullptr
sub_t sub_ = 0
Protected Attributes inherited from mim::ast::Decl
const Def * def_ = nullptr

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)

Detailed Description

rec dbg = body;

Definition at line 1135 of file ast.h.

Constructor & Destructor Documentation

◆ RecDecl()

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

Member Function Documentation

◆ annex_sub()

std::pair< AnnexInfo *, sub_t > mim::ast::RecDecl::annex_sub ( ) const
inlineoverridevirtual

The (AnnexInfo, sub) slot this decl registered itself under as an annex; {nullptr, 0} if it isn't one.

Reimplemented from mim::ast::Decl.

Definition at line 1158 of file ast.h.

References annex_, and sub_.

◆ bind()

void mim::ast::RecDecl::bind ( Scopes & s) const
overridevirtual

Implements mim::ast::ValDecl.

Definition at line 506 of file bind.cpp.

References bind_body(), and bind_decl().

◆ bind_body()

void mim::ast::RecDecl::bind_body ( Scopes & s) const
virtual

Reimplemented in mim::ast::LamDecl, and mim::ast::NomDecl.

Definition at line 540 of file bind.cpp.

References body().

Referenced by bind(), and mim::ast::NomDecl::bind_body().

◆ bind_decl()

void mim::ast::RecDecl::bind_decl ( Scopes & s) const
virtual

Reimplemented in mim::ast::LamDecl.

Definition at line 529 of file bind.cpp.

References annex_, body(), dbg(), has_mut_body(), mim::ast::ValDecl::is_anx(), mim::ast::Node::loc(), and sub_.

Referenced by bind().

◆ body()

◆ dbg()

Dbg mim::ast::RecDecl::dbg ( ) const
inlineoverridevirtual

◆ emit()

void mim::ast::RecDecl::emit ( Emitter & e) const
overridevirtual

Implements mim::ast::ValDecl.

Definition at line 949 of file emit.cpp.

References emit_body(), and emit_decl().

Referenced by mim::ast::LamDecl::emit_body(), and mim::ast::NomDecl::emit_body().

◆ emit_body()

void mim::ast::RecDecl::emit_body ( Emitter & e) const
virtual

Reimplemented in mim::ast::LamDecl, and mim::ast::NomDecl.

Definition at line 967 of file emit.cpp.

References annex_, body(), dbg(), mim::ast::Decl::def_, mim::ast::Node::loc(), and sub_.

Referenced by emit().

◆ emit_decl()

void mim::ast::RecDecl::emit_decl ( Emitter & e) const
virtual

Reimplemented in mim::ast::LamDecl, and mim::ast::NomDecl.

Definition at line 961 of file emit.cpp.

References body(), dbg(), mim::ast::Decl::def_, and mim::ast::Node::loc().

Referenced by emit().

◆ has_mut_body()

bool mim::ast::RecDecl::has_mut_body ( ) const

Only such a body is emitted as a mutable, so only it may refer to the declaration itself.

Definition at line 524 of file bind.cpp.

References body(), and mim::ast::InfixExpr::isa_op().

Referenced by bind_decl(), mim::ast::NomDecl::emit_ahead(), mim::ast::NomDecl::emit_body(), and mim::ast::NomDecl::emit_decl().

◆ stream()

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

Implements mim::ast::Node.

Definition at line 319 of file stream.cpp.

References mim::ast::ValDecl::mods(), and stream_().

◆ stream_()

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

Streams this declaration without modifiers and without the trailing ;.

Reimplemented in mim::ast::LamDecl, and mim::ast::NomDecl.

Definition at line 325 of file stream.cpp.

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

Referenced by stream().

Member Data Documentation

◆ annex_

AnnexInfo* mim::ast::RecDecl::annex_ = nullptr
mutableprotected

◆ sub_

sub_t mim::ast::RecDecl::sub_ = 0
mutableprotected

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