-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Delphi XE2.
Let's say we have some global function in Delphi:
class function TSMJSGlobalFunctions._VariantToInt (varVal : variant) : integer;
begin
Result := Integer (varVal);
end;
This is how from JavaScript we calling this function:
function doF () {
_Debug ("VariantToInt 100 = " + _VariantToInt ("100"));
}
NOTE: "_Debug" function, just another global function, which showing result in
some window.
So, when from JavaScript we call "VariantToInt ("100")", in Delphi function
will be passed value UNASSIGNED, instead actual value equal to "100" (type
string).
How I fixed it:
In unit "jsintf.pas"
class function TJSClass.JSValToTValue(cx: PJSContext; t: PTypeInfo; vp: jsval;
RttiType: TRttiType): TValue;
From {
Result := TValue.Empty;
case t^.Kind of
}
To {
Result := TValue.Empty;
//-=-
intVarType := t^.Kind;
if intVarType = tkVariant then
begin
case vp.tag of
JSVAL_TAG_STRING :
intVarType := tkString;
JSVAL_TAG_INT32 :
intVarType := tkInteger;
end;
end;
//-=-
case intVarType of
}
New variable added:
intVarType : System.TypInfo.TTypeKind;
Original issue reported on code.google.com by andre...@diatomenterprises.com
on 11 Dec 2013 at 9:11
Attachments: