mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 15:39:29 +02:00
* Patch from Mattias Gaertner to avoid some non-set function results
git-svn-id: trunk@34096 -
This commit is contained in:
parent
d36e882d1a
commit
1606976cfa
@ -80,25 +80,33 @@ end;
|
||||
function TJSValue.GetAsNumber: TJSNumber;
|
||||
begin
|
||||
If (ValueType=jstNumber) then
|
||||
Result:=FValue.F;
|
||||
Result:=FValue.F
|
||||
else
|
||||
Result:=0.0;
|
||||
end;
|
||||
|
||||
function TJSValue.GetAsObject: TObject;
|
||||
begin
|
||||
If (ValueType=jstObject) then
|
||||
Result:=TObject(FValue.P);
|
||||
Result:=TObject(FValue.P)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TJSValue.GetAsReference: TObject;
|
||||
begin
|
||||
If (ValueType=jstReference) then
|
||||
Result:=TObject(FValue.P);
|
||||
Result:=TObject(FValue.P)
|
||||
else
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TJSValue.GetAsString: TJSString;
|
||||
begin
|
||||
If (ValueType=jstString) then
|
||||
Result:=String(FValue.P);
|
||||
Result:=String(FValue.P)
|
||||
else
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function TJSValue.GetIsNull: Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user