sun::ast::MoonScopeAST

sun::ast::MoonScopeAST

class · Source (opens in a new tab)

class sun::ast::MoonScopeAST : public sun::ast::ExprAST

MoonScopeAST 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

Types

Public Functions

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 override

Returns 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) override

Visits 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() const

Get the alias (rename) if specified.

getBody

getBody() const

public · function · Source (opens in a new tab)

const BlockExprAST & sun::ast::MoonScopeAST::getBody() const

Get 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() const

Get the content hash for deduplication.

getEffectiveName

public · function · Source (opens in a new tab)

std::string sun::ast::MoonScopeAST::getEffectiveName() const

Get 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() const

Get the original module name from the moon.

getMoonPath

public · function · Source (opens in a new tab)

const std::string & sun::ast::MoonScopeAST::getMoonPath() const

Get the path to the moon file.

getType

public · function · Source (opens in a new tab)

ASTNodeType sun::ast::MoonScopeAST::getType() const override

Returns 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() const

True 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 override

Returns 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::importedDeclarations

No documentation comment.

Related: sun::semantic_analysis::LibraryDeclarationRecord

requiredDeclarations

public · variable · Source (opens in a new tab)

std::vector<DeclarationRequirement> sun::ast::MoonScopeAST::requiredDeclarations

Exact 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_ = false

No documentation comment.