The Trunk: Kernel-eem.1057.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.1057.mcz

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

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

Name: Kernel-eem.1057
Author: eem
Time: 7 February 2017, 6:20:56.634789 pm
UUID: 5768ff81-113e-47b1-9855-a6d8277bf6b3
Ancestors: Kernel-dtl.1056

Provide a convenient method for scanning for arbitrary bytecode sequences, where each bytecode is provided as a message.

=============== Diff against Kernel-dtl.1056 ===============

Item was added:
+ ----- Method: InstructionStream>>scanForInstructionSequence: (in category 'scanning') -----
+ scanForInstructionSequence: naryBlock
+ "naryBlock is a block taking one or more arguments.
+ Evaluate it for each sequence of instructions of length
+ n in the receiver until naryBlock evaluates to true.
+ Answer if naryBlock evaluated to true."
+ | instructions |
+ instructions := OrderedCollection withAll: ((1 to: naryBlock numArgs) collect:
+ [:ign|
+ self atEnd ifTrue: [^false].
+ self nextInstruction]).
+ [(naryBlock valueWithArguments: instructions asArray) ifTrue:
+ [^true].
+ self atEnd] whileFalse:
+ [instructions removeFirst; addLast: self nextInstruction].
+ ^false!