sun::ast::ModuleAST

sun::ast::ModuleAST

class · Source (opens in a new tab)

class sun::ast::ModuleAST : public sun::ast::ExprAST

Module declaration: module Name { declarations... } Also supports legacy 'namespace' keyword.

Inherits

Public Functions

ModuleAST

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

sun::ast::ModuleAST::ModuleAST(std::string name, 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::ModuleAST::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::ModuleAST::forEachChildSlot(const ChildSlotFn &fn) override

Visits replaceable child expressions so tree passes can rewrite them in place.

Related: ChildSlotFn

getBody

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

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

Provides access to the expressions that make up the body.

Related: BlockExprAST

getDoc

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

const std::string & sun::ast::ModuleAST::getDoc() const

Return the comment documenting this module.

getName

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

const std::string & sun::ast::ModuleAST::getName() const

Returns the declared name used to identify this object.

getNameLocation

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

const std::optional< sun::support::Position > & sun::ast::ModuleAST::getNameLocation() const

Return the source span of this module's name, when available.

Related: sun::support::Position

getQualifiedName

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

const QualifiedName & sun::ast::ModuleAST::getQualifiedName() const

Return the defining module name, independent of source aliases.

Related: QualifiedName

getShorthandChild

getShorthandChild()

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

ModuleAST * sun::ast::ModuleAST::getShorthandChild()

Return the next mutable module in the same dotted declaration, or null.

Related: ModuleAST

getShorthandChild() const

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

const ModuleAST * sun::ast::ModuleAST::getShorthandChild() const

Return the next module in the same dotted declaration, or null.

Related: ModuleAST

getType

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

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

Returns the syntax-node kind used to dispatch tree visitors.

Related: ASTNodeType

hasQualifiedName

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

bool sun::ast::ModuleAST::hasQualifiedName() const

Whether the module's defining name has been recorded.

mutableBody

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

BlockExprAST & sun::ast::ModuleAST::mutableBody()

Provides mutable access to the body so compiler passes can rewrite it.

Related: BlockExprAST

setDoc

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

void sun::ast::ModuleAST::setDoc(std::string value)

Store the comment documenting this module.

setNameLocation

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

void sun::ast::ModuleAST::setNameLocation(sun::support::Position value)

Record the source span of this module's name.

Related: sun::support::Position

setQualifiedName

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

void sun::ast::ModuleAST::setQualifiedName(QualifiedName value)

Record the module's defining name during import or semantic analysis.

Related: QualifiedName

toString

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

std::string sun::ast::ModuleAST::toString() const override

Returns a readable representation for diagnostics and debugging.

Private Fields

body

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

std::unique_ptr<BlockExprAST> sun::ast::ModuleAST::body

No documentation comment.

Related: BlockExprAST

doc

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

std::string sun::ast::ModuleAST::doc

No documentation comment.

name

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

std::string sun::ast::ModuleAST::name

No documentation comment.

nameLocation

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

std::optional<sun::support::Position> sun::ast::ModuleAST::nameLocation

No documentation comment.

Related: sun::support::Position

qualifiedName

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

QualifiedName sun::ast::ModuleAST::qualifiedName

No documentation comment.

Related: QualifiedName