The Inbox: Kernel-jar.1407.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Kernel-jar.1407.mcz

commits-2
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-jar.1407.mcz

==================== Summary ====================

Name: Kernel-jar.1407
Author: jar
Time: 15 May 2021, 4:54:53.093378 pm
UUID: 19fec7a8-7276-6045-912e-4d546f26829f
Ancestors: Kernel-nice.1402

full implementation of repeated #signal sends to an existing exception consistent with ANSI; according to ANSI re-signalling an existing exception should differ from sending #outer in that the search for its handler starts from the current context rather than from the exception's handler context

=============== Diff against Kernel-nice.1402 ===============

Item was changed:
  ----- Method: Exception>>resumeEvaluating: (in category 'handling') -----
  resumeEvaluating: aBlock
  "Return result of evaluating aBlock as the value of #signal, unless this was called after an #outer message, then return resumptionValue as the value of #outer.
  The block is only evaluated after unwinding the stack."
 
  | ctxt |
  outerContext ifNil: [
+ ctxt := signalContext.
+ signalContext := ctxt tempAt: 1. "prevSignalContext in #signal"
+ handlerContext := ctxt tempAt: 2. "currHandlerContext in #signal"
+ ctxt returnEvaluating: aBlock
- signalContext returnEvaluating: aBlock
  ] ifNotNil: [
  ctxt := outerContext.
  outerContext := ctxt tempAt: 1. "prevOuterContext in #outer"
  handlerContext := ctxt tempAt: 2. "currHandlerContext in #outer"
  ctxt returnEvaluating: aBlock
  ].
  !

Item was changed:
  ----- Method: Exception>>signal (in category 'signaling') -----
  signal
  "Ask ContextHandlers in the sender chain to handle this signal.  The default is to execute and return my defaultAction."
 
+ | prevSignalContext currHandlerContext |
+ signalContext ifNotNil: [ "re-signalling an already signalled exception is similar to #outer but
+ unlike #outer it starts searching for its handler from thisContext instead of handlerContext."
+ currHandlerContext := handlerContext.
+ prevSignalContext := signalContext].
- signalContext ifNotNil: [^self outer]. "re-signalling an already signalled exception is equivalent to sending #outer"
  signalContext := thisContext contextTag.
  ^(thisContext nextHandlerContextForSignal: self) handleSignal: self!