sun::ast::ForInExprAST

sun::ast::ForInExprAST

class · Source (opens in a new tab)

class sun::ast::ForInExprAST : public sun::ast::ExprAST

for (var x: T in iterable) { ... } Iterates over iterable by calling iter() -> IIterator<T, C> (when the iterable is not itself an iterator), then next(ref C) -> Option<T> until None

Inherits

Public Functions

ForInExprAST

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

sun::ast::ForInExprAST::ForInExprAST(std::string LoopVar, TypeAnnotation LoopVarType, std::unique_ptr< ExprAST > Iterable, std::unique_ptr< ExprAST > Body, bool isConst=false)

Creates this syntax node and takes ownership of any supplied child expressions.

Related: TypeAnnotation, ExprAST

bodySlot

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

std::unique_ptr< ExprAST > & sun::ast::ForInExprAST::bodySlot()

Mutable body slot for LoweringPass block normalization.

Related: ExprAST

dotLabel

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

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

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

Related: ChildSlotFn

forInAnalysis

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

ForInAnalysis & sun::ast::ForInExprAST::forInAnalysis() const

Access the resolved iterator protocol and loop binding.

Related: ForInAnalysis

getBody

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

const ExprAST * sun::ast::ForInExprAST::getBody() const

Provides access to the expressions that make up the body.

Related: ExprAST

getIterable

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

const ExprAST * sun::ast::ForInExprAST::getIterable() const

Returns the expression being iterated.

Related: ExprAST

getLoopVar

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

const std::string & sun::ast::ForInExprAST::getLoopVar() const

Returns the loop variable declaration.

getLoopVarType

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

const TypeAnnotation & sun::ast::ForInExprAST::getLoopVarType() const

Returns the declared loop-variable type.

Related: TypeAnnotation

getResolvedLoopVarType

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

sun::types::TypePtr sun::ast::ForInExprAST::getResolvedLoopVarType() const

Returns the loop-variable type selected by analysis.

Related: sun::types::TypePtr

getType

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

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

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

Related: ASTNodeType

hasResolvedLoopVarType

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

bool sun::ast::ForInExprAST::hasResolvedLoopVarType() const

Reports whether this object has resolved loop var type.

isConst

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

bool sun::ast::ForInExprAST::isConst() const

Reports whether this syntax node represents an immutable declaration.

setResolvedLoopVarType

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

void sun::ast::ForInExprAST::setResolvedLoopVarType(sun::types::TypePtr type) const

Resolved loop variable type (set by semantic analyzer).

Related: sun::types::TypePtr

toString

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

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

Returns a readable representation for diagnostics and debugging.

Protected Functions

ensureAnalysis

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

void sun::ast::ForInExprAST::ensureAnalysis() const override

Override to allocate ForInAnalysis instead of base ExprAnalysis.

Related: ForInAnalysis, ExprAnalysis

Private Fields

Body

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

std::unique_ptr<ExprAST> sun::ast::ForInExprAST::Body

No documentation comment.

Related: ExprAST

Iterable

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

std::unique_ptr<ExprAST> sun::ast::ForInExprAST::Iterable

No documentation comment.

Related: ExprAST

LoopVar

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

std::string sun::ast::ForInExprAST::LoopVar

No documentation comment.

LoopVarType

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

TypeAnnotation sun::ast::ForInExprAST::LoopVarType

No documentation comment.

Related: TypeAnnotation

isConst_

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

bool sun::ast::ForInExprAST::isConst_

No documentation comment.