sun::ast::IndexAST

sun::ast::IndexAST

class · Source (opens in a new tab)

class sun::ast::IndexAST : public sun::ast::ExprAST

Index 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

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 override

Returns 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) override

Visits 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() const

Provides 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() const

Returns the target stored by this object.

Related: ExprAST

getType

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

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

Returns 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() const

Check if any index component is a range slice.

numIndices

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

size_t sun::ast::IndexAST::numIndices() const

Returns the number of index expressions in this access.

toString

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

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

Returns 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::indices

No documentation comment.

Related: SliceExprAST

target

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

std::unique_ptr<ExprAST> sun::ast::IndexAST::target

No documentation comment.

Related: ExprAST