[squeak-dev] How do I replace a call SmalltalkImage>>associationAt:ifAbsent:? (Environments)

H. Hirzel hannes.hirzel at gmail.com
Mon Oct 9 10:06:28 UTC 2017

Note: ScriptEncoder belongs to Etoys

EncoderForV3PlusClosures subclass: #ScriptEncoder
	instanceVariableNames: 'referenceObject'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Etoys-Squeakland-System-Compiler'

Maybe the fix has to be done earlier in the method #allLiterals


	addedSelectorAndMethodClassLiterals ifFalse:
		[addedSelectorAndMethodClassLiterals := true.
		"Put the optimized selectors in literals so as to browse senders more easily"
		optimizedSelectors := optimizedSelectors reject: [:e| literalStream
originalContents hasLiteral: e].
		optimizedSelectors isEmpty ifFalse: [
			"Use one entry per literal if enough room, else make anArray"
			literalStream position + optimizedSelectors size + 2 >= self maxNumLiterals
				ifTrue: [self litIndex: optimizedSelectors asArray]
				ifFalse: [optimizedSelectors do: [:e | self litIndex: e]]].
		"Add a slot for selector or MethodProperties"
		self litIndex: nil.
		self litIndex: self associationForClass].
	^literalStream contents

On 10/9/17, H. Hirzel <hannes.hirzel at gmail.com> wrote:
> Hello
> How do I replace a call SmalltalkImage>>associationAt:ifAbsent:?
> ScriptEncoder>>associationForClass
> 	| assoc |
> 	assoc := self environment associationAt: cue getClass name ifAbsent:
> [nil].
> 	^assoc value == cue getClass
> 		ifTrue: [assoc]
> 		ifFalse: [Association new value: cue getClass]
> SmalltalkImage>>associationAt: key ifAbsent: aBlock
> 	"Obsoleted."
> 	self deprecated: 'Use Smalltalk globals'.
> 	^globals associationAt: key ifAbsent: aBlock
> A direct replacement does not work.
> Kind regards
> Hannes

More information about the Squeak-dev mailing list