[squeak-dev] The Trunk: Compiler-mt.358.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Nov 10 14:24:48 UTC 2017


Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.358.mcz

==================== Summary ====================

Name: Compiler-mt.358
Author: mt
Time: 10 November 2017, 3:24:38.351435 pm
UUID: 0e253457-6396-ae48-aad7-b819986854cb
Ancestors: Compiler-eem.357

Adds a way to pretty-print code snippets.

=============== Diff against Compiler-eem.357 ===============

Item was added:
+ ----- Method: Compiler>>formatNoPattern:environment: (in category 'public access') -----
+ formatNoPattern: textOrStream environment: env
+ 	"Pretty-print a code snippet. Removes leading 'DoIt' and the '^' in the last statement. To be used in workspace-like tools."
+ 	
+ 	| aNode |
+ 	self setCue: (CompilationCue
+ 		source: textOrStream
+ 		environment: env).
+ 		
+ 	aNode := self formatNoPattern: true ifFail: [^ nil].
+ 
+ 	^ (aNode decompileString lines allButFirst "DoIt" collect: [:ea |
+ 		ea allButFirst "tab" in: [:result | (result beginsWith: '^') ifTrue: [result allButFirst] ifFalse: [result]]])
+ 			joinSeparatedBy: String cr!



More information about the Squeak-dev mailing list