sun::ast::IndexAST
class · Source (opens in a new tab)
class sun::ast::IndexAST : public sun::ast::ExprASTIndex expression: x[i] or x[i, j, k] for n-dimensional indexing Applies to arrays or any type implementing IIndexable Each index can be a single value or a slice range Uses comma-separated indices: x[0, 1] instead of x[0][1] Supports slicing: x[1:10, 3:5] or mixed x[0, 1:5].
Inherits
- sun::ast::ExprAST (public)
Public Functions
IndexAST
public · function · Source (opens in a new tab)
sun::ast::IndexAST::IndexAST(std::unique_ptr< ExprAST > target, std::vector< std::unique_ptr< SliceExprAST > > idxs)Creates this syntax node and takes ownership of any supplied child expressions.
Related: ExprAST, SliceExprAST
dotLabel
public · function · Source (opens in a new tab)
std::string sun::ast::IndexAST::dotLabel() const overrideReturns the node label used in syntax-tree graph visualizations.
forEachChildSlot
public · function · Source (opens in a new tab)
void sun::ast::IndexAST::forEachChildSlot(const ChildSlotFn &fn) overrideVisits replaceable child expressions so tree passes can rewrite them in place.
Related: ChildSlotFn
getIndices
public · function · Source (opens in a new tab)
const std::vector< std::unique_ptr< SliceExprAST > > & sun::ast::IndexAST::getIndices() constProvides the index expressions used to select array elements.
Related: SliceExprAST
getTarget
public · function · Source (opens in a new tab)
const ExprAST * sun::ast::IndexAST::getTarget() constReturns the target stored by this object.
Related: ExprAST
getType
public · function · Source (opens in a new tab)
ASTNodeType sun::ast::IndexAST::getType() const overrideReturns the syntax-node kind used to dispatch tree visitors.
Related: ASTNodeType
hasSlices
public · function · Source (opens in a new tab)
bool sun::ast::IndexAST::hasSlices() constCheck if any index component is a range slice.
numIndices
public · function · Source (opens in a new tab)
size_t sun::ast::IndexAST::numIndices() constReturns the number of index expressions in this access.
toString
public · function · Source (opens in a new tab)
std::string sun::ast::IndexAST::toString() const overrideReturns a readable representation for diagnostics and debugging.
Private Fields
indices
private · variable · Source (opens in a new tab)
std::vector<std::unique_ptr<SliceExprAST> > sun::ast::IndexAST::indicesNo documentation comment.
Related: SliceExprAST
target
private · variable · Source (opens in a new tab)
std::unique_ptr<ExprAST> sun::ast::IndexAST::targetNo documentation comment.
Related: ExprAST