Comment #2 on issue 3704 by stephane...@gmail.com: remove FakeClassPool adopt: and its senders http://code.google.com/p/pharo/issues/detail?id=3704 Name: Morphic-nice.519 Author: nice Time: 14 February 2011, 10:22:53.154 pm UUID: d83915ed-3966-4301-9439-0f94337843b6 Ancestors: Morphic-mtf.518 Get rid of FakeClassPool adopt: RATIONALE: 1) this is useless A FakeClassPool instance is used only in case of a nil #doItReceiver, so it is always adopting nil and does not pass any pool of interest. 2) this is useless For a long time, the Compiler no longer needs a FakeClassPool instance in order to access the class and shared variables. Anyway, it was not a nice feature to use a global variable to pass states to the Compiler, was it ? =============== Diff against Morphic-mtf.518 =============== Item was changed: ----- Method: SmalltalkEditor>>tallySelection (in category 'do-its') ----- tallySelection "Treat the current selection as an expression; evaluate it and return the time took for this evaluation" | result rcvr ctxt valueAsString v | self lineSelectAndEmptyCheck: [^ -1]. (model respondsTo: #doItReceiver) + ifTrue: [ rcvr := model doItReceiver. - ifTrue: [FakeClassPool adopt: model selectedClass. "Include model pool vars if any" - rcvr := model doItReceiver. ctxt := model doItContext] ifFalse: [rcvr := ctxt := nil]. result := [ | cm | cm := rcvr class evaluatorClass new compiledMethodFor: self selectionAsStream in: ctxt to: rcvr notifying: self ifFail: [FakeClassPool adopt: nil. ^ #failedDoit] logged: false. Time millisecondsToRun: [v := cm valueWithReceiver: rcvr arguments: #() ]. ] on: OutOfScopeNotification do: [ :ex | ex resume: true]. - FakeClassPool adopt: nil. "We do not want to have large result displayed" valueAsString := v printString. (valueAsString size > 30) ifTrue: [valueAsString := (valueAsString copyFrom: 1 to: 30), '...']. PopUpMenu inform: 'Time to compile and execute: ', result printString, 'ms res: ', valueAsString. ! Item was changed: ----- Method: TextEditor>>debugIt (in category 'do-its') ----- debugIt | method receiver context | (model respondsTo: #doItReceiver) ifTrue: + [receiver := model doItReceiver. - [FakeClassPool adopt: model selectedClass. - receiver := model doItReceiver. context := model doItContext] ifFalse: [receiver := context := nil]. self lineSelectAndEmptyCheck: [^self]. method := self compileSelectionFor: receiver in: context. method notNil ifTrue: + [self debug: method receiver: receiver in: context].! - [self debug: method receiver: receiver in: context]. - FakeClassPool adopt: nil! Item was changed: ----- Method: TextEditor>>evaluateSelection (in category 'do-its') ----- evaluateSelection "Treat the current selection as an expression; evaluate it and return the result" | result rcvr ctxt | self lineSelectAndEmptyCheck: [^ '']. (model respondsTo: #doItReceiver) + ifTrue: [ rcvr := model doItReceiver. - ifTrue: [FakeClassPool adopt: model selectedClass. "Include model pool vars if any" - rcvr := model doItReceiver. ctxt := model doItContext] ifFalse: [rcvr := ctxt := nil]. result := [ rcvr class evaluatorClass new evaluate: self selectionAsStream in: ctxt to: rcvr notifying: self ifFail: [FakeClassPool adopt: nil. ^ #failedDoit] logged: true. ] on: OutOfScopeNotification do: [ :ex | ex resume: true]. - FakeClassPool adopt: nil. ^ result!