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

Public Member Functions

 Scopes (AST &ast)
ASTast () const
Error & error () const
Scopetop ()
const Decldummy () const
void push ()
void push (Scope &scope)
void pop ()
size_t 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 (size_t old)
const Declfind (Dbg dbg, bool quiet=false)
const Declfind_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.

void push_mod (Sym name)
void pop_mod ()
size_t mod_depth () const
Sym enclosing_mod () const

Detailed Description

Definition at line 19 of file bind.cpp.

Constructor & Destructor Documentation

◆ Scopes()

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

Definition at line 21 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 27 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 90 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 95 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 30 of file bind.cpp.

Referenced by find().

◆ enclosing_mod()

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

Definition at line 59 of file bind.cpp.

◆ error()

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

Definition at line 28 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 62 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 ModDecl/Import ever yield a non-null Decl::scope, so this never confuses a value for a module.

Definition at line 84 of file bind.cpp.

References bind().

Referenced by bind().

◆ mod_depth()

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

Definition at line 58 of file bind.cpp.

◆ pop()

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

Definition at line 35 of file bind.cpp.

Referenced by pop_barrier().

◆ pop_barrier()

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

Definition at line 48 of file bind.cpp.

References pop().

◆ pop_mod()

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

Definition at line 57 of file bind.cpp.

◆ push() [1/2]

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

Definition at line 32 of file bind.cpp.

Referenced by push_barrier(), and Scopes().

◆ push() [2/2]

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

Definition at line 33 of file bind.cpp.

◆ push_barrier()

size_t 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 41 of file bind.cpp.

References push().

◆ push_mod()

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

Definition at line 56 of file bind.cpp.

◆ top()

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

Definition at line 29 of file bind.cpp.

Referenced by bind().


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