sun::ast::BlockExprAST
class · Source (opens in a new tab)
class sun::ast::BlockExprAST : public sun::ast::ExprASTAn ordered sequence of expressions evaluated in a shared lexical scope.
Inherits
- sun::ast::ExprAST (public)
Public Functions
- BlockExprAST
- addExpression
- dotLabel
- forEachChildSlot
- getBody
- getKind
- getLastExpr
- getType
- isEmpty
- mutableBody
- prependExpressions
- producesValue
- setKind
- toString
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()=defaultCreates 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 overrideReturns 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) overrideVisits 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() constProvides 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() constReturns 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() constOptional: 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 overrideReturns 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() constOptional: 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() constThe 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 overrideReturns 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::BodyNo documentation comment.
Related: ExprAST
Kind
private · variable · Source (opens in a new tab)
BlockKind sun::ast::BlockExprAST::Kind = BlockKind::AnonymousNo documentation comment.
Related: BlockKind, BlockKind::Anonymous