|
Ring is the way to go. It may cost a bit of effort but the extensions possibly and building of new tools will be huge.
Stef
removedMethod: string with: chgRec
| class tokens |
tokens := Scanner new scanTokens: string.
(tokens size = 3 and:[(tokens at: 2) == #removeSelector: ]) ifTrue:[
class := self getClass: (tokens at: 1).
^class removeSelector: (tokens at: 3).
].
(tokens size = 4 and:[(tokens at: 2) == #class and:[(tokens at: 3) == #removeSelector:]]) ifTrue:[
class := self getClass: (tokens at: 1).
^class metaClass removeSelector: (tokens at: 4).
].
doIts add: chgRec
or
contentsDiffedFromCurrent
"Answer the contents diffed forward from current (in-memory) method version"
| aChange aClass |
listIndex = 0
ifTrue: [^ ''].
aChange := changeList at: listIndex.
(aChange type == #method
and: [(aClass := aChange methodClass) notNil
and: [aClass includesSelector: aChange methodSelector]]) ifTrue:
[^TextDiffBuilder
buildDisplayPatchFrom: (aClass sourceCodeAt: aChange methodSelector)
to: aChange text
inClass: aClass
prettyDiffs: self showingPrettyDiffs].
aChange type == #doIt ifTrue:
[| tokens |
tokens := Scanner new scanTokens: aChange string.
((tokens select:
[:substr| #(subclass: variableByteSubclass: variableWordSubclass:
instanceVariableNames: classVariableNames: ) includes: substr])
asSet size >= 3
and: [(aClass := Smalltalk globals at: tokens third ifAbsent: []) notNil
and: [aClass isBehavior]]) ifTrue:
[^TextDiffBuilder buildDisplayPatchFrom: aClass definition to: aChange string].
(tokens size = 4
and: [tokens second == #class
and: [tokens third == #instanceVariableNames:
and: [(aClass := Smalltalk globals at: tokens first ifAbsent: []) notNil
and: [aClass isBehavior]]]]) ifTrue:
[^TextDiffBuilder buildDisplayPatchFrom: aClass class definition to: aChange string]].
(aChange type == #classComment
and: [(aClass := aChange commentClass) notNil]) ifTrue:
[^TextDiffBuilder buildDisplayPatchFrom: aClass comment asString to: aChange string].
^(changeList at: listIndex) text
|