MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::ast::Ptrn Class Referenceabstract

Base class of all patterns. More...

#include <mim/ast/ast.h>

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

Public Member Functions

 Ptrn (Loc loc)
virtual bool is_implicit () const
virtual void bind (Scopes &, bool rebind, bool quiet) const =0
virtual const Defemit_value (Emitter &, const Def *) const =0
virtual const Defemit_type (Emitter &) const =0
const Defemit_proj (Emitter &, const Def *def, size_t n, size_t i) const
 Ptrn::emit_value on def's i-th of n projections - with this Ptrn's Loc, so the projection is blamed on the binder it introduces instead of on the enclosing pattern.
Public Member Functions inherited from mim::ast::Decl
const Defdef () const
virtual Dbg dbg () const
 The name this Decl introduces; anonymous if it has none.
virtual const Scopescope () const
 Non-nullptr if this Decl is a module whose members a Path may walk into.
virtual std::pair< AnnexInfo *, sub_tannex_sub () const
 The (AnnexInfo, sub) slot this decl registered itself under as an annex; {nullptr, 0} if it isn't one.
virtual Vis vis () const
 A ValDecl's own Vis; Pub for anything else (Ptrn, Import, ...), which the priv/pub system ignores.
virtual bool is_extern () const
 Whether this decl crosses the Mim/native boundary (extern); body presence picks which side supplies it.
virtual bool is_anx () const
 Whether this decl is registered as a compiler-exposed annex (anx).
Public Member Functions inherited from mim::ast::Node
Loc loc () const
virtual void stream (fe::Tab &, std::ostream &) const =0
void dump () const

Static Public Member Functions

static Ptr< Exprto_expr (AST &, Ptr< Ptrn >)

Additional Inherited Members

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::Decl
const Defdef_ = nullptr

Detailed Description

Base class of all patterns.

Definition at line 280 of file ast.h.

Constructor & Destructor Documentation

◆ Ptrn()

Member Function Documentation

◆ bind()

virtual void mim::ast::Ptrn::bind ( Scopes & ,
bool rebind,
bool quiet ) const
pure virtual

◆ emit_proj()

const Def * mim::ast::Ptrn::emit_proj ( Emitter & e,
const Def * def,
size_t n,
size_t i ) const

Ptrn::emit_value on def's i-th of n projections - with this Ptrn's Loc, so the projection is blamed on the binder it introduces instead of on the enclosing pattern.

Definition at line 79 of file emit.cpp.

References mim::ast::Decl::def(), emit_value(), mim::ast::Node::loc(), and mim::Def::proj().

Referenced by mim::ast::TuplePtrn::emit_body(), emit_type(), and mim::ast::TuplePtrn::emit_value().

◆ emit_type()

virtual const Def * mim::ast::Ptrn::emit_type ( Emitter & ) const
pure virtual

◆ emit_value()

virtual const Def * mim::ast::Ptrn::emit_value ( Emitter & ,
const Def *  ) const
pure virtual

◆ is_implicit()

virtual bool mim::ast::Ptrn::is_implicit ( ) const
inlinevirtual

Reimplemented in mim::ast::AliasPtrn, and mim::ast::TuplePtrn.

Definition at line 285 of file ast.h.

Referenced by mim::ast::AliasPtrn::is_implicit(), and mim::ast::LamDecl::Dom::is_implicit().

◆ to_expr()

Ptr< Expr > mim::ast::Ptrn::to_expr ( AST & ast,
Ptr< Ptrn > ptrn )
staticnodiscard

Definition at line 191 of file ast.cpp.

References mim::ast::IdPtrn::dbg(), mim::ast::TuplePtrn::is_brckt(), and mim::ast::Node::loc().

Referenced by emit_type().


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