Problem with integer variable on dwsUnit

Issue #149 resolved
Former user created an issue

On Delphi 10.2 if I define an integer variable and than I try to use it on script I get an error about "assertion failure".

To avoid it on dwsStack.pas I have replace this:

function TStackMixIn.ReadIntValue(sourceAddr : Integer): Int64;
var
   varData : PVarData;
begin
   varData := @Data[sourceAddr];
   Assert(varData.VType=varInt64);
   Result:=varData.VInt64
end;

with this:

function TStackMixIn.ReadIntValue(sourceAddr : Integer): Int64;
var
   varData : PVarData;
begin
   varData := @Data[sourceAddr];
   if varData.VType=varInt64 then
     Result:=varData.VInt64
   else
     Result:= PVariant(varData)^;
end;

Comments (2)

  1. Eric Grange repo owner

    Do you have any snippet that would illustrate at which point the error originates?

    Integer variables are required to be varInt64 in the stack.

  2. Log in to comment