|
@@ -2144,17 +2144,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiInstanceMethod.GetReturnType: TRttiType;
|
|
function TRttiInstanceMethod.GetReturnType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(FHandle^.ResultType) then
|
|
|
|
- Exit(Nil);
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FHandle^.ResultType^);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(FHandle^.ResultType) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FHandle^.ResultType^);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiInstanceMethod.GetVirtualIndex: SmallInt;
|
|
function TRttiInstanceMethod.GetVirtualIndex: SmallInt;
|
|
@@ -2177,32 +2170,28 @@ begin
|
|
SetLength(FParams[False],FHandle^.ParamCount);
|
|
SetLength(FParams[False],FHandle^.ParamCount);
|
|
SetLength(FParams[True],FHandle^.ParamCount);
|
|
SetLength(FParams[True],FHandle^.ParamCount);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- param := FHandle^.Param[0];
|
|
|
|
- while total < FHandle^.ParamCount do
|
|
|
|
|
|
+ param := FHandle^.Param[0];
|
|
|
|
+ while total < FHandle^.ParamCount do
|
|
|
|
+ begin
|
|
|
|
+ obj := context.GetByHandle(param);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ prtti := obj as TRttiVmtMethodParameter
|
|
|
|
+ else
|
|
begin
|
|
begin
|
|
- obj := context.GetByHandle(param);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- prtti := obj as TRttiVmtMethodParameter
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
- context.AddObject(prtti);
|
|
|
|
- end;
|
|
|
|
- FParams[True][total]:=prtti;
|
|
|
|
- if not (pfHidden in param^.Flags) then
|
|
|
|
- begin
|
|
|
|
- FParams[False][visible] := prtti;
|
|
|
|
- Inc(visible);
|
|
|
|
|
|
+ prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
+ context.AddObject(prtti);
|
|
end;
|
|
end;
|
|
- param := param^.Next;
|
|
|
|
- Inc(total);
|
|
|
|
|
|
+ FParams[True][total]:=prtti;
|
|
|
|
+ if not (pfHidden in param^.Flags) then
|
|
|
|
+ begin
|
|
|
|
+ FParams[False][visible] := prtti;
|
|
|
|
+ Inc(visible);
|
|
end;
|
|
end;
|
|
- if visible <> total then
|
|
|
|
- SetLength(FParams[False], visible);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+ param := param^.Next;
|
|
|
|
+ Inc(total);
|
|
end;
|
|
end;
|
|
|
|
+ if visible <> total then
|
|
|
|
+ SetLength(FParams[False], visible);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TRttiInstanceMethod.ResolveAttributes;
|
|
procedure TRttiInstanceMethod.ResolveAttributes;
|
|
@@ -5097,18 +5086,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRefCountedInterfaceType.GetIntfBaseType: TRttiInterfaceType;
|
|
function TRttiRefCountedInterfaceType.GetIntfBaseType: TRttiInterfaceType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(IntfData^.Parent) then
|
|
|
|
- Exit(Nil);
|
|
|
|
-
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(IntfData^.Parent^) as TRttiInterfaceType;
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(IntfData^.Parent) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(IntfData^.Parent^) as TRttiInterfaceType;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRefCountedInterfaceType.GetDeclaringUnitName: String;
|
|
function TRttiRefCountedInterfaceType.GetDeclaringUnitName: String;
|
|
@@ -5148,15 +5129,9 @@ function TRttiRawInterfaceType.GetIntfBaseType: TRttiInterfaceType;
|
|
var
|
|
var
|
|
context: TRttiContext;
|
|
context: TRttiContext;
|
|
begin
|
|
begin
|
|
- if not Assigned(IntfData^.Parent) then
|
|
|
|
- Exit(Nil);
|
|
|
|
-
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(IntfData^.Parent^) as TRttiInterfaceType;
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(IntfData^.Parent) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(IntfData^.Parent^) as TRttiInterfaceType;
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRawInterfaceType.GetDeclaringUnitName: String;
|
|
function TRttiRawInterfaceType.GetDeclaringUnitName: String;
|
|
@@ -5202,18 +5177,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiVmtMethodParameter.GetParamType: TRttiType;
|
|
function TRttiVmtMethodParameter.GetParamType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(FVmtMethodParam^.ParamType) then
|
|
|
|
- Exit(Nil);
|
|
|
|
-
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FVmtMethodParam^.ParamType^);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(FVmtMethodParam^.ParamType) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FVmtMethodParam^.ParamType^);
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor TRttiVmtMethodParameter.Create(AVmtMethodParam: PVmtMethodParam);
|
|
constructor TRttiVmtMethodParameter.Create(AVmtMethodParam: PVmtMethodParam);
|
|
@@ -5245,15 +5212,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiMethodTypeParameter.GetParamType: TRttiType;
|
|
function TRttiMethodTypeParameter.GetParamType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FType);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FType);
|
|
end;
|
|
end;
|
|
|
|
|
|
constructor TRttiMethodTypeParameter.Create(aHandle: Pointer; const aName: String; aFlags: TParamFlags; aType: PTypeInfo);
|
|
constructor TRttiMethodTypeParameter.Create(aHandle: Pointer; const aName: String; aFlags: TParamFlags; aType: PTypeInfo);
|
|
@@ -5327,18 +5287,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiIntfMethod.GetReturnType: TRttiType;
|
|
function TRttiIntfMethod.GetReturnType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(FIntfMethodEntry^.ResultType) then
|
|
|
|
- Exit(Nil);
|
|
|
|
-
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FIntfMethodEntry^.ResultType^);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(FIntfMethodEntry^.ResultType) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FIntfMethodEntry^.ResultType^);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiIntfMethod.GetVirtualIndex: SmallInt;
|
|
function TRttiIntfMethod.GetVirtualIndex: SmallInt;
|
|
@@ -5396,34 +5348,30 @@ begin
|
|
SetLength(FParamsAll, FIntfMethodEntry^.ParamCount);
|
|
SetLength(FParamsAll, FIntfMethodEntry^.ParamCount);
|
|
|
|
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- total := 0;
|
|
|
|
- visible := 0;
|
|
|
|
- param := FIntfMethodEntry^.Param[0];
|
|
|
|
- while total < FIntfMethodEntry^.ParamCount do begin
|
|
|
|
- obj := context.GetByHandle(param);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- FParamsAll[total] := obj as TRttiVmtMethodParameter
|
|
|
|
- else begin
|
|
|
|
- FParamsAll[total] := TRttiVmtMethodParameter.Create(param);
|
|
|
|
- context.AddObject(FParamsAll[total]);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- if not (pfHidden in param^.Flags) then begin
|
|
|
|
- FParams[visible] := FParamsAll[total];
|
|
|
|
- Inc(visible);
|
|
|
|
- end;
|
|
|
|
|
|
+ total := 0;
|
|
|
|
+ visible := 0;
|
|
|
|
+ param := FIntfMethodEntry^.Param[0];
|
|
|
|
+ while total < FIntfMethodEntry^.ParamCount do begin
|
|
|
|
+ obj := context.GetByHandle(param);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ FParamsAll[total] := obj as TRttiVmtMethodParameter
|
|
|
|
+ else begin
|
|
|
|
+ FParamsAll[total] := TRttiVmtMethodParameter.Create(param);
|
|
|
|
+ context.AddObject(FParamsAll[total]);
|
|
|
|
+ end;
|
|
|
|
|
|
- param := param^.Next;
|
|
|
|
- Inc(total);
|
|
|
|
|
|
+ if not (pfHidden in param^.Flags) then begin
|
|
|
|
+ FParams[visible] := FParamsAll[total];
|
|
|
|
+ Inc(visible);
|
|
end;
|
|
end;
|
|
|
|
|
|
- if visible <> total then
|
|
|
|
- SetLength(FParams, visible);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+ param := param^.Next;
|
|
|
|
+ Inc(total);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ if visible <> total then
|
|
|
|
+ SetLength(FParams, visible);
|
|
|
|
+
|
|
if aWithHidden then
|
|
if aWithHidden then
|
|
Result := FParamsAll
|
|
Result := FParamsAll
|
|
else
|
|
else
|
|
@@ -5924,15 +5872,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiIndexedProperty.GetPropertyType: TRttiType;
|
|
function TRttiIndexedProperty.GetPropertyType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FPropInfo^.PropType);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FPropInfo^.PropType);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TRttiIndexedProperty.ResolveIndexParams;
|
|
procedure TRttiIndexedProperty.ResolveIndexParams;
|
|
@@ -5947,32 +5888,28 @@ begin
|
|
visible := 0;
|
|
visible := 0;
|
|
SetLength(FParams,FPropInfo^.PropParams^.Count);
|
|
SetLength(FParams,FPropInfo^.PropParams^.Count);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- param := @FPropInfo^.PropParams^.Params[0];
|
|
|
|
- while total < FPropInfo^.PropParams^.Count do
|
|
|
|
- begin
|
|
|
|
- obj := context.GetByHandle(param);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- prtti := obj as TRttiVmtMethodParameter
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
- context.AddObject(prtti);
|
|
|
|
- end;
|
|
|
|
- FParams[total]:=prtti;
|
|
|
|
- if not (pfHidden in param^.Flags) then
|
|
|
|
|
|
+ param := @FPropInfo^.PropParams^.Params[0];
|
|
|
|
+ while total < FPropInfo^.PropParams^.Count do
|
|
|
|
+ begin
|
|
|
|
+ obj := context.GetByHandle(param);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ prtti := obj as TRttiVmtMethodParameter
|
|
|
|
+ else
|
|
begin
|
|
begin
|
|
- FParams[visible] := prtti;
|
|
|
|
- Inc(visible);
|
|
|
|
|
|
+ prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
+ context.AddObject(prtti);
|
|
end;
|
|
end;
|
|
- param := param^.Next;
|
|
|
|
- Inc(total);
|
|
|
|
|
|
+ FParams[total]:=prtti;
|
|
|
|
+ if not (pfHidden in param^.Flags) then
|
|
|
|
+ begin
|
|
|
|
+ FParams[visible] := prtti;
|
|
|
|
+ Inc(visible);
|
|
end;
|
|
end;
|
|
- if visible <> total then
|
|
|
|
- SetLength(FParams, visible);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+ param := param^.Next;
|
|
|
|
+ Inc(total);
|
|
end;
|
|
end;
|
|
|
|
+ if visible <> total then
|
|
|
|
+ SetLength(FParams, visible);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiIndexedProperty.GetIndexParameters: TRttiParameterArray;
|
|
function TRttiIndexedProperty.GetIndexParameters: TRttiParameterArray;
|
|
@@ -6354,29 +6291,25 @@ begin
|
|
|
|
|
|
if FTypeData^.ParamCount > 0 then begin
|
|
if FTypeData^.ParamCount > 0 then begin
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- paramtypes := PPPTypeInfo(AlignTypeData(ptr));
|
|
|
|
- visible := 0;
|
|
|
|
- for i := 0 to FTypeData^.ParamCount - 1 do begin
|
|
|
|
- obj := context.GetByHandle(infos[i].Handle);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- FParamsAll[i] := obj as TRttiMethodTypeParameter
|
|
|
|
- else begin
|
|
|
|
- if Assigned(paramtypes[i]) then
|
|
|
|
- paramtype := paramtypes[i]^
|
|
|
|
- else
|
|
|
|
- paramtype := Nil;
|
|
|
|
- FParamsAll[i] := TRttiMethodTypeParameter.Create(infos[i].Handle, infos[i].Name, infos[i].Flags, paramtype);
|
|
|
|
- context.AddObject(FParamsAll[i]);
|
|
|
|
- end;
|
|
|
|
|
|
+ paramtypes := PPPTypeInfo(AlignTypeData(ptr));
|
|
|
|
+ visible := 0;
|
|
|
|
+ for i := 0 to FTypeData^.ParamCount - 1 do begin
|
|
|
|
+ obj := context.GetByHandle(infos[i].Handle);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ FParamsAll[i] := obj as TRttiMethodTypeParameter
|
|
|
|
+ else begin
|
|
|
|
+ if Assigned(paramtypes[i]) then
|
|
|
|
+ paramtype := paramtypes[i]^
|
|
|
|
+ else
|
|
|
|
+ paramtype := Nil;
|
|
|
|
+ FParamsAll[i] := TRttiMethodTypeParameter.Create(infos[i].Handle, infos[i].Name, infos[i].Flags, paramtype);
|
|
|
|
+ context.AddObject(FParamsAll[i]);
|
|
|
|
+ end;
|
|
|
|
|
|
- if not (pfHidden in infos[i].Flags) then begin
|
|
|
|
- FParams[visible] := FParamsAll[i];
|
|
|
|
- Inc(visible);
|
|
|
|
- end;
|
|
|
|
|
|
+ if not (pfHidden in infos[i].Flags) then begin
|
|
|
|
+ FParams[visible] := FParamsAll[i];
|
|
|
|
+ Inc(visible);
|
|
end;
|
|
end;
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6454,30 +6387,25 @@ begin
|
|
SetLength(FParams, FTypeData^.ProcSig.ParamCount);
|
|
SetLength(FParams, FTypeData^.ProcSig.ParamCount);
|
|
|
|
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- param := AlignToPtr(PProcedureParam(@FTypeData^.ProcSig.ParamCount + SizeOf(FTypeData^.ProcSig.ParamCount)));
|
|
|
|
- visible := 0;
|
|
|
|
- for i := 0 to FTypeData^.ProcSig.ParamCount - 1 do begin
|
|
|
|
- obj := context.GetByHandle(param);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- FParamsAll[i] := obj as TRttiMethodTypeParameter
|
|
|
|
- else begin
|
|
|
|
- FParamsAll[i] := TRttiMethodTypeParameter.Create(param, param^.Name, param^.ParamFlags, param^.ParamType);
|
|
|
|
- context.AddObject(FParamsAll[i]);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- if not (pfHidden in param^.ParamFlags) then begin
|
|
|
|
- FParams[visible] := FParamsAll[i];
|
|
|
|
- Inc(visible);
|
|
|
|
- end;
|
|
|
|
|
|
+ param := AlignToPtr(PProcedureParam(@FTypeData^.ProcSig.ParamCount + SizeOf(FTypeData^.ProcSig.ParamCount)));
|
|
|
|
+ visible := 0;
|
|
|
|
+ for i := 0 to FTypeData^.ProcSig.ParamCount - 1 do begin
|
|
|
|
+ obj := context.GetByHandle(param);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ FParamsAll[i] := obj as TRttiMethodTypeParameter
|
|
|
|
+ else begin
|
|
|
|
+ FParamsAll[i] := TRttiMethodTypeParameter.Create(param, param^.Name, param^.ParamFlags, param^.ParamType);
|
|
|
|
+ context.AddObject(FParamsAll[i]);
|
|
|
|
+ end;
|
|
|
|
|
|
- param := PProcedureParam(AlignToPtr(PByte(@param^.Name) + Length(param^.Name) + SizeOf(param^.Name[0])));
|
|
|
|
|
|
+ if not (pfHidden in param^.ParamFlags) then begin
|
|
|
|
+ FParams[visible] := FParamsAll[i];
|
|
|
|
+ Inc(visible);
|
|
end;
|
|
end;
|
|
|
|
|
|
- SetLength(FParams, visible);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+ param := PProcedureParam(AlignToPtr(PByte(@param^.Name) + Length(param^.Name) + SizeOf(param^.Name[0])));
|
|
end;
|
|
end;
|
|
|
|
+ SetLength(FParams, visible);
|
|
|
|
|
|
if aWithHidden then
|
|
if aWithHidden then
|
|
Result := FParamsAll
|
|
Result := FParamsAll
|
|
@@ -6491,18 +6419,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiProcedureType.GetReturnType: TRttiType;
|
|
function TRttiProcedureType.GetReturnType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(FTypeData^.ProcSig.ResultTypeRef) then
|
|
|
|
- Exit(Nil);
|
|
|
|
-
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FTypeData^.ProcSig.ResultTypeRef^);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(FTypeData^.ProcSig.ResultTypeRef) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FTypeData^.ProcSig.ResultTypeRef^);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiProcedureType.GetFlags: TFunctionCallFlags;
|
|
function TRttiProcedureType.GetFlags: TFunctionCallFlags;
|
|
@@ -6596,24 +6516,20 @@ begin
|
|
SetLength(fDeclaredMethods, methtable^.Count);
|
|
SetLength(fDeclaredMethods, methtable^.Count);
|
|
|
|
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- method := methtable^.Method[0];
|
|
|
|
- count := methtable^.Count;
|
|
|
|
- while count > 0 do begin
|
|
|
|
- index := methtable^.Count - count;
|
|
|
|
- obj := context.GetByHandle(method);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- fDeclaredMethods[index] := obj as TRttiMethod
|
|
|
|
- else begin
|
|
|
|
- fDeclaredMethods[index] := TRttiIntfMethod.Create(Self, method, parentmethodcount + index);
|
|
|
|
- context.AddObject(fDeclaredMethods[index]);
|
|
|
|
- end;
|
|
|
|
-
|
|
|
|
- method := method^.Next;
|
|
|
|
- Dec(count);
|
|
|
|
|
|
+ method := methtable^.Method[0];
|
|
|
|
+ count := methtable^.Count;
|
|
|
|
+ while count > 0 do begin
|
|
|
|
+ index := methtable^.Count - count;
|
|
|
|
+ obj := context.GetByHandle(method);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ fDeclaredMethods[index] := obj as TRttiMethod
|
|
|
|
+ else begin
|
|
|
|
+ fDeclaredMethods[index] := TRttiIntfMethod.Create(Self, method, parentmethodcount + index);
|
|
|
|
+ context.AddObject(fDeclaredMethods[index]);
|
|
end;
|
|
end;
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+
|
|
|
|
+ method := method^.Next;
|
|
|
|
+ Dec(count);
|
|
end;
|
|
end;
|
|
|
|
|
|
Result := fDeclaredMethods;
|
|
Result := fDeclaredMethods;
|
|
@@ -6632,15 +6548,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiInstanceType.GetBaseType: TRttiType;
|
|
function TRttiInstanceType.GetBaseType: TRttiType;
|
|
-var
|
|
|
|
- AContext: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- AContext := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- result := AContext.GetType(FTypeData^.ParentInfo);
|
|
|
|
- finally
|
|
|
|
- AContext.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ result := TRttiContext.Create(FUsePublishedOnly).GetType(FTypeData^.ParentInfo);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiInstanceType.GetIsInstance: boolean;
|
|
function TRttiInstanceType.GetIsInstance: boolean;
|
|
@@ -6802,17 +6711,13 @@ Var
|
|
|
|
|
|
begin
|
|
begin
|
|
Tbl:=Nil;
|
|
Tbl:=Nil;
|
|
- Len:=GetFieldList(FTypeInfo,Tbl,[],False);
|
|
|
|
- SetLength(FDeclaredFields,Len);
|
|
|
|
- FFieldsResolved:=True;
|
|
|
|
- if Len=0 then
|
|
|
|
- begin
|
|
|
|
- if Assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- Ctx:=TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
try
|
|
try
|
|
|
|
+ Len:=GetFieldList(FTypeInfo,Tbl,[],False);
|
|
|
|
+ SetLength(FDeclaredFields,Len);
|
|
|
|
+ FFieldsResolved:=True;
|
|
|
|
+ if Len=0 then
|
|
|
|
+ exit;
|
|
|
|
+ Ctx:=TRttiContext.Create(FUsePublishedOnly);
|
|
For I:=0 to Len-1 do
|
|
For I:=0 to Len-1 do
|
|
begin
|
|
begin
|
|
aData:=Tbl^[i];
|
|
aData:=Tbl^[i];
|
|
@@ -6831,9 +6736,7 @@ begin
|
|
FDeclaredFields[I]:=Fld;
|
|
FDeclaredFields[I]:=Fld;
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
- if Assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- Ctx.Free;
|
|
|
|
|
|
+ FreeMem(Tbl);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6882,9 +6785,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
- if assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- Ctx.Free;
|
|
|
|
|
|
+ FreeMem(Tbl);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6926,15 +6827,11 @@ begin
|
|
Tbl:=Nil;
|
|
Tbl:=Nil;
|
|
Len:=GetFieldList(FTypeInfo,Tbl);
|
|
Len:=GetFieldList(FTypeInfo,Tbl);
|
|
FFieldsResolved:=True;
|
|
FFieldsResolved:=True;
|
|
- if Len=0 then
|
|
|
|
- begin
|
|
|
|
- if assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- SetLength(FDeclaredFields,Len);
|
|
|
|
- Ctx:=TRttiContext.Create(Self.FUsePublishedOnly);
|
|
|
|
try
|
|
try
|
|
|
|
+ if Len=0 then
|
|
|
|
+ exit;
|
|
|
|
+ SetLength(FDeclaredFields,Len);
|
|
|
|
+ Ctx:=TRttiContext.Create(Self.FUsePublishedOnly);
|
|
For I:=0 to Len-1 do
|
|
For I:=0 to Len-1 do
|
|
begin
|
|
begin
|
|
aData:=Tbl^[i];
|
|
aData:=Tbl^[i];
|
|
@@ -6954,9 +6851,7 @@ begin
|
|
end;
|
|
end;
|
|
FFields:=FDeclaredFields;
|
|
FFields:=FDeclaredFields;
|
|
finally
|
|
finally
|
|
- if assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- Ctx.Free;
|
|
|
|
|
|
+ FreeMem(Tbl);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -6974,15 +6869,11 @@ begin
|
|
if FUsePublishedOnly then
|
|
if FUsePublishedOnly then
|
|
exit;
|
|
exit;
|
|
aCount:=GetMethodList(FTypeInfo,Tbl,[]);
|
|
aCount:=GetMethodList(FTypeInfo,Tbl,[]);
|
|
- if aCount=0 then
|
|
|
|
- begin
|
|
|
|
- if assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- exit;
|
|
|
|
- end;
|
|
|
|
- SetLength(FDeclaredMethods,aCount);
|
|
|
|
- Ctx:=TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
try
|
|
try
|
|
|
|
+ if aCount=0 then
|
|
|
|
+ exit;
|
|
|
|
+ SetLength(FDeclaredMethods,aCount);
|
|
|
|
+ Ctx:=TRttiContext.Create(FUsePublishedOnly);
|
|
Idx:=0;
|
|
Idx:=0;
|
|
For I:=0 to aCount-1 do
|
|
For I:=0 to aCount-1 do
|
|
begin
|
|
begin
|
|
@@ -7000,9 +6891,7 @@ begin
|
|
Inc(Idx);
|
|
Inc(Idx);
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
- if assigned(Tbl) then
|
|
|
|
- FreeMem(Tbl);
|
|
|
|
- Ctx.Free;
|
|
|
|
|
|
+ FreeMem(Tbl);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -7202,15 +7091,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiProperty.GetPropertyType: TRttiType;
|
|
function TRttiProperty.GetPropertyType: TRttiType;
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FPropInfo^.PropType);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FPropInfo^.PropType);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiProperty.GetIsReadable: boolean;
|
|
function TRttiProperty.GetIsReadable: boolean;
|
|
@@ -8441,8 +8323,6 @@ begin
|
|
{$IFDEF DEBUG_VIRTINTF}Writeln('Freeing VMT');{$ENDIF}
|
|
{$IFDEF DEBUG_VIRTINTF}Writeln('Freeing VMT');{$ENDIF}
|
|
if Assigned(fVmt) then
|
|
if Assigned(fVmt) then
|
|
FreeMem(fVmt);
|
|
FreeMem(fVmt);
|
|
- {$IFDEF DEBUG_VIRTINTF}Writeln('Freeing Context');{$ENDIF}
|
|
|
|
- fContext.Free;
|
|
|
|
{$IFDEF DEBUG_VIRTINTF}Writeln('Done');{$ENDIF}
|
|
{$IFDEF DEBUG_VIRTINTF}Writeln('Done');{$ENDIF}
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
@@ -8521,18 +8401,10 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRecordMethod.GetReturnType: TRttiType;
|
|
function TRttiRecordMethod.GetReturnType: TRttiType;
|
|
-
|
|
|
|
-var
|
|
|
|
- context: TRttiContext;
|
|
|
|
begin
|
|
begin
|
|
- if not Assigned(FHandle^.ResultType) then
|
|
|
|
- Exit(Nil);
|
|
|
|
- context := TRttiContext.Create(FUsePublishedOnly);
|
|
|
|
- try
|
|
|
|
- Result := context.GetType(FHandle^.ResultType^);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
- end;
|
|
|
|
|
|
+ Result := nil;
|
|
|
|
+ if Assigned(FHandle^.ResultType) then
|
|
|
|
+ Result := TRttiContext.Create(FUsePublishedOnly).GetType(FHandle^.ResultType^);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRecordMethod.GetDispatchKind: TDispatchKind;
|
|
function TRttiRecordMethod.GetDispatchKind: TDispatchKind;
|
|
@@ -8591,32 +8463,28 @@ begin
|
|
SetLength(FParams[True],FHandle^.ParamCount);
|
|
SetLength(FParams[True],FHandle^.ParamCount);
|
|
|
|
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
context := TRttiContext.Create(FUsePublishedOnly);
|
|
- try
|
|
|
|
- param := FHandle^.Param[0];
|
|
|
|
- while total < FHandle^.ParamCount do
|
|
|
|
|
|
+ param := FHandle^.Param[0];
|
|
|
|
+ while total < FHandle^.ParamCount do
|
|
|
|
+ begin
|
|
|
|
+ obj := context.GetByHandle(param);
|
|
|
|
+ if Assigned(obj) then
|
|
|
|
+ prtti := obj as TRttiVmtMethodParameter
|
|
|
|
+ else
|
|
begin
|
|
begin
|
|
- obj := context.GetByHandle(param);
|
|
|
|
- if Assigned(obj) then
|
|
|
|
- prtti := obj as TRttiVmtMethodParameter
|
|
|
|
- else
|
|
|
|
- begin
|
|
|
|
- prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
- context.AddObject(prtti);
|
|
|
|
- end;
|
|
|
|
- FParams[True][total]:=prtti;
|
|
|
|
- if not (pfHidden in param^.Flags) then
|
|
|
|
- begin
|
|
|
|
- FParams[False][visible]:=prtti;
|
|
|
|
- Inc(visible);
|
|
|
|
- end;
|
|
|
|
- param := param^.Next;
|
|
|
|
- Inc(total);
|
|
|
|
- end;
|
|
|
|
- if visible <> total then
|
|
|
|
- SetLength(FParams[False], visible);
|
|
|
|
- finally
|
|
|
|
- context.Free;
|
|
|
|
|
|
+ prtti := TRttiVmtMethodParameter.Create(param);
|
|
|
|
+ context.AddObject(prtti);
|
|
|
|
+ end;
|
|
|
|
+ FParams[True][total]:=prtti;
|
|
|
|
+ if not (pfHidden in param^.Flags) then
|
|
|
|
+ begin
|
|
|
|
+ FParams[False][visible]:=prtti;
|
|
|
|
+ Inc(visible);
|
|
|
|
+ end;
|
|
|
|
+ param := param^.Next;
|
|
|
|
+ Inc(total);
|
|
end;
|
|
end;
|
|
|
|
+ if visible <> total then
|
|
|
|
+ SetLength(FParams[False], visible);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TRttiRecordMethod.GetParameters(aWithHidden : Boolean): TRttiParameterArray;
|
|
function TRttiRecordMethod.GetParameters(aWithHidden : Boolean): TRttiParameterArray;
|