Marcel Taeumel uploaded a new version of Kernel to project The Treated Inbox: http://source.squeak.org/treated/Kernel-jar.1499.mcz
==================== Summary ====================
Name: Kernel-jar.1499 Author: jar Time: 2 February 2023, 3:02:46.508164 pm UUID: e69bd0f7-980e-2f42-90db-171af597b735 Ancestors: Kernel-tpr.1497
Remove code duplicity in Context>>#restart, #resume:through: and #resumeEvaluating: while keeping the current unwind semantics.
=============== Diff against Kernel-tpr.1497 ===============
Item was changed: ----- Method: Context>>restart (in category 'controlling') ----- restart + "Unwind thisContext to self and resume from beginning. + Execute unwind blocks when unwinding. + ASSUMES self is a sender of thisContext" - "Unwind thisContext to self and resume from beginning. Execute unwind blocks when unwinding. ASSUMES self is a sender of thisContext"
+ ^self resumeEvaluating: [self privRefresh]! - | ctxt unwindBlock | - self isDead ifTrue: [self cannotReturn: nil to: self]. - self privRefresh. - ctxt := thisContext. - [ ctxt := ctxt findNextUnwindContextUpTo: self. - ctxt isNil - ] whileFalse: [ - (ctxt tempAt: 2) ifNil:[ - ctxt tempAt: 2 put: true. - unwindBlock := ctxt tempAt: 1. - thisContext terminateTo: ctxt. - unwindBlock value]. - ]. - thisContext terminateTo: self. - self jump. - !
Item was changed: ----- Method: Context>>resume:through: (in category 'controlling') ----- resume: value through: firstUnwindCtxt "Unwind thisContext to self and resume with value as result of last send. Execute any unwind blocks while unwinding. ASSUMES self is a sender of thisContext."
+ | ctxt | - | ctxt unwindBlock | self isDead ifTrue: [self cannotReturn: value to: self]. ctxt := firstUnwindCtxt. + ctxt unwindTo: self safely: false. - [ctxt isNil] whileFalse: - [(ctxt tempAt: 2) ifNil: - [ctxt tempAt: 2 put: true. - unwindBlock := ctxt tempAt: 1. - thisContext terminateTo: ctxt. - unwindBlock value]. - ctxt := ctxt findNextUnwindContextUpTo: self]. thisContext terminateTo: self. ^value !
Item was changed: ----- Method: Context>>resumeEvaluating: (in category 'controlling') ----- resumeEvaluating: aBlock "Unwind thisContext to self and resume with value as result of last send. + Execute unwind blocks when unwinding. + ASSUMES self is a sender of thisContext" - Execute unwind blocks when unwinding. - ASSUMES self is a sender of thisContext"
+ | ctxt | - | ctxt unwindBlock | self isDead ifTrue: [self cannotReturn: aBlock value to: self]. ctxt := thisContext. + ctxt unwindTo: self safely: false. - [ ctxt := ctxt findNextUnwindContextUpTo: self. - ctxt isNil - ] whileFalse: [ - (ctxt tempAt: 2) ifNil:[ - "(tempAt: 2) refers to complete temporary in ensure: and ifCurtailed: - or any other method marked with <primitive: 198>" - ctxt tempAt: 2 put: true. - unwindBlock := ctxt tempAt: 1. - thisContext terminateTo: ctxt. - unwindBlock value]. - ]. thisContext terminateTo: self. ^ aBlock value !
packages@lists.squeakfoundation.org