sun::ast::CompoundAssignmentAST

sun::ast::CompoundAssignmentAST

class · Source (opens in a new tab)

class sun::ast::CompoundAssignmentAST : public sun::ast::ExprAST

Compound assignment: target op= value (e.g.

x += 1, obj.f *= 2, arr[i] |= mask). Kept as a single node through analysis and lowered in codegen as address-once -> load -> op -> store, so the target is evaluated exactly once. op is the compound token itself (e.g. '+=').

Inherits

Public Functions

CompoundAssignmentAST

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

sun::ast::CompoundAssignmentAST::CompoundAssignmentAST(std::unique_ptr< ExprAST > target, Token op, std::unique_ptr< ExprAST > value)

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

Related: ExprAST, Token

binaryOpKind

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

sun::parsing::TokenKind sun::ast::CompoundAssignmentAST::binaryOpKind() const

The underlying binary operator (e.g.

PLUS for PLUS_ASSIGN)

Related: sun::parsing::TokenKind

dotLabel

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

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

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

Related: ChildSlotFn

getOp

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

const Token & sun::ast::CompoundAssignmentAST::getOp() const

Returns the operator applied by this expression.

Related: Token

getTarget

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

const ExprAST * sun::ast::CompoundAssignmentAST::getTarget() const

Returns the target stored by this object.

Related: ExprAST

getType

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

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

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

Related: ASTNodeType

getValue

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

const ExprAST * sun::ast::CompoundAssignmentAST::getValue() const

Returns the value represented by this object.

Related: ExprAST

toString

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

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

Returns a readable representation for diagnostics and debugging.

Private Fields

op

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

Token sun::ast::CompoundAssignmentAST::op

No documentation comment.

Related: Token

target

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

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

No documentation comment.

Related: ExprAST

value

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

std::unique_ptr<ExprAST> sun::ast::CompoundAssignmentAST::value

No documentation comment.

Related: ExprAST