ForLoop

data class ForLoop(var init: AstObject, var loop: Loop, var steps: Assignment, var line: Int) : AstObject, IsParent

Used to define for loops

Example:

int i;
int sum = 0;
for (i = 1; i < 11; i++)
{
sum = sum + i;
}

Constructors

Link copied to clipboard
constructor(init: AstObject, loop: Loop, steps: Assignment, line: Int)

Properties

Link copied to clipboard

represents the initial value of the iterator

Link copied to clipboard
open override var line: Int

is the line at which the statement/code component begins in the program text file

Link copied to clipboard
var loop: Loop

represents a common code sequence for all repetition instructions

Link copied to clipboard
open override var parent: IsParent?

is the parent of the node in the Syntax Tree

Link copied to clipboard
open override val scope: SymbolTable?

is the scope to which the node belongs

Link copied to clipboard

is the expression executed at the end of each iteration

Functions

Link copied to clipboard
open override fun replaceChild(initial: AstObject, replacement: AstObject)

Is replacing a certain child of the class with another object of the same type If the two parameters don't have the same type, no block will be replaced. If the type of initial doesn't match any of the current node children, no child will be replaced

Link copied to clipboard
open override fun setParentForChildren()

Sets the object as a parent for its children