Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Modifying Const Function Parameters
Tue, Nov 24 2015 4:28 AMPermanent Link

Michael Dreher

Hi,
assignment statements on const parameters are compiled and JS code is generated.

procedure test_function1(const i : integer; const f : double; const b : boolean; const dt : DateTime;
 const c : Char; const s : string);
begin
 i := 1;
 f := 1.1;
 b := false;
 dt := Now + 10;
 c := 'Q';
 s := 'modifying const string';
end;
            
initialization  
 test_function1(-42, 3.14, true, Now, '@', 'hallo world');   
end.

// *.JS
function testform_test_function1(i, f, b, dt, c, s)
{
  i = 1;
  f = 1.1;
  b = false;
  dt = now() + 10;
  c = "Q";
  s = "modifying const string";
};

Shouldn't the compiler prevent me doing this?

Michael Dreher
Tue, Nov 24 2015 9:16 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< assignment statements on const parameters are compiled and JS code is generated. >>

This is now fixed.  During the 2.x compiler re-write, the checking for the status of assignment targets was changed around, and the parameters were missed.

Tim Young
Elevate Software
www.elevatesoft.com
Image