ForStatement

Overview

The ForStatement class represents a for <i> := <a> to/down <z> do <statement> statement. The name and type are the implicitly introduced indexer variable for this loop. The step variable is optional, however it should always be a positive number, if it's used. The aEnd and aStep variables will only be evaluated once for the whole for loop.

Location


 

constructor

Constructor that does not initialize any fields.

 

constructor

 

ForStatement()

 

init()

 

ForStatement()

 

Sub New()

Initialize an empty loop

 

constructor(aName: String; aType: IType; aStart: Value; aEnd: Value; aStep: Value; aBody: Statement; aDownto: Boolean; aParallel: Boolean)

 

ForStatement(String aName, IType aType, Value aStart, Value aEnd, Value aStep, Statement aBody, Boolean aDownto, Boolean aParallel)

 

init(_ aName: String, _ aType: IType, _ aStart: Value, _ aEnd: Value, _ aStep: Value, _ aBody: Statement, _ aDownto: Boolean, _ aParallel: Boolean)

 

ForStatement(String aName, IType aType, Value aStart, Value aEnd, Value aStep, Statement aBody, Boolean aDownto, Boolean aParallel)

 

Sub New(aName As String, aType As IType, aStart As Value, aEnd As Value, aStep As Value, aBody As Statement, aDownto As Boolean, aParallel As Boolean)

Parameters:

  • aName: Name of the for variable to create
  • aType: type of the variable to create
  • aStart: start range
  • aEnd: end range
  • aStep: Optional step value (defaults to 1)
  • aBody: body of this for loop
  • aDownto: reverse the order of the loop
  • aParallel: if true, runs the loop in paralle

Body

Statement body

 

property Body: Statement read write;

 

Statement Body { get; set; }

 

var Body: Statement { get{} set{} }

 

Statement Body { __get; __set; }

 

Property Body() As Statement

BuildStatement

Converts a statement to a string.

 

method BuildStatement(anIndent: Int32; sb: StringBuilder)

 

void BuildStatement(Int32 anIndent, StringBuilder sb)

 

func BuildStatement(_ anIndent: Int32, _ sb: StringBuilder)

 

void BuildStatement(Int32 anIndent, StringBuilder sb)

 

Sub BuildStatement(anIndent As Int32, sb As StringBuilder)

Parameters:

  • anIndent: The nr of spaces to place before the start of this statement.
  • sb: Output string builder.

Downto

Loop backward; if this is set, Start can be more than

 

property Downto: Boolean read write;

 

Boolean Downto { get; set; }

 

var Downto: Boolean { get{} set{} }

 

Boolean Downto { __get; __set; }

 

Property Downto() As Boolean

End

End of the sequence; this is inclusive

 

property End: Value read write;

 

Value End { get; set; }

 

var End: Value { get{} set{} }

 

Value End { __get; __set; }

 

Property End() As Value

Kind

Returns what kind of statement this is; this can be used to find out if a statement is of a specific type without having to check all possible casts

 

property Kind: StatementKind read;

 

StatementKind Kind { get; }

 

var Kind: StatementKind { get{} }

 

StatementKind Kind { __get; }

 

ReadOnly Property Kind() As StatementKind

Name

Name of the local introduced

 

property Name: String read write;

 

String Name { get; set; }

 

var Name: String { get{} set{} }

 

String Name { __get; __set; }

 

Property Name() As String

OverflowCheck    (declared in Statement)

Overflow checking for binary and unary operations in this statement

 

property OverflowCheck: Boolean read write;

 

Boolean OverflowCheck { get; set; }

 

var OverflowCheck: Boolean { get{} set{} }

 

Boolean OverflowCheck { __get; __set; }

 

Property OverflowCheck() As Boolean

Parallel

Run the loop in parallel

 

property Parallel: Boolean read write;

 

Boolean Parallel { get; set; }

 

var Parallel: Boolean { get{} set{} }

 

Boolean Parallel { __get; __set; }

 

Property Parallel() As Boolean

Position    (declared in Statement)

Position this statement is defined at

 

property Position: IPosition read write;

 

IPosition Position { get; set; }

 

var Position: IPosition { get{} set{} }

 

IPosition Position { __get; __set; }

 

Property Position() As IPosition

SetOverflowCheckRecursive

Recursively sets the OverflowCheck flag

 

method SetOverflowCheckRecursive(value: Boolean)

 

void SetOverflowCheckRecursive(Boolean value)

 

func SetOverflowCheckRecursive(_ value: Boolean)

 

void SetOverflowCheckRecursive(Boolean value)

 

Sub SetOverflowCheckRecursive(value As Boolean)

Parameters:

  • value: new value

Start

Start value

 

property Start: Value read write;

 

Value Start { get; set; }

 

var Start: Value { get{} set{} }

 

Value Start { __get; __set; }

 

Property Start() As Value

Step

Step value, if nil it's 1

 

property Step: Value read write;

 

Value Step { get; set; }

 

var Step: Value { get{} set{} }

 

Value Step { __get; __set; }

 

Property Step() As Value

ToString    (declared in Statement)

Returns this statement as a string

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

 

Function ToString() As String

ToValue

Converts this statement to a value tree that creates these statements

 

method ToValue(aServicesParameter: Value; aServices: IServices): Value

 

Value ToValue(Value aServicesParameter, IServices aServices)

 

func ToValue(_ aServicesParameter: Value, _ aServices: IServices) -> Value

 

Value ToValue(Value aServicesParameter, IServices aServices)

 

Function ToValue(aServicesParameter As Value, aServices As IServices) As Value

Parameters:

  • aServicesParameter: the value that contains where aServices is stored
  • aServices: Actual services instance.

Type

Optional type, if not set it's initialized to the type of the start value

 

property Type: IType read write;

 

IType Type { get; set; }

 

var Type: IType { get{} set{} }

 

IType Type { __get; __set; }

 

Property Type() As IType

 

Body

Statement body

 

property Body: Statement read write;

 

Statement Body { get; set; }

 

var Body: Statement { get{} set{} }

 

Statement Body { __get; __set; }

 

Property Body() As Statement

Downto

Loop backward; if this is set, Start can be more than

 

property Downto: Boolean read write;

 

Boolean Downto { get; set; }

 

var Downto: Boolean { get{} set{} }

 

Boolean Downto { __get; __set; }

 

Property Downto() As Boolean

End

End of the sequence; this is inclusive

 

property End: Value read write;

 

Value End { get; set; }

 

var End: Value { get{} set{} }

 

Value End { __get; __set; }

 

Property End() As Value

Kind

Returns what kind of statement this is; this can be used to find out if a statement is of a specific type without having to check all possible casts

 

property Kind: StatementKind read;

 

StatementKind Kind { get; }

 

var Kind: StatementKind { get{} }

 

StatementKind Kind { __get; }

 

ReadOnly Property Kind() As StatementKind

Name

Name of the local introduced

 

property Name: String read write;

 

String Name { get; set; }

 

var Name: String { get{} set{} }

 

String Name { __get; __set; }

 

Property Name() As String

OverflowCheck    (declared in Statement)

Overflow checking for binary and unary operations in this statement

 

property OverflowCheck: Boolean read write;

 

Boolean OverflowCheck { get; set; }

 

var OverflowCheck: Boolean { get{} set{} }

 

Boolean OverflowCheck { __get; __set; }

 

Property OverflowCheck() As Boolean

Parallel

Run the loop in parallel

 

property Parallel: Boolean read write;

 

Boolean Parallel { get; set; }

 

var Parallel: Boolean { get{} set{} }

 

Boolean Parallel { __get; __set; }

 

Property Parallel() As Boolean

Position    (declared in Statement)

Position this statement is defined at

 

property Position: IPosition read write;

 

IPosition Position { get; set; }

 

var Position: IPosition { get{} set{} }

 

IPosition Position { __get; __set; }

 

Property Position() As IPosition

Start

Start value

 

property Start: Value read write;

 

Value Start { get; set; }

 

var Start: Value { get{} set{} }

 

Value Start { __get; __set; }

 

Property Start() As Value

Step

Step value, if nil it's 1

 

property Step: Value read write;

 

Value Step { get; set; }

 

var Step: Value { get{} set{} }

 

Value Step { __get; __set; }

 

Property Step() As Value

Type

Optional type, if not set it's initialized to the type of the start value

 

property Type: IType read write;

 

IType Type { get; set; }

 

var Type: IType { get{} set{} }

 

IType Type { __get; __set; }

 

Property Type() As IType

 

constructor

Constructor that does not initialize any fields.

 

constructor

 

ForStatement()

 

init()

 

ForStatement()

 

Sub New()

Initialize an empty loop

 

constructor(aName: String; aType: IType; aStart: Value; aEnd: Value; aStep: Value; aBody: Statement; aDownto: Boolean; aParallel: Boolean)

 

ForStatement(String aName, IType aType, Value aStart, Value aEnd, Value aStep, Statement aBody, Boolean aDownto, Boolean aParallel)

 

init(_ aName: String, _ aType: IType, _ aStart: Value, _ aEnd: Value, _ aStep: Value, _ aBody: Statement, _ aDownto: Boolean, _ aParallel: Boolean)

 

ForStatement(String aName, IType aType, Value aStart, Value aEnd, Value aStep, Statement aBody, Boolean aDownto, Boolean aParallel)

 

Sub New(aName As String, aType As IType, aStart As Value, aEnd As Value, aStep As Value, aBody As Statement, aDownto As Boolean, aParallel As Boolean)

Parameters:

  • aName: Name of the for variable to create
  • aType: type of the variable to create
  • aStart: start range
  • aEnd: end range
  • aStep: Optional step value (defaults to 1)
  • aBody: body of this for loop
  • aDownto: reverse the order of the loop
  • aParallel: if true, runs the loop in paralle

BuildStatement

Converts a statement to a string.

 

method BuildStatement(anIndent: Int32; sb: StringBuilder)

 

void BuildStatement(Int32 anIndent, StringBuilder sb)

 

func BuildStatement(_ anIndent: Int32, _ sb: StringBuilder)

 

void BuildStatement(Int32 anIndent, StringBuilder sb)

 

Sub BuildStatement(anIndent As Int32, sb As StringBuilder)

Parameters:

  • anIndent: The nr of spaces to place before the start of this statement.
  • sb: Output string builder.

SetOverflowCheckRecursive

Recursively sets the OverflowCheck flag

 

method SetOverflowCheckRecursive(value: Boolean)

 

void SetOverflowCheckRecursive(Boolean value)

 

func SetOverflowCheckRecursive(_ value: Boolean)

 

void SetOverflowCheckRecursive(Boolean value)

 

Sub SetOverflowCheckRecursive(value As Boolean)

Parameters:

  • value: new value

ToString    (declared in Statement)

Returns this statement as a string

 

method ToString: String

 

String ToString()

 

func ToString() -> String

 

String ToString()

 

Function ToString() As String

ToValue

Converts this statement to a value tree that creates these statements

 

method ToValue(aServicesParameter: Value; aServices: IServices): Value

 

Value ToValue(Value aServicesParameter, IServices aServices)

 

func ToValue(_ aServicesParameter: Value, _ aServices: IServices) -> Value

 

Value ToValue(Value aServicesParameter, IServices aServices)

 

Function ToValue(aServicesParameter As Value, aServices As IServices) As Value

Parameters:

  • aServicesParameter: the value that contains where aServices is stored
  • aServices: Actual services instance.