sun::ast::BlockExprAST

sun::ast::BlockExprAST

class · Source (opens in a new tab)

class sun::ast::BlockExprAST : public sun::ast::ExprAST

An ordered sequence of expressions evaluated in a shared lexical scope.

Inherits

Public Functions

BlockExprAST

BlockExprAST(std::vector< std::unique_ptr< ExprAST > > body, BlockKind kind=BlockKind::Anonymous)

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

sun::ast::BlockExprAST::BlockExprAST(std::vector< std::unique_ptr< ExprAST > > body, BlockKind kind=BlockKind::Anonymous)

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

Related: ExprAST, BlockKind, BlockKind::Anonymous

BlockExprAST()=default

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

sun::ast::BlockExprAST::BlockExprAST()=default

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

addExpression

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

void sun::ast::BlockExprAST::addExpression(std::unique_ptr< ExprAST > expr)

Appends an owned expression to the block.

Related: ExprAST

dotLabel

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

std::string sun::ast::BlockExprAST::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::BlockExprAST::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 std::vector< std::unique_ptr< ExprAST > > & sun::ast::BlockExprAST::getBody() const

Provides access to the expressions that make up the body.

Related: ExprAST

getKind

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

BlockKind sun::ast::BlockExprAST::getKind() const

Returns the type category used for semantic checks and dispatch.

Related: BlockKind

getLastExpr

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

const ExprAST * sun::ast::BlockExprAST::getLastExpr() const

Optional: get the last expression (common when evaluating blocks).

Related: ExprAST

getType

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

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

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

Related: ASTNodeType

isEmpty

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

bool sun::ast::BlockExprAST::isEmpty() const

Optional: convenience method to check if block is empty.

mutableBody

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

std::vector< std::unique_ptr< ExprAST > > & sun::ast::BlockExprAST::mutableBody()

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

Related: ExprAST

prependExpressions

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

void sun::ast::BlockExprAST::prependExpressions(std::vector< std::unique_ptr< ExprAST > > exprs)

Moves expressions to the beginning of the block in their original order.

Related: ExprAST

producesValue

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

bool sun::ast::BlockExprAST::producesValue() const

The two kinds the language lets evaluate to their last statement, plus the compiler's own syntaxless value blocks.

setKind

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

void sun::ast::BlockExprAST::setKind(BlockKind kind)

Updates the kind stored by this object.

Related: BlockKind

toString

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

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

Returns a readable representation for diagnostics and debugging.

Private Fields

Body

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

std::vector<std::unique_ptr<ExprAST> > sun::ast::BlockExprAST::Body

No documentation comment.

Related: ExprAST

Kind

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

BlockKind sun::ast::BlockExprAST::Kind = BlockKind::Anonymous

No documentation comment.

Related: BlockKind, BlockKind::Anonymous