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

Classes

struct  Barrier

Public Member Functions

 Scopes (AST &ast)
AST & ast () const
Error & error () const
Scope & top ()
const Decl * dummy () const
void push ()
void push (Scope &scope)
void pop ()
Barrier push_barrier (Scope &scope)
 A file must not see the scope of whoever imports it, so its Scope becomes the new lookup floor.
void pop_barrier (Barrier old)
const Decl * find (Dbg dbg, bool quiet=false)
const Decl * find_shadowed_module (Sym sym)
 Diagnostic-only: is a module named sym reachable, shadowed by whatever find would actually return?
void bind (Dbg dbg, const Decl *decl, bool rebind=false, bool quiet=false)
void bind (Dbg dbg, const Decl *decl, Vis vis, bool rebind=false, bool quiet=false)
 Binds decl under dbg with an explicit vis - a splice re-exports under its own visibility.
Annex nesting

Tracked by ModDecl::bind so AST::name2annex can derive tag/sub from lexical nesting.

const Decl * top_decl () const
auto enter_top_decl (const Decl *decl)
void push_mod (Sym name)
void pop_mod ()
size_t mod_depth () const
Sym enclosing_mod () const

Detailed Description

Definition at line 21 of file bind.cpp.


Class Documentation

◆ mim::ast::Scopes::Barrier

struct mim::ast::Scopes::Barrier

Definition at line 42 of file bind.cpp.

Class Members
size_t mods
size_t scopes

Constructor & Destructor Documentation

◆ Scopes()

mim::ast::Scopes::Scopes ( AST & ast)
inline

Definition at line 23 of file bind.cpp.

References ast(), and push().

Referenced by mim::ast::File::bind().

Member Function Documentation

◆ ast()

AST & mim::ast::Scopes::ast ( ) const
inline

Definition at line 29 of file bind.cpp.

Referenced by error(), and Scopes().

◆ bind() [1/2]

void mim::ast::Scopes::bind ( Dbg dbg,
const Decl * decl,
bool rebind = false,
bool quiet = false )
inline

Definition at line 99 of file bind.cpp.

References bind(), and mim::ast::Decl::vis().

Referenced by bind(), find(), and find_shadowed_module().

◆ bind() [2/2]

void mim::ast::Scopes::bind ( Dbg dbg,
const Decl * decl,
Vis vis,
bool rebind = false,
bool quiet = false )
inline

Binds decl under dbg with an explicit vis - a splice re-exports under its own visibility.

Definition at line 104 of file bind.cpp.

References error(), find_shadowed_module(), mim::ast::Decl::scope(), and top().

◆ dummy()

const Decl * mim::ast::Scopes::dummy ( ) const
inline

Definition at line 32 of file bind.cpp.

Referenced by find().

◆ enclosing_mod()

Sym mim::ast::Scopes::enclosing_mod ( ) const
inline

Definition at line 68 of file bind.cpp.

References mod_depth().

◆ enter_top_decl()

auto mim::ast::Scopes::enter_top_decl ( const Decl * decl)
inline

Definition at line 63 of file bind.cpp.

◆ error()

Error & mim::ast::Scopes::error ( ) const
inline

Definition at line 30 of file bind.cpp.

References ast(), and mim::ast::AST::error().

Referenced by bind(), and find().

◆ find()

const Decl * mim::ast::Scopes::find ( Dbg dbg,
bool quiet = false )
inline

Definition at line 71 of file bind.cpp.

References bind(), dummy(), and error().

◆ find_shadowed_module()

const Decl * mim::ast::Scopes::find_shadowed_module ( Sym sym)
inline

Diagnostic-only: is a module named sym reachable, shadowed by whatever find would actually return?

Only a module - a ModDecl, an Import, or an AxmDecl family - yields a non-null Decl::scope.

Definition at line 93 of file bind.cpp.

References bind().

Referenced by bind().

◆ mod_depth()

size_t mim::ast::Scopes::mod_depth ( ) const
inline

Definition at line 67 of file bind.cpp.

Referenced by enclosing_mod().

◆ pop()

void mim::ast::Scopes::pop ( )
inline

Definition at line 37 of file bind.cpp.

Referenced by pop_barrier().

◆ pop_barrier()

void mim::ast::Scopes::pop_barrier ( Barrier old)
inline

◆ pop_mod()

void mim::ast::Scopes::pop_mod ( )
inline

Definition at line 66 of file bind.cpp.

◆ push() [1/2]

void mim::ast::Scopes::push ( )
inline

Definition at line 34 of file bind.cpp.

Referenced by push_barrier(), and Scopes().

◆ push() [2/2]

void mim::ast::Scopes::push ( Scope & scope)
inline

Definition at line 35 of file bind.cpp.

◆ push_barrier()

Barrier mim::ast::Scopes::push_barrier ( Scope & scope)
inline

A file must not see the scope of whoever imports it, so its Scope becomes the new lookup floor.

Definition at line 47 of file bind.cpp.

References push().

◆ push_mod()

void mim::ast::Scopes::push_mod ( Sym name)
inline

Definition at line 65 of file bind.cpp.

◆ top()

Scope & mim::ast::Scopes::top ( )
inline

Definition at line 31 of file bind.cpp.

Referenced by bind().

◆ top_decl()

const Decl * mim::ast::Scopes::top_decl ( ) const
inline

The top-level declaration being bound, if any; see NomDecl::rep_vis.

Definition at line 62 of file bind.cpp.


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