Skip to content

Commit 4f8b9f2

Browse files
committed
Minor refactoring of TExposedIndexedProperty
1 parent a3c86bc commit 4f8b9f2

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

Source/WrapDelphi.pas

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,16 +1284,11 @@ TPyIndexedProperty = class(TPyObject)
12841284
function MpAssSubscript(obj1, obj2: PPyObject) : Integer; override;
12851285
end;
12861286

1287-
TExposedIndexedProperty = class(TAbstractExposedMember)
1288-
private
1289-
FGetterCallback: Pointer;
1290-
function GetGetterCallback: Pointer;
1287+
TExposedIndexedProperty = class(TExposedGetSet)
12911288
protected
12921289
function GetDefaultDocString(): string; override;
12931290
public
1294-
destructor Destroy; override;
1295-
function GetterWrapper(AObj: PPyObject; AContext : Pointer): PPyObject; cdecl;
1296-
property GetterCallback: Pointer read GetGetterCallback;
1291+
function GetterWrapper(AObj: PPyObject; AContext : Pointer): PPyObject; override; cdecl;
12971292
end;
12981293

12991294
TRttiEventHandler = class(TBaseEventHandler)
@@ -1610,18 +1605,6 @@ function TExposedEvent.SetterWrapper(AObj, AValue: PPyObject; AContext: Pointer)
16101605
end;
16111606

16121607
{ TExposedIndexedProperty }
1613-
function TExposedIndexedProperty.GetGetterCallback: Pointer;
1614-
var
1615-
Method: function (AObj: PPyObject; AContext : Pointer): PPyObject of object; cdecl;
1616-
begin
1617-
if FGetterCallback = nil then
1618-
begin
1619-
Method := GetterWrapper;
1620-
FGetterCallback := GetOfObjectCallBack(TCallBack(Method), 2, DEFAULT_CALLBACK_TYPE);
1621-
end;
1622-
Result := FGetterCallback;
1623-
end;
1624-
16251608
function TExposedIndexedProperty.GetDefaultDocString(): string;
16261609
var
16271610
PropertyType: string;
@@ -1633,13 +1616,7 @@ function TExposedIndexedProperty.GetDefaultDocString(): string;
16331616
FParentRtti.Name, FRttiMember.Name, PropertyType]);
16341617
end;
16351618

1636-
destructor TExposedIndexedProperty.Destroy;
1637-
begin
1638-
if FGetterCallback <> nil then
1639-
DeleteCallback(FGetterCallback);
1640-
end;
1641-
1642-
function TExposedIndexedProperty.GetterWrapper(AObj: PPyObject; AContext : Pointer): PPyObject; cdecl;
1619+
function TExposedIndexedProperty.GetterWrapper(AObj: PPyObject; AContext : Pointer): PPyObject;
16431620
var
16441621
HelperType: TPythonType;
16451622
begin

0 commit comments

Comments
 (0)