mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-05 21:10:24 +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;
|
function TJSValue.GetAsNumber: TJSNumber;
|
||||||
begin
|
begin
|
||||||
If (ValueType=jstNumber) then
|
If (ValueType=jstNumber) then
|
||||||
Result:=FValue.F;
|
Result:=FValue.F
|
||||||
|
else
|
||||||
|
Result:=0.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJSValue.GetAsObject: TObject;
|
function TJSValue.GetAsObject: TObject;
|
||||||
begin
|
begin
|
||||||
If (ValueType=jstObject) then
|
If (ValueType=jstObject) then
|
||||||
Result:=TObject(FValue.P);
|
Result:=TObject(FValue.P)
|
||||||
|
else
|
||||||
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJSValue.GetAsReference: TObject;
|
function TJSValue.GetAsReference: TObject;
|
||||||
begin
|
begin
|
||||||
If (ValueType=jstReference) then
|
If (ValueType=jstReference) then
|
||||||
Result:=TObject(FValue.P);
|
Result:=TObject(FValue.P)
|
||||||
|
else
|
||||||
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJSValue.GetAsString: TJSString;
|
function TJSValue.GetAsString: TJSString;
|
||||||
begin
|
begin
|
||||||
If (ValueType=jstString) then
|
If (ValueType=jstString) then
|
||||||
Result:=String(FValue.P);
|
Result:=String(FValue.P)
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJSValue.GetIsNull: Boolean;
|
function TJSValue.GetIsNull: Boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user