|
I would like to have a polymorphic API source so that we can either write at the level of the leaves or higher polymorphic code.
For example the pillar fileouter is done that way:
Object subclass: #EpPillarExporter uses: EpTEventVisitor instanceVariableNames: 'file stream' classVariableNames: '' package: 'EpiceaPillarOutputer'
wrappedCode: aChangeEntity stream nextPutAll: '[[['; newLine. stream nextPutAll: (aChangeEntity source copyReplaceAll: Character cr asString with: OSPlatform current lineEnding). stream newLine; nextPutAll: ']]]'; newLine
visitClassChange: aChange self wrappedCode: aChange
visitEvent: aChange "does nothing by default" ^ self
visitMethodChange: aChange
self wrappedCode: aChange
EPClassAddition >> source "Return the current definition. This message is polymorph for modification and methods"
^ class definitionSource
EPClassModification >> source "Return the current definition. This message is polymorph for modification and methods"
^ newClass definitionSource
EPMethodAddition >> source "Return the current definition. This message is polymorph for modification and methods"
^ String streamContents: [ :st | st nextPutAll: self method realClass name asString. self method isMetaSide ifTrue: [ st nextPutAll: ' class' ]. st nextPutAll: ' >> '. st nextPutAll: self method sourceCode ]
EPMethodAddition >> method
^ method
EPMethodModification >> method ^ self newMethod
EPMethodModification >> source
^ String streamContents: [ :st | st nextPutAll: self method realClass name asString. self method isMetaSide ifTrue: [ st nextPutAll: ' class' ]. st nextPutAll: ' >> '. st nextPutAll: self method sourceCode ]
I coded this in the car so once we agree I can do a pass.
|
|
|
Priority: 5 – Fix If Time
|
|
Status: Work Needed
|
|
Assigned to: Everyone
|
|
Milestone: Pharo7.0
|
Go to Case
|
|