Browse Source

* Patch from Henrique Werlang to implement TValue.Empty

michael 4 years ago
parent
commit
e3f828a8ef
1 changed files with 6 additions and 0 deletions
  1. 6 0
      packages/rtl/rtti.pas

+ 6 - 0
packages/rtl/rtti.pas

@@ -63,6 +63,7 @@ type
     //ToDo: procedure SetArrayElement(aIndex: SizeInt; constref AValue: TValue);
     //ToDo: procedure SetArrayElement(aIndex: SizeInt; constref AValue: TValue);
     function IsType(ATypeInfo: PTypeInfo): boolean;
     function IsType(ATypeInfo: PTypeInfo): boolean;
     function AsJSValue: JSValue;
     function AsJSValue: JSValue;
+    class function Empty: TValue; static;
   end;
   end;
 
 
   TRttiType = class;
   TRttiType = class;
@@ -670,6 +671,11 @@ begin
   Result := FData;
   Result := FData;
 end;
 end;
 
 
+class function TValue.Empty: TValue;
+begin
+  Result.FTypeInfo := nil;
+end;
+
 { TRttiStructuredType }
 { TRttiStructuredType }
 
 
 function TRttiStructuredType.GetMethods: TRttiMethodArray;
 function TRttiStructuredType.GetMethods: TRttiMethodArray;