ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

RTTIVariants and boolean expressions fail when negated #434

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following script will fail with "Assertion failure (dwsExprs.pas, line 
5222)".
A single RTTI variant is ok but once there are 2 then the assertion fails.

procedure Run();
begin
 if NOT (Self.checkbox1.checked AND Self.checkbox2.checked) then
   showMessage('Not all checked!!');
end;

Self is an external RTTIVariant as declared below.

var v : TdwsGlobal;
begin
  dwsUnit1.Dependencies.Add(RTTI_UnitName);
  v := dwsUnit1.Variables.Add;
  v.Name := 'Self';
  v.DataType := SYS_RTTIVARIANT;
  v.OnReadVar := dwsUnit1VariablesSelfReadVar;

Full source attached.

Many thanks 

tom

Original issue reported on code.google.com by tom.robe...@gmail.com on 10 Sep 2013 at 4:28

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
PS Casting as a boolean works.

procedure Run();
begin
 if NOT (Boolean(Self.checkbox1.checked) AND Boolean(Self.checkbox2.checked)) then
   showMessage('Not all checked!!');
end;

Original comment by tom.robe...@gmail.com on 10 Sep 2013 at 4:42

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r2265.

Original comment by zar...@gmail.com on 10 Sep 2013 at 7:40

GoogleCodeExporter commented 8 years ago
Downloaded and tested. Working nicely thanks Eric.

Original comment by tom.robe...@gmail.com on 11 Sep 2013 at 12:08