'From Squeak2.9alpha of 17 July 2000 [latest update: #3406] on 5 February 2001 at 10:49:38 am'! "Change Set: flexibleScope Date: 5 February 2001 Author: Bob Arning Change to recent variable scope tightening to allow out-of-scope references in code pane evaluations (i.e. in the debugger)"! Notification subclass: #OutOfScopeNotification instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'System-Exceptions Kernel'! !Encoder methodsFor: 'encoding' stamp: 'RAA 2/5/2001 10:44'! encodeVariable: name sourceRange: range ifUnknown: action | varNode | varNode _ scopeTable at: name ifAbsent: [(self lookupInPools: name ifFound: [:assoc | varNode _ self global: assoc name: name]) ifTrue: [varNode] ifFalse: [action value]]. range ifNotNil: [ name first isUppercase ifTrue: [globalSourceRanges addLast: { name. range. false }]. ]. (varNode isTemp and: [varNode scope < 0]) ifTrue: [ OutOfScopeNotification signal ifFalse: [ ^self notify: 'out of scope']. ]. ^ varNode! ! !OutOfScopeNotification methodsFor: 'as yet unclassified' stamp: 'RAA 2/5/2001 10:41'! defaultAction self resume: false! ! !ParagraphEditor methodsFor: 'do-its' stamp: 'RAA 2/5/2001 10:43'! evaluateSelection "Treat the current selection as an expression; evaluate it and return the result" | result rcvr ctxt | self lineSelectAndEmptyCheck: [^ '']. (model respondsTo: #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] ] on: OutOfScopeNotification do: [ :ex | ex resume: true]. FakeClassPool adopt: nil. Smalltalk logChange: self selection string. ^ result! !