Skip to content

Commit

Permalink
simplify ReIvarNeitherReadNorWrittenRule by using the new, fast #isRe…
Browse files Browse the repository at this point in the history
…ferenced implementation
  • Loading branch information
MarcusDenker committed Jul 16, 2020
1 parent 91d888c commit f6d07a2
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/GeneralRules/ReIvarNeitherReadNorWrittenRule.class.st
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 f6d07a2

Please sign in to comment.