2016-05-17 15:12:27 +00:00
|
|
|
#class Exception(Apex)
|
|
|
|
{
|
|
|
|
#dcl signalContext handlerContext handlerBlock messageText.
|
|
|
|
|
|
|
|
## To be extended below.
|
|
|
|
}
|
|
|
|
|
2015-10-15 14:40:08 +00:00
|
|
|
#class(#pointer) Context(Apex)
|
|
|
|
{
|
2016-03-28 13:25:36 +00:00
|
|
|
#dcl sender ip sp ntmprs.
|
|
|
|
|
|
|
|
#method sender
|
|
|
|
{
|
|
|
|
^self.sender
|
|
|
|
}
|
2016-04-29 16:40:25 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#method isExceptionHandlerContext
|
2016-04-29 16:40:25 +00:00
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
^false
|
2016-04-29 16:40:25 +00:00
|
|
|
}
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#class(#pointer) MethodContext(Context)
|
|
|
|
{
|
2016-03-28 13:25:36 +00:00
|
|
|
#dcl method receiver home origin.
|
2015-10-15 14:40:08 +00:00
|
|
|
|
|
|
|
#method pc
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
^self.ip
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
2016-05-12 05:53:35 +00:00
|
|
|
#method pcplus1
|
|
|
|
{
|
|
|
|
^self.ip + 1
|
|
|
|
}
|
|
|
|
|
2015-10-15 14:40:08 +00:00
|
|
|
#method pc: anInteger
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
self.ip := anInteger.
|
|
|
|
"self.sp := self.sp - 1." "whould this always work??? "
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method sp
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
^self.sp.
|
2015-10-15 14:40:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#method sp: anInteger
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
self.sp := anInteger.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method pc: aPC sp: aSP
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
self.ip := aPC.
|
|
|
|
self.sp := aSP.
|
2015-10-15 14:40:08 +00:00
|
|
|
##sp := sp - 1.
|
|
|
|
}
|
2016-03-28 13:25:36 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#method method
|
|
|
|
{
|
|
|
|
^self.method
|
|
|
|
}
|
2016-04-29 16:40:25 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#method isExceptionHandlerContext
|
2016-03-28 13:25:36 +00:00
|
|
|
{
|
2016-04-29 16:40:25 +00:00
|
|
|
## 10 - STIX_METHOD_PREAMBLE_EXCEPTION in VM.
|
|
|
|
^self.method preambleCode == 10.
|
|
|
|
}
|
|
|
|
|
2016-05-07 01:37:44 +00:00
|
|
|
#method findExceptionHandlerBlock: anExceptionClass
|
2016-04-29 16:40:25 +00:00
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
## for this to work, self must be an exception handler context.
|
|
|
|
## For a single on:do: call,
|
|
|
|
## self class specNumInstVars must return 8.
|
|
|
|
## basicAt: 8 must be the on: argument.
|
|
|
|
## basicAt: 9 must be the do: argument
|
2016-04-29 16:40:25 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
(self isExceptionHandlerContext) ifTrue: [
|
|
|
|
| bound exc |
|
|
|
|
## NOTE: if on:do: has a temporary varible, bound must be adjusted to reflect it.
|
|
|
|
bound := self basicSize - 1.
|
|
|
|
8 to: bound by: 2 do: [ :i |
|
|
|
|
exc := self basicAt: i.
|
2016-05-07 01:37:44 +00:00
|
|
|
((anExceptionClass == exc) or: [anExceptionClass inheritsFrom: exc]) ifTrue: [^self basicAt: (i + 1)].
|
2016-05-03 10:10:28 +00:00
|
|
|
]
|
|
|
|
].
|
|
|
|
^nil.
|
2016-03-28 13:25:36 +00:00
|
|
|
}
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#class(#pointer) BlockContext(Context)
|
|
|
|
{
|
2016-03-28 13:25:36 +00:00
|
|
|
#dcl nargs source home origin.
|
2015-10-15 14:40:08 +00:00
|
|
|
|
|
|
|
#method fork
|
|
|
|
{
|
|
|
|
"crate a new process in the runnable state"
|
2015-10-18 15:06:17 +00:00
|
|
|
^self newProcess resume.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method newProcess
|
|
|
|
{
|
|
|
|
"create a new process in the suspended state"
|
2015-10-18 15:06:17 +00:00
|
|
|
<primitive: #_block_new_process>
|
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method newProcessWith: anArray
|
|
|
|
{
|
|
|
|
"create a new process in the suspended state passing the elements
|
|
|
|
of anArray as block arguments"
|
2015-10-22 02:47:25 +00:00
|
|
|
<primitive: #_block_new_process>
|
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method value
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
2016-01-29 04:04:39 +00:00
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
#method value: a
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
2016-01-29 04:04:39 +00:00
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
#method value: a value: b
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
2016-01-29 04:04:39 +00:00
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
#method value: a value: b value: c
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
2016-01-29 04:04:39 +00:00
|
|
|
self primitiveFailed.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
2016-05-12 05:53:35 +00:00
|
|
|
#method value: a value: b value: c value: d
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
|
|
|
self primitiveFailed.
|
|
|
|
}
|
|
|
|
#method value: a value: b value: c value: d value: e
|
|
|
|
{
|
|
|
|
<primitive: #_block_value>
|
|
|
|
self primitiveFailed.
|
|
|
|
}
|
2015-10-15 14:40:08 +00:00
|
|
|
|
|
|
|
#method ifTrue: aBlock
|
|
|
|
{
|
|
|
|
^(self value) ifTrue: aBlock.
|
|
|
|
}
|
|
|
|
|
|
|
|
#method ifFalse: aBlock
|
|
|
|
{
|
|
|
|
^(self value) ifFalse: aBlock.
|
|
|
|
}
|
|
|
|
|
|
|
|
#method ifTrue: trueBlock ifFalse: falseBlock
|
|
|
|
{
|
|
|
|
^(self value) ifTrue: trueBlock ifFalse: falseBlock
|
|
|
|
}
|
|
|
|
|
|
|
|
#method whileTrue: aBlock
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
## --------------------------------------------------
|
|
|
|
## Naive implementation
|
|
|
|
## --------------------------------------------------
|
|
|
|
## (self value) ifFalse: [^nil].
|
|
|
|
## aBlock value.
|
|
|
|
## self whileTrue: aBlock.
|
|
|
|
## --------------------------------------------------
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built without STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
## | pc sp |
|
|
|
|
## sp := thisContext sp.
|
|
|
|
## pc := thisContext pcplus1.
|
|
|
|
## self value ifFalse: [ ^nil "^self" ].
|
|
|
|
## aBlock value.
|
|
|
|
## thisContext pc: pc sp: sp.
|
|
|
|
## --------------------------------------------------
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built with STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
| pc |
|
|
|
|
pc := thisContext pcplus1.
|
|
|
|
(self value) ifFalse: [ ^nil "^self" ].
|
2015-10-15 14:40:08 +00:00
|
|
|
aBlock value.
|
2016-05-12 05:53:35 +00:00
|
|
|
thisContext pc: pc.
|
|
|
|
## --------------------------------------------------
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
2016-03-28 13:25:36 +00:00
|
|
|
#method whileTrue
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
## (self value) ifFalse: [^nil].
|
|
|
|
## self whileTrue.
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built with STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
| pc |
|
|
|
|
pc := thisContext pcplus1.
|
|
|
|
(self value) ifFalse: [ ^nil "^self" ].
|
|
|
|
thisContext pc: pc.
|
|
|
|
## --------------------------------------------------
|
2016-03-28 13:25:36 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 10:13:03 +00:00
|
|
|
#method whileFalse: aBlock
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
## --------------------------------------------------
|
|
|
|
## Naive implementation
|
|
|
|
## --------------------------------------------------
|
|
|
|
## (self value) ifTrue: [^nil].
|
|
|
|
## aBlock value.
|
|
|
|
## self whileFalse: aBlock.
|
|
|
|
## --------------------------------------------------
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built without STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
## | pc sp |
|
|
|
|
## sp := thisContext sp.
|
|
|
|
## pc := thisContext pcplus1.
|
|
|
|
## self value ifTrue: [ ^nil "^self" ].
|
|
|
|
## aBlock value.
|
|
|
|
## thisContext pc: pc sp: sp.
|
|
|
|
## --------------------------------------------------
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built with STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
## The assignment to 'pc' uses the POP_INTO_TEMPVAR_1.
|
|
|
|
## It pops a value off the stack top, stores it to the second
|
|
|
|
## temporary variable(aBlock is the first temporary variable).
|
|
|
|
## It is a single byte instruction. 'pc' returned by
|
|
|
|
## 'thisContext pcplus1'' should point to the instruction after
|
|
|
|
## the POP_INTO_TEMPVAR_0 instruction.
|
|
|
|
##
|
|
|
|
## It would need the increment of 2 if the pair of
|
|
|
|
## STORE_INTO_TEMPVAR_1 and POP_STACKTOP were used.
|
|
|
|
## This implementation is subject to the instructions chosen
|
|
|
|
## by the compiler.
|
|
|
|
##
|
|
|
|
| pc |
|
|
|
|
pc := thisContext pcplus1.
|
|
|
|
(self value) ifTrue: [ ^nil "^self" ].
|
|
|
|
aBlock value.
|
|
|
|
thisContext pc: pc.
|
|
|
|
## --------------------------------------------------
|
2016-03-16 10:13:03 +00:00
|
|
|
}
|
|
|
|
|
2016-03-28 13:25:36 +00:00
|
|
|
#method whileFalse
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
## (self value) ifTrue: [^nil].
|
|
|
|
## self whileFalse.
|
|
|
|
|
|
|
|
## --------------------------------------------------
|
|
|
|
## If VM is built with STIX_USE_PROCSTK
|
|
|
|
## --------------------------------------------------
|
|
|
|
| pc |
|
|
|
|
pc := thisContext pcplus1.
|
|
|
|
(self value) ifTrue: [ ^nil "^self" ].
|
|
|
|
thisContext pc: pc.
|
|
|
|
## --------------------------------------------------
|
2016-03-28 13:25:36 +00:00
|
|
|
}
|
|
|
|
|
2015-10-15 14:40:08 +00:00
|
|
|
#method pc
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
^self.ip
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method pc: anInteger
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
self.ip := anInteger.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method sp
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
^self.sp
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method sp: anInteger
|
|
|
|
{
|
2016-05-12 05:53:35 +00:00
|
|
|
self.sp := anInteger.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method restart
|
|
|
|
{
|
|
|
|
ip := source pc.
|
|
|
|
}
|
|
|
|
|
|
|
|
"------ TODO: -------------------------------------"
|
2016-03-26 06:39:56 +00:00
|
|
|
#method on: anException do: anExceptionBlock
|
2015-10-15 14:40:08 +00:00
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
" | handlerActive |"
|
2016-03-28 13:25:36 +00:00
|
|
|
<exception>
|
2016-05-03 10:10:28 +00:00
|
|
|
" handlerActive := true.
|
2016-03-28 13:25:36 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
thisContext isExceptionHandlerContext dump.
|
2016-04-29 16:40:25 +00:00
|
|
|
(thisContext basicSize) dump.
|
|
|
|
(thisContext basicAt: 8) dump. ## this should be anException
|
|
|
|
(thisContext basicAt: 9) dump. ## this should be anExceptionBlock
|
|
|
|
(thisContext basicAt: 10) dump. ## this should be handlerActive
|
2016-05-02 13:50:42 +00:00
|
|
|
'on:do: ABOUT TO EVALUE THE RECEIVER BLOCK' dump."
|
2016-03-28 13:25:36 +00:00
|
|
|
|
|
|
|
^self value.
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#method on: exc1 do: blk1 on: exc2 do: blk2
|
|
|
|
{
|
|
|
|
<exception>
|
|
|
|
^self value.
|
|
|
|
}
|
|
|
|
|
2015-10-15 14:40:08 +00:00
|
|
|
#method ensure: aBlock
|
|
|
|
{
|
2016-03-28 13:25:36 +00:00
|
|
|
|
2016-05-17 15:12:27 +00:00
|
|
|
## TODO: ensure that the ensured block is executed after exception handler...
|
|
|
|
| value |
|
|
|
|
value := self on: Exception do: [:ex | aBlock value. ex pass].
|
|
|
|
## value := self valueAndResumeOnUnwind.
|
|
|
|
aBlock value.
|
|
|
|
^value
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method ifCurtailed: aBlock
|
|
|
|
{
|
2016-05-17 15:12:27 +00:00
|
|
|
^self on: Exception do: [:ex | aBlock value. ex pass ]
|
2015-10-15 14:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
"------ TODO: -------------------------------------"
|
|
|
|
}
|
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
## TODO: is it better to inherit from Object???
|
|
|
|
## or treat Exception specially like UndefinedObject or Class???
|
2016-05-17 15:12:27 +00:00
|
|
|
#extend Exception
|
2016-03-28 13:25:36 +00:00
|
|
|
{
|
2016-05-17 15:12:27 +00:00
|
|
|
|
2016-03-28 13:25:36 +00:00
|
|
|
|
|
|
|
#method(#class) signal
|
|
|
|
{
|
|
|
|
self new signal
|
|
|
|
}
|
|
|
|
|
|
|
|
#method(#class) signal: text
|
|
|
|
{
|
|
|
|
self new signal: text
|
|
|
|
}
|
|
|
|
|
2016-05-02 13:50:42 +00:00
|
|
|
#method messageText
|
|
|
|
{
|
|
|
|
^self.messageText
|
|
|
|
}
|
|
|
|
|
2016-03-28 13:25:36 +00:00
|
|
|
#method signal
|
|
|
|
{
|
|
|
|
self.signalContext := thisContext.
|
2016-05-03 10:10:28 +00:00
|
|
|
self findHandlerContextStartingFrom: self.signalContext.
|
|
|
|
self handleException.
|
2016-03-28 13:25:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method signal: text
|
|
|
|
{
|
|
|
|
self.messageText := text.
|
|
|
|
self signal.
|
|
|
|
}
|
|
|
|
|
2016-04-30 05:56:35 +00:00
|
|
|
#method pass
|
|
|
|
{
|
|
|
|
## pass the exception to the outer context
|
2016-05-03 10:10:28 +00:00
|
|
|
self.signalContext notNil
|
|
|
|
ifTrue: [ ## it's signaled earlier
|
|
|
|
## TODO: Should i change the signalContex to thisContext???
|
|
|
|
self findHandlerContextStartingFrom: (self.handlerContext sender).
|
|
|
|
self handleException.
|
|
|
|
]
|
2016-05-01 13:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method return: value
|
|
|
|
{
|
2016-05-03 10:10:28 +00:00
|
|
|
self.handlerContext notNil ifTrue: [
|
2016-05-01 13:49:36 +00:00
|
|
|
Processor return: value to: (self.handlerContext sender)
|
|
|
|
]
|
2016-04-30 05:56:35 +00:00
|
|
|
}
|
|
|
|
|
2016-05-01 13:49:36 +00:00
|
|
|
#method retry
|
|
|
|
{
|
2016-05-02 13:50:42 +00:00
|
|
|
## TODO: verify if return:to: causes unnecessary stack growth.
|
2016-05-03 10:10:28 +00:00
|
|
|
self.handlerContext notNil
|
|
|
|
ifTrue: [
|
|
|
|
## TODO: should i reset self.handlerContext and self.signalContext to nil?
|
|
|
|
self.handlerContext pc: 0.
|
|
|
|
Processor return: self to: self.handlerContext.
|
|
|
|
##Processor forceContext: self.handlerContext.
|
|
|
|
]
|
2016-05-01 13:49:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#method resume
|
|
|
|
{
|
2016-05-02 13:50:42 +00:00
|
|
|
## TODO: verify if return:to: causes unnecessary stack growth.
|
2016-05-01 13:49:36 +00:00
|
|
|
## is this correct???
|
2016-05-03 10:10:28 +00:00
|
|
|
self.signalContext notNil
|
|
|
|
ifTrue: [
|
|
|
|
## TODO: should i reset self.handlerContext and self.signalContext to nil?
|
|
|
|
Processor return: self to: (self.signalContext sender).
|
|
|
|
]
|
2016-05-01 13:49:36 +00:00
|
|
|
}
|
|
|
|
|
2016-05-17 15:12:27 +00:00
|
|
|
## #################################################################### ## ####################################################################
|
|
|
|
#method handleException
|
2016-05-03 10:10:28 +00:00
|
|
|
{
|
|
|
|
self.handlerContext notNil
|
|
|
|
ifTrue: [
|
|
|
|
Processor return: (self.handlerBlock value: self) to: (self.handlerContext sender)
|
|
|
|
]
|
|
|
|
ifFalse: [
|
|
|
|
('### EXCEPTION NOT HANDLED #### ', self class name, ' - ', self messageText) dump.
|
|
|
|
## TODO: debug the current process???? "
|
|
|
|
Processor activeProcess terminate.
|
|
|
|
].
|
2016-03-28 13:25:36 +00:00
|
|
|
}
|
|
|
|
|
2016-05-17 15:12:27 +00:00
|
|
|
## #method handlerContext
|
|
|
|
## {
|
|
|
|
## (self.handlerContext notNil) ifTrue: [ ^self.handlerContext ].
|
|
|
|
## self findHandlerContextStartingFrom: self.signalContext.
|
|
|
|
## ^self.handlerContext.
|
|
|
|
## }
|
2016-03-28 13:25:36 +00:00
|
|
|
|
2016-04-30 05:56:35 +00:00
|
|
|
#method findHandlerContextStartingFrom: aContext
|
2016-03-28 13:25:36 +00:00
|
|
|
{
|
|
|
|
## Find exception handling context starting from a given context
|
|
|
|
| ctx |
|
|
|
|
|
|
|
|
ctx := aContext.
|
2016-05-03 10:10:28 +00:00
|
|
|
[ ctx notNil ] whileTrue: [
|
|
|
|
##(ctx handles: self) ifTrue: [ ^ ctx ].
|
|
|
|
(ctx isExceptionHandlerContext) ifTrue: [
|
|
|
|
| blk |
|
|
|
|
blk := ctx findExceptionHandlerBlock: (self class).
|
|
|
|
(blk notNil) ifTrue: [
|
|
|
|
self.handlerBlock := blk.
|
|
|
|
self.handlerContext := ctx.
|
|
|
|
^ctx
|
|
|
|
].
|
|
|
|
].
|
2016-03-28 13:25:36 +00:00
|
|
|
ctx := ctx sender
|
|
|
|
].
|
2016-05-17 15:12:27 +00:00
|
|
|
|
|
|
|
## no handler is found
|
|
|
|
self.handlerBlock := nil.
|
|
|
|
self.handlerContext := nil.
|
2016-03-28 13:25:36 +00:00
|
|
|
^nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#class NoSuchMessageException(Exception)
|
|
|
|
{
|
|
|
|
}
|
2016-05-02 13:59:28 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#class PrimitiveFailureException(Exception)
|
|
|
|
{
|
|
|
|
}
|
2016-05-02 13:59:28 +00:00
|
|
|
|
|
|
|
#extend Apex
|
|
|
|
{
|
|
|
|
#method(#class) primitiveFailed
|
|
|
|
{
|
|
|
|
## TODO: implement this
|
2016-05-03 10:10:28 +00:00
|
|
|
## experimental backtrace...
|
|
|
|
| ctx |
|
|
|
|
ctx := thisContext.
|
|
|
|
[ctx notNil] whileTrue: [
|
|
|
|
(ctx class == MethodContext)
|
2016-05-07 01:37:44 +00:00
|
|
|
ifTrue: [ (ctx method owner name, '>>', ctx method name) dump ].
|
2016-05-03 10:10:28 +00:00
|
|
|
## TODO: include blockcontext???
|
|
|
|
ctx := ctx sender.
|
|
|
|
].
|
2016-05-17 15:12:27 +00:00
|
|
|
'------ END OF BACKTRACE -----------' dump.
|
2016-05-03 10:10:28 +00:00
|
|
|
PrimitiveFailureException signal: 'PRIMITIVE FAILED'.
|
|
|
|
}
|
2016-05-07 01:37:44 +00:00
|
|
|
|
2016-05-03 10:10:28 +00:00
|
|
|
#method(#class) cannotInstantiate
|
|
|
|
{
|
|
|
|
Exception signal: 'Cannot instantiate'.
|
2016-05-02 13:59:28 +00:00
|
|
|
}
|
2016-05-17 15:12:27 +00:00
|
|
|
|
|
|
|
#method(#class) doesNotUnderstand: messageSymbol
|
|
|
|
{
|
|
|
|
## TODO: implement this properly
|
|
|
|
NoSuchMessageException signal: (messageSymbol, ' not understood by ', (self name)).
|
|
|
|
}
|
2016-05-02 13:59:28 +00:00
|
|
|
}
|