Skip to content

Commit afc76f3

Browse files
committed
removed unnecessary inherited calls
1 parent b0f3bfe commit afc76f3

21 files changed

+24
-132
lines changed

Source/Base/Collections/Spring.Collections.Base.pas

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,6 @@ function TEnumerableBase.Any: Boolean;
800800

801801
constructor TEnumerableBase.Create;
802802
begin
803-
inherited Create;
804-
805803
// child classes must implement IEnumerable<T>
806804
// can use any specialization as they all have the same GUID
807805
Pointer(this) := Pointer(PByte(Self) + GetInterfaceEntry(IEnumerable<Integer>).IOffset);
@@ -810,7 +808,6 @@ constructor TEnumerableBase.Create;
810808
destructor TEnumerableBase.Destroy;
811809
begin
812810
Pointer(this) := nil;
813-
inherited Destroy;
814811
end;
815812

816813
function TEnumerableBase.GetCount: Integer;
@@ -1627,7 +1624,6 @@ function TEnumerableBase<T>.Where(const predicate: Predicate<T>): IEnumerable<T>
16271624
constructor TEnumerableWrapper.Create(const source: IEnumerable;
16281625
getCurrent: TGetCurrentFunc);
16291626
begin
1630-
inherited Create;
16311627
fSource := source;
16321628
fGetCurrent := getCurrent;
16331629
end;
@@ -1672,7 +1668,6 @@ function TEnumerableWrapper.QueryInterface(const IID: TGUID; out obj): HResult;
16721668
constructor TEnumerableWrapper.TEnumerator.Create(const source: IEnumerator;
16731669
elementType: PTypeInfo; getCurrent: TGetCurrentFunc);
16741670
begin
1675-
inherited Create;
16761671
fSource := source;
16771672
fElementType := elementType;
16781673
fGetCurrent := getCurrent;
@@ -2102,7 +2097,6 @@ function TInnerCollection<T>._Release: Integer;
21022097
constructor TInnerCollection<T>.TEnumerator.Create(
21032098
const source: TInnerCollection<T>);
21042099
begin
2105-
inherited Create;
21062100
fSource := source;
21072101
fSource._AddRef;
21082102
fVersion := fSource.fHashTable.Version;
@@ -2111,7 +2105,6 @@ constructor TInnerCollection<T>.TEnumerator.Create(
21112105
destructor TInnerCollection<T>.TEnumerator.Destroy;
21122106
begin
21132107
fSource._Release;
2114-
inherited;
21152108
end;
21162109

21172110
function TInnerCollection<T>.TEnumerator.GetCurrent: T;
@@ -2155,7 +2148,6 @@ function TInnerCollection<T>.TEnumerator.MoveNext: Boolean;
21552148
constructor THashTableEnumerator.Create(const source: TRefCountedObject;
21562149
hashTable: PHashTable);
21572150
begin
2158-
inherited Create;
21592151
fSource := source;
21602152
fSource._AddRef;
21612153
fHashTable := hashTable;
@@ -2165,7 +2157,6 @@ constructor THashTableEnumerator.Create(const source: TRefCountedObject;
21652157
destructor THashTableEnumerator.Destroy;
21662158
begin
21672159
fSource._Release;
2168-
inherited;
21692160
end;
21702161

21712162
function THashTableEnumerator.MoveNext: Boolean;
@@ -2484,7 +2475,6 @@ procedure TCircularArrayBuffer<T>.SetOwnsObjects(value: Boolean);
24842475
constructor TCircularArrayBuffer<T>.TEnumerator.Create(
24852476
const source: TCircularArrayBuffer<T>);
24862477
begin
2487-
inherited Create;
24882478
fSource := source;
24892479
fSource._AddRef;
24902480
fVersion := fSource.fVersion;
@@ -2493,7 +2483,6 @@ constructor TCircularArrayBuffer<T>.TEnumerator.Create(
24932483
destructor TCircularArrayBuffer<T>.TEnumerator.Destroy;
24942484
begin
24952485
fSource._Release;
2496-
inherited Destroy;
24972486
end;
24982487

24992488
function TCircularArrayBuffer<T>.TEnumerator.GetCurrent: T;
@@ -2534,7 +2523,7 @@ destructor TMapBase<TKey, T>.Destroy;
25342523
begin
25352524
fOnValueChanged.Free;
25362525
fOnKeyChanged.Free;
2537-
inherited;
2526+
inherited Destroy;
25382527
end;
25392528

25402529
procedure TMapBase<TKey, T>.DoNotify(const key: TKey; const value: T;
@@ -2615,7 +2604,6 @@ procedure TMapBase<TKey, T>.ValueChanged(const item: T;
26152604
constructor TListBase<T>.Create;
26162605
begin
26172606
inherited Create;
2618-
26192607
Pointer(this) := Pointer(PByte(Self) + GetInterfaceEntry(IList<T>).IOffset);
26202608
end;
26212609

@@ -2972,7 +2960,6 @@ function TArrayIterator<T>.ToArray: TArray<T>;
29722960

29732961
constructor TIterator.Create(source: TRefCountedObject; iterator: PIteratorRec);
29742962
begin
2975-
inherited Create;
29762963
fSource := source;
29772964
fSource._AddRef;
29782965
fIterator := iterator.Clone;
@@ -2983,7 +2970,6 @@ destructor TIterator.Destroy;
29832970
fIterator.Finalize;
29842971
FreeMem(fIterator);
29852972
fSource._Release;
2986-
inherited;
29872973
end;
29882974

29892975
function TIterator.MoveNext: Boolean;
@@ -2996,13 +2982,13 @@ function TIterator.MoveNext: Boolean;
29962982
fState := Finished;
29972983
end;
29982984
if fState = Initial then
2999-
begin
3000-
fState := Started;
2985+
begin
2986+
fState := Started;
30012987
Start;
3002-
end;
2988+
end;
30032989
until fState = Finished;
30042990

3005-
fIterator.Finalize;
2991+
fIterator.Finalize;
30062992
Result := False;
30072993
end;
30082994

@@ -3057,7 +3043,7 @@ function TIteratorRec.TryGetCount(out count: Integer): Boolean;
30573043
count := Math.Min(Self.Count, Source.Count);
30583044
else
30593045
Result := False;
3060-
end;
3046+
end;
30613047
end;
30623048

30633049
function TIteratorRec.GetEnumerator: Boolean;
@@ -3120,9 +3106,9 @@ function TIteratorRec<T>.Concat: Boolean;
31203106
Break;
31213107

31223108
Count := 1;
3123-
PIteratorRec(@Self).GetSecondEnumerator;
3109+
PIteratorRec(@Self).GetSecondEnumerator;
31243110
end;
3125-
Result := False;
3111+
Result := False;
31263112
end;
31273113

31283114
function TIteratorRec<T>.Ordered: Boolean;
@@ -3256,15 +3242,15 @@ function TIteratorRec<T>.Where: Boolean;
32563242
constructor TObjectArrayIterator.Create(const source: TArray<TObject>;
32573243
elementType: PTypeInfo);
32583244
begin
3259-
inherited Create(source);
32603245
fElementType := elementType;
3246+
inherited Create(source);
32613247
end;
32623248

32633249
constructor TObjectArrayIterator.CreateFromArray(source: PPointer;
32643250
count: Integer; elementType: PTypeInfo);
32653251
begin
3266-
inherited Create;
32673252
fElementType := elementType;
3253+
inherited Create;
32683254
fIterator.MoveNext := @TIteratorRec<TObject>.Ordered;
32693255
fIterator.TypeInfo := TypeInfo(TIteratorRec<TObject>);
32703256
if count > 0 then
@@ -3291,15 +3277,15 @@ function TObjectArrayIterator.GetElementType: PTypeInfo;
32913277
constructor TInterfaceArrayIterator.Create(const source: TArray<IInterface>;
32923278
elementType: PTypeInfo);
32933279
begin
3294-
inherited Create(source);
32953280
fElementType := elementType;
3281+
inherited Create(source);
32963282
end;
32973283

32983284
constructor TInterfaceArrayIterator.CreateFromArray(source: PPointer;
32993285
count: Integer; elementType: PTypeInfo);
33003286
begin
3301-
inherited Create;
33023287
fElementType := elementType;
3288+
inherited Create;
33033289
fIterator.MoveNext := @TIteratorRec<IInterface>.Ordered;
33043290
fIterator.TypeInfo := TypeInfo(TIteratorRec<IInterface>);
33053291
if count > 0 then

Source/Base/Collections/Spring.Collections.Dictionaries.pas

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,6 @@ function TBidiDictionary<TKey, TValue>.TInverse._Release: Integer;
21282128
constructor TBidiDictionary<TKey, TValue>.TEnumerator.Create(
21292129
const source: TBidiDictionary<TKey, TValue>);
21302130
begin
2131-
inherited Create;
21322131
fSource := source;
21332132
fSource._AddRef;
21342133
fItemIndex := -1;
@@ -2138,7 +2137,6 @@ constructor TBidiDictionary<TKey, TValue>.TEnumerator.Create(
21382137
destructor TBidiDictionary<TKey, TValue>.TEnumerator.Destroy;
21392138
begin
21402139
fSource._Release;
2141-
inherited Destroy;
21422140
end;
21432141

21442142
function TBidiDictionary<TKey, TValue>.TEnumerator.GetCurrent: TKeyValuePair;
@@ -2679,7 +2677,6 @@ function TSortedDictionary<TKey, TValue>.TryUpdateValue(const key: TKey;
26792677
constructor TSortedDictionary<TKey, TValue>.TEnumerator.Create(
26802678
const source: TSortedDictionary<TKey, TValue>);
26812679
begin
2682-
inherited Create;
26832680
fSource := source;
26842681
fSource._AddRef;
26852682
fVersion := fSource.fVersion;
@@ -2688,7 +2685,6 @@ constructor TSortedDictionary<TKey, TValue>.TEnumerator.Create(
26882685
destructor TSortedDictionary<TKey, TValue>.TEnumerator.Destroy;
26892686
begin
26902687
fSource._Release;
2691-
inherited Destroy;
26922688
end;
26932689

26942690
function TSortedDictionary<TKey, TValue>.TEnumerator.GetCurrent: TKeyValuePair;

Source/Base/Collections/Spring.Collections.Extensions.pas

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ TSelectIndexIterator<TSource, TResult> = class(TIterator<TResult>, IEnumerable
350350

351351
// binary compatible interface to Spring.Collections.ILookup<TKey,TValue> but foldable
352352
ILookupInternal<TKey, TElement> = interface(IEnumerable<IInterface>)
353-
['{B2380533-F2B1-465B-84B2-97FA79A6EE09}']
353+
['{B2380533-F2B1-465B-84B2-97FA79A6EE09}'] //FI:W530
354354
function GetItem(const key: TKey): IEnumerable<TElement>;
355355
function Contains(const key: TKey): Boolean;
356356
end;
@@ -1860,7 +1860,6 @@ constructor TGroupedEnumerable<TSource, TKey, TElement>.TEnumerator.Create(
18601860
const elementSelector: Func<TSource, TElement>;
18611861
const comparer: IEqualityComparer<TKey>);
18621862
begin
1863-
inherited Create;
18641863
fSource := source;
18651864
fKeySelector := keySelector;
18661865
fElementSelector := elementSelector;
@@ -1949,7 +1948,6 @@ constructor TGroupedEnumerable<TSource, TKey, TElement, TResult>.TEnumerator.Cre
19491948
const source: IEnumerator<IInterface>;
19501949
const resultSelector: Func<TKey, IEnumerable<TElement>, TResult>);
19511950
begin
1952-
inherited Create;
19531951
fSource := source;
19541952
fResultSelector := resultSelector;
19551953
end;
@@ -2121,7 +2119,7 @@ procedure TGroupings.Changed(const item: TObject;
21212119
action: TCollectionChangedAction);
21222120
begin
21232121
inherited Changed(item, action);
2124-
case action of
2122+
case action of //FI:W535
21252123
caAdded: TRefCountedObject(item)._AddRef;
21262124
caRemoved: TRefCountedObject(item)._Release;
21272125
end;
@@ -2135,7 +2133,6 @@ procedure TGroupings.Changed(const item: TObject;
21352133
constructor TLookup<TKey, TElement>.TEnumerator.Create(
21362134
const source: TLookup<TKey, TElement>);
21372135
begin
2138-
inherited Create;
21392136
fSource := source;
21402137
fSource._AddRef;
21412138
fIndex := -1;
@@ -2144,7 +2141,6 @@ constructor TLookup<TKey, TElement>.TEnumerator.Create(
21442141
destructor TLookup<TKey, TElement>.TEnumerator.Destroy;
21452142
begin
21462143
fSource._Release;
2147-
inherited;
21482144
end;
21492145

21502146
function TLookup<TKey, TElement>.TEnumerator.GetCurrent: IInterface;
@@ -2722,7 +2718,6 @@ constructor TOrderedEnumerable<T>.TEnumerator.Create(
27222718
Guard.CheckNotNull(Assigned(sorter), 'sorter');
27232719
{$ENDIF}
27242720

2725-
inherited Create;
27262721
fBuffer := source.ToArray;
27272722
fMap := sorter.Sort(fBuffer, Length(fBuffer));
27282723
fIndex := -1;

Source/Base/Collections/Spring.Collections.LinkedLists.pas

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ procedure TLinkedList<T>.ValidateNode(const node: TLinkedListNode<T>);
493493

494494
constructor TLinkedList<T>.TEnumerator.Create(const list: TLinkedList<T>);
495495
begin
496-
inherited Create;
497496
fList := list;
498497
fList._AddRef;
499498
fVersion := fList.fVersion;
@@ -503,7 +502,6 @@ constructor TLinkedList<T>.TEnumerator.Create(const list: TLinkedList<T>);
503502
destructor TLinkedList<T>.TEnumerator.Destroy;
504503
begin
505504
fList._Release;
506-
inherited Destroy;
507505
end;
508506

509507
function TLinkedList<T>.TEnumerator.GetCurrent: T;

Source/Base/Collections/Spring.Collections.Lists.pas

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,6 @@ function TAbstractArrayList<T>.TryGetSingle(var value: T): Boolean;
13131313
constructor TAbstractArrayList<T>.TEnumerator.Create(
13141314
const source: TAbstractArrayList<T>);
13151315
begin
1316-
inherited Create;
13171316
fSource := source;
13181317
fSource._AddRef;
13191318
fVersion := fSource.fVersion;
@@ -1322,7 +1321,6 @@ constructor TAbstractArrayList<T>.TEnumerator.Create(
13221321
destructor TAbstractArrayList<T>.TEnumerator.Destroy;
13231322
begin
13241323
fSource._Release;
1325-
inherited Destroy;
13261324
end;
13271325

13281326
function TAbstractArrayList<T>.TEnumerator.GetCurrent: T;
@@ -1871,7 +1869,6 @@ procedure TCollectionList<T>.TrimExcess;
18711869

18721870
constructor TCollectionList<T>.TEnumerator.Create(const list: TCollectionList<T>);
18731871
begin
1874-
inherited Create;
18751872
fSource := list;
18761873
fSource._AddRef;
18771874
fVersion := fSource.fVersion;
@@ -1880,7 +1877,6 @@ constructor TCollectionList<T>.TEnumerator.Create(const list: TCollectionList<T>
18801877
destructor TCollectionList<T>.TEnumerator.Destroy;
18811878
begin
18821879
fSource._Release;
1883-
inherited Destroy;
18841880
end;
18851881

18861882
function TCollectionList<T>.TEnumerator.GetCurrent: T;

Source/Base/Collections/Spring.Collections.MultiMaps.pas

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ function TValueCollection<T>._Release: Integer;
379379
constructor TMultiMapEnumerator.Create(const source: TRefCountedObject;
380380
hashTable: PHashTable);
381381
begin
382-
inherited Create;
383382
fSource := source;
384383
fSource._AddRef;
385384
fHashTable := hashTable;
@@ -389,7 +388,6 @@ constructor TMultiMapEnumerator.Create(const source: TRefCountedObject;
389388
destructor TMultiMapEnumerator.Destroy;
390389
begin
391390
fSource._Release;
392-
inherited;
393391
end;
394392

395393
function TMultiMapEnumerator.MoveNext: Boolean;
@@ -507,7 +505,6 @@ function TWrappedCollection<T>.ToArray: TArray<T>;
507505
constructor TWrappedCollection<T>.TEnumerator.Create(
508506
const source: TWrappedCollection<T>);
509507
begin
510-
inherited Create;
511508
fSource := source;
512509
fSource._AddRef;
513510
fOriginal := fSource.fDelegate;
@@ -517,7 +514,6 @@ constructor TWrappedCollection<T>.TEnumerator.Create(
517514
destructor TWrappedCollection<T>.TEnumerator.Destroy;
518515
begin
519516
fSource._Release;
520-
inherited;
521517
end;
522518

523519
function TWrappedCollection<T>.TEnumerator.GetCurrent: T;
@@ -719,7 +715,7 @@ procedure TMultiMapBase<TKey, TValue>.DoRemove(const entry: THashTableEntry;
719715
procedure TMultiMapBase<TKey, TValue>.DoValueChanged(sender: TObject;
720716
const item: TValue; action: TCollectionChangedAction);
721717
begin
722-
case action of
718+
case action of //FI:W535
723719
caAdded: Inc(fCount);
724720
caRemoved, caExtracted: Dec(fCount);
725721
end;

0 commit comments

Comments
 (0)