The Trunk: Kernel-eem.1209.mcz

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

The Trunk: Kernel-eem.1209.mcz

commits-2
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1209.mcz

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

Name: Kernel-eem.1209
Author: eem
Time: 2 January 2019, 6:30:39.793608 pm
UUID: 5524e880-035b-4429-a52f-72f66eb53756
Ancestors: Kernel-eem.1208

Provide a method that answers the nested block methods in a method compiled with full blocks.  This is somewhat similar to embeddedBlockClosures, but answers the CompiledBlock methods, not representative closures around them, and does not require interpreting code, merely recursively traversing CompiledCode literals.

=============== Diff against Kernel-eem.1208 ===============

Item was added:
+ ----- Method: CompiledMethod>>nestedBlockMethods (in category 'closures') -----
+ nestedBlockMethods
+ "Answer a collection of the block methods of blocks within the receiver, if any."
+ | nestedBlockMethods iterator |
+ nestedBlockMethods := OrderedCollection new.
+ iterator := [:m| | nLits |
+ nLits := m numLiterals.
+ 2 to: (m isCompiledBlock ifTrue: [nLits] ifFalse: [nLits - 1]) do:
+ [:index | | lit |
+ lit := m objectAt: index.
+ lit isCompiledCode ifTrue:
+ [iterator value: (nestedBlockMethods add: lit)]]].
+ iterator value: self.
+ ^nestedBlockMethods
+ !