sun::ast::MoonScopeAST
class · Source (opens in a new tab)
class sun::ast::MoonScopeAST : public sun::ast::ExprASTMoonScopeAST wraps the declarations of one bundle under its $hash$ scope: the stubs of an imported .moon, or — when a .moon is being built — the sources being bundled.
Both are analyzed under the same scope name, so a bundle spells its own symbols exactly as its importers will.
An imported scope also carries the module name and optional alias from the manifest, and its stubs are precompiled (no bodies, no body checks).
Inherits
- sun::ast::ExprAST (public)
Types
Public Functions
- MoonScopeAST
- dotLabel
- forEachChildSlot
- forOwnBundle
- getAlias
- getBody
- getContentHash
- getEffectiveName
- getModuleName
- getMoonPath
- getType
- isOwnBundle
- toString
MoonScopeAST
public · function · Source (opens in a new tab)
sun::ast::MoonScopeAST::MoonScopeAST(std::string contentHash, std::string moduleName, std::optional< std::string > alias, std::string moonPath, std::unique_ptr< BlockExprAST > body)Creates this syntax node and takes ownership of any supplied child expressions.
Related: BlockExprAST
dotLabel
public · function · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::dotLabel() const overrideReturns the node label used in syntax-tree graph visualizations.
forEachChildSlot
public · function · Source (opens in a new tab)
void sun::ast::MoonScopeAST::forEachChildSlot(const ChildSlotFn &fn) overrideVisits replaceable child expressions so tree passes can rewrite them in place.
Related: ChildSlotFn
forOwnBundle
public · function · static · Source (opens in a new tab)
static std::unique_ptr< MoonScopeAST > sun::ast::MoonScopeAST::forOwnBundle(std::string scopeName, std::unique_ptr< BlockExprAST > body)The scope of the bundle being built: body is the program's own source declarations, fully analyzed and compiled, under scopeName ("$hash$").
Related: MoonScopeAST, BlockExprAST
getAlias
public · function · Source (opens in a new tab)
const std::optional< std::string > & sun::ast::MoonScopeAST::getAlias() constGet the alias (rename) if specified.
getBody
getBody() const
public · function · Source (opens in a new tab)
const BlockExprAST & sun::ast::MoonScopeAST::getBody() constGet the body containing module stubs.
Related: BlockExprAST
getBody()
public · function · Source (opens in a new tab)
BlockExprAST & sun::ast::MoonScopeAST::getBody()Provides access to the expressions that make up the body.
Related: BlockExprAST
getContentHash
public · function · Source (opens in a new tab)
const std::string & sun::ast::MoonScopeAST::getContentHash() constGet the content hash for deduplication.
getEffectiveName
public · function · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::getEffectiveName() constGet the effective name (alias if set, otherwise original name).
getModuleName
public · function · Source (opens in a new tab)
const std::string & sun::ast::MoonScopeAST::getModuleName() constGet the original module name from the moon.
getMoonPath
public · function · Source (opens in a new tab)
const std::string & sun::ast::MoonScopeAST::getMoonPath() constGet the path to the moon file.
getType
public · function · Source (opens in a new tab)
ASTNodeType sun::ast::MoonScopeAST::getType() const overrideReturns the syntax-node kind used to dispatch tree visitors.
Related: ASTNodeType
isOwnBundle
public · function · Source (opens in a new tab)
bool sun::ast::MoonScopeAST::isOwnBundle() constTrue for the bundle being built; false for an imported bundle's stubs.
toString
public · function · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::toString() const overrideReturns a readable representation for diagnostics and debugging.
Public Fields
importedDeclarations
public · variable · Source (opens in a new tab)
std::vector<sun::semantic_analysis::LibraryDeclarationRecord> sun::ast::MoonScopeAST::importedDeclarationsNo documentation comment.
Related: sun::semantic_analysis::LibraryDeclarationRecord
requiredDeclarations
public · variable · Source (opens in a new tab)
std::vector<DeclarationRequirement> sun::ast::MoonScopeAST::requiredDeclarationsExact declarations referenced by this bundle's metadata, with any kind requirement imposed by their use.
Import preparation validates these after registering every bundle's records, including requirements from generic declarations that are never instantiated.
Related: DeclarationRequirement
Private Fields
alias_
private · variable · Source (opens in a new tab)
std::optional<std::string> sun::ast::MoonScopeAST::alias_No documentation comment.
body_
private · variable · Source (opens in a new tab)
std::unique_ptr<BlockExprAST> sun::ast::MoonScopeAST::body_No documentation comment.
Related: BlockExprAST
contentHash_
private · variable · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::contentHash_No documentation comment.
moduleName_
private · variable · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::moduleName_No documentation comment.
moonPath_
private · variable · Source (opens in a new tab)
std::string sun::ast::MoonScopeAST::moonPath_No documentation comment.
ownBundle_
private · variable · Source (opens in a new tab)
bool sun::ast::MoonScopeAST::ownBundle_ = falseNo documentation comment.