Smalltalk 编程/概述
外观
removeEventsTriggeredFor: anObject inState: aState "Remove all the events triggered by the receiver which would have been sent to anObject in the given state." | events | events := transitions at: aState ifAbsent: [ ^self ]. events copy keysAndValuesDo: [:evtSym :msgSendSet | | newSet | newSet := msgSendSet reject: [:each | each receiver == anObject and: [ (anObject == self and: [ each selector == #newState: ]) not ] ]. msgSendSet size = newSet size ifFalse: [newSet isEmpty ifTrue: [ events removeKey: evtSym] ifFalse: [ events at: evtSym put: newSet]]].
声明:大量缩进是需要重构代码的标志。CPS