Skip to content

Commit

Permalink
ChangeSet>>#methodsWithoutComments was using #firstPrecodeCommentFor:…
Browse files Browse the repository at this point in the history
… just for testing if the method has a comment.

It is much nicer to add a method that checks if a method has a method comment and use that. This way we can easily deprecate #firstPrecodeCommentFor:  later
  • Loading branch information
MarcusDenker committed Jun 10, 2020
1 parent 32d237b commit c3598fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Kernel-Tests-Extended/CompiledMethodTest.class.st
Expand Up @@ -405,6 +405,11 @@ CompiledMethodTest >> testEqualityInstanceSideMethod [
self assert: method1 equals: method2
]

{ #category : #'tests - testing' }
CompiledMethodTest >> testHasComment [
self assert: (CompiledMethod>>#hasComment) hasComment
]

{ #category : #'tests - instance variable' }
CompiledMethodTest >> testHasInstVarRef [

Expand Down
6 changes: 6 additions & 0 deletions src/Kernel/CompiledMethod.class.st
Expand Up @@ -448,6 +448,12 @@ CompiledMethod >> getSourceReplacingSelectorWith: newSelector [
^newSource
]

{ #category : #testing }
CompiledMethod >> hasComment [
"check if this method has a method comment"
^self comment isEmptyOrNil not
]

{ #category : #'accessing-pragmas & properties' }
CompiledMethod >> hasPragmaNamed: aSymbol [
^ self pragmas anySatisfy: [ :pragma | pragma selector = aSymbol ]
Expand Down
2 changes: 1 addition & 1 deletion src/System-Changes/ChangeSet.class.st
Expand Up @@ -1206,7 +1206,7 @@ ChangeSet >> methodsWithoutComments [
(self methodChangesAtClass: aClass name) associationsDo:
[:mAssoc | (#(remove addedThenRemoved) includes: mAssoc value) ifFalse:
[(aClass includesSelector: mAssoc key) ifTrue:
[(aClass firstPrecodeCommentFor: mAssoc key) isEmptyOrNil
[(aClass>>mAssoc key) hasComment
ifTrue: [slips add: aClass name , ' ' , mAssoc key]]]]].
^ slips

Expand Down

0 comments on commit c3598fe

Please sign in to comment.