Icon View Incident Report

Serious Serious
Reported By: Michael Dreher
Reported On: 9/29/2015
For: Version 2.01 Build 2
# 4256 Compiler Not Emitting Unary Operators Used with Constants Properly

I get unexpected results using "+" or "-" as unary prefix operatoras in numeric literals.

procedure TForm1.Button1Click(Sender: TObject);
begin
 Label1.Caption := 'test123'; // this is only to find the function in the JavaScript output
 Label1.Caption := IntToStr(1);     // prints 1 to label
 Label1.Caption := IntToStr(-1);    // prints -1 to label
 Label1.Caption := IntToStr(+1);    // prints 0  to label   (since the subject of this thread)
 Label1.Caption := IntToStr(-(-1)); // prints 0  to label
 Label1.Caption := IntToStr(+(-1)); // prints 0  to label   
end;   

Since I get no compiler error, the + and - signs should be valid.
In the help (Operators) both "+" , "-" operators are only listed as binary infix. 

The JavaScript output:

unit1_tform1.$p.tform1_button1click = function(sender)
{
  var $t = this;
  $t.tform1_label1.tlabelcontrol_setcaption("test123");
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(1));
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(-1));
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0));
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0));
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0));
  $t.tform1_label1.tlabelcontrol_setcaption(inttostr(0));
};



Resolution Resolution
Fixed Problem on 9/30/2015 in version 2.02 build 1


Products Affected Products Affected
Elevate Web Builder
Elevate Web Builder Trial

Image