The Trunk: Compiler-mt.358.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compiler-mt.358.mcz

commits-2
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!