formatting code utility

Bolot Kerimbaev bolot at cc.gatech.edu
Fri Feb 13 06:21:11 UTC 1998


All of you might be using something like this already, but some may find
it useful (it was quicker to write this code than to format each method
individually!). The code below formats all methods in classes specified.


--
Bolot


" formats and accepts all methods "
| ssClass rawCode fmtCode aComp |
aComp _ Object compilerClass new.
" specify your class names in the array "
#(ClassSection Student Assignment) do:
    [:ssClassName |
    ssClass := Smalltalk classNamed: ssClassName.
    ssClass selectors do:
	[:each |
	rawCode := (ssClass sourceCodeAt: each).
	fmtCode := aComp format: rawCode in: ssClass notifying: nil.
	ssClass compile: fmtCode.
	    " this leaves the method in the same category "
	].
    ]





More information about the Squeak-dev mailing list