Skip to content

Commit

Permalink
Merge pull request #6866 from MarcusDenker/simplify-ReIvarNeitherRead…
Browse files Browse the repository at this point in the history
…NorWrittenRule

simplify-ReIvarNeitherReadNorWrittenRule
  • Loading branch information
MarcusDenker committed Jul 17, 2020
2 parents acb5f9d + f6d07a2 commit a9f7088
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/GeneralRules/ReIvarNeitherReadNorWrittenRule.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,9 @@ ReIvarNeitherReadNorWrittenRule class >> checksClass [

{ #category : #enumerating }
ReIvarNeitherReadNorWrittenRule >> check: aClass forCritiquesDo: aCriticBlock [
| methods |

methods := aClass withAllSubclasses flatCollect: #methods.

aClass slots
select: [ :slot |
| read written |
read := written := false.
methods noneSatisfy: [ :method |
read := read or: [ method readsSlot: slot ].
written := written or: [ method writesSlot: slot ].
read and: [ written ] ] ]
thenDo: [ :slot |
aCriticBlock cull:
(self critiqueFor: aClass about: slot) ]
select: [ :slot | slot isReferenced not ]
thenDo: [ :slot | aCriticBlock cull: (self critiqueFor: aClass about: slot) ]
]

{ #category : #enumerating }
Expand Down

0 comments on commit a9f7088

Please sign in to comment.