#11 Array bug when using unit.

open
5
2003-10-30
2003-10-30
No

Let's follow these steps and see waht we get.

1. Open a new application and add a TDelphiWebScriptII
and a Tdws2Unit on a form. Lets name them dws and
dwsUnit respectively.

2. On dwsUnit add a member to the Arrays property. Set
it's name to TIntArray assign an upper and lower bound
to it, then set its result type to Integer. Add to the
variables property the following member: IntArray and
set its type to TIntArray. Don't forget to set the script
property of the dwsUnit to dws.

3. The Problem is the following. Upon trying to compile
the script below I get a compile time Error

IntArray[0] := 1;

SYNTAX ERROR ':=' Expected [Line:1, Column:9]

however if you declare the array scriptwise it will work.
For example if you type

type TIntArray: Array[0..10] of Integer;
var IntArray: TIntArray;

IntArray[0] := 1;

The above script will compile with no errors. I feel this is
a bug!

Anastasios Yalanopoulos

Discussion