'From Squeak5.3beta of 27 December 2019 [latest update: #19297] on 28 December 2019 at 3:52:34 pm'! !BlockNode methodsFor: 'closure analysis' stamp: 'ct 12/28/2019 15:51'! blockExtent "^" ^blockExtent! ! !BlockNode methodsFor: 'closure analysis' stamp: 'ct 12/28/2019 15:34'! computeCopiedValues: rootNode | referencedValues | blockExtent ifNil: [^ #()]. referencedValues := rootNode referencedValuesWithinBlockExtent: blockExtent. ^(referencedValues reject: [:temp| temp isDefinedWithinBlockExtent: blockExtent]) asArray sort: ParseNode tempSortBlock! ! !BlockNode methodsFor: 'closure analysis' stamp: 'ct 12/28/2019 15:33'! reindexingLocalsDo: aBlock encoder: encoderOrNil "Evaluate aBlock wih arguments, temporaries and copiedValues reindexed for their positions within the receiver's block, restoring the correct indices afterwards. If encoder is not nil remember the temps for this block's extent." | tempIndices result tempsToReindex | self assert: copiedValues notNil. tempsToReindex := arguments asArray, copiedValues, temporaries. tempIndices := tempsToReindex collect: [:temp| temp index]. tempsToReindex withIndexDo: [:temp :newIndex| temp index: newIndex - 1. self assert: temp index + 1 = newIndex]. encoderOrNil ifNotNil: [blockExtent ifNotNil: [encoderOrNil noteBlockExtent: blockExtent hasLocals: tempsToReindex]]. result := aBlock ensure: ["Horribly pragmatic hack. The copiedValues will have completely unrelated indices within the closure method and sub-method. Avoiding the effort of rebinding temps in the inner scope simply update the indices to their correct ones during the generation of the closure method and restore the indices immedately there-after." tempsToReindex with: tempIndices do: [:temp :oldIndex| temp index: oldIndex. self assert: temp index = oldIndex]]. ^result! !