DebugView.st
changeset 16422 9ae2c4be75c4
parent 16376 28914ad442f9
child 16430 973b534176ca
equal deleted inserted replaced
16421:c83862865c5e 16422:9ae2c4be75c4
  8510 !
  8510 !
  8511 
  8511 
  8512 codeAccept:someCode unwind:doUnwind category:givenCategoryOrNil onCancel:cancelAction
  8512 codeAccept:someCode unwind:doUnwind category:givenCategoryOrNil onCancel:cancelAction
  8513     "user wants some code to be recompiled"
  8513     "user wants some code to be recompiled"
  8514 
  8514 
  8515     |sel implementorClass receiverClass method category|
  8515     |sel implementorClass receiverClass method category wrapper|
  8516 
  8516 
  8517     codeView withWaitCursorDo:[
  8517     codeView withWaitCursorDo:[
  8518 "/        "
  8518 "/        "
  8519 "/         find the method-home context for this one
  8519 "/         find the method-home context for this one
  8520 "/        "
  8520 "/        "
  8525 "/                top := con
  8525 "/                top := con
  8526 "/            ].
  8526 "/            ].
  8527 "/            con := con sender
  8527 "/            con := con sender
  8528 "/        ].
  8528 "/        ].
  8529 
  8529 
  8530 	"
  8530         "
  8531 	 use class&selector to find the method for the compilation
  8531          use class&selector to find the method for the compilation
  8532 	 and compile.
  8532          and compile.
  8533 	"
  8533         "
  8534 	category := givenCategoryOrNil.
  8534         category := givenCategoryOrNil.
  8535 	sel := selectedContext selector.
  8535         sel := selectedContext selector.
  8536 	implementorClass := selectedContext methodClass.
  8536         implementorClass := selectedContext methodClass.
  8537 	method := selectedContext method.
  8537         method := selectedContext method.
  8538 
  8538 
  8539 	implementorClass isNil ifTrue:[
  8539         implementorClass isNil ifTrue:[
  8540 	    (method notNil and:[method mclass isNil and:[method wrapper notNil]]) ifTrue:[
  8540             (method notNil 
  8541 		method := method wrapper.
  8541                 and:[method mclass isNil 
  8542 	    ].
  8542                 and:[(wrapper := method wrapper) notNil]]
  8543 	    method notNil ifTrue:[
  8543             ) ifTrue:[
  8544 		implementorClass := method mclass.
  8544                 method := wrapper.
  8545 		implementorClass isNil ifTrue:[
  8545             ].
  8546 		    implementorClass := method getMclass
  8546             method notNil ifTrue:[
  8547 		].
  8547                 implementorClass := method mclass.
  8548 	    ].
  8548                 implementorClass isNil ifTrue:[
  8549 	].
  8549                     implementorClass := method getMclass
  8550 	implementorClass notNil ifTrue:[
  8550                 ].
  8551 	    category isNil ifTrue:[
  8551             ].
  8552 		method isNil ifTrue:[
  8552         ].
  8553 		    method := implementorClass compiledMethodAt:sel.
  8553         implementorClass notNil ifTrue:[
  8554 		].
  8554             category isNil ifTrue:[
  8555 		category := method category
  8555                 method isNil ifTrue:[
  8556 	    ]
  8556                     method := implementorClass compiledMethodAt:sel.
  8557 	] ifFalse:[
  8557                 ].
  8558 	    receiverClass := selectedContext receiver class.
  8558                 category := method category
  8559 	    implementorClass := receiverClass whichClassImplements:sel.
  8559             ]
  8560 	    implementorClass := implementorClass ? receiverClass.
  8560         ] ifFalse:[
  8561 	    implementorClass ~~ Object ifTrue:[
  8561             receiverClass := selectedContext receiver class.
  8562 		implementorClass := Dialog
  8562             implementorClass := receiverClass whichClassImplements:sel.
  8563 					request:('Define ''%1'' in class:' bindWith:sel allBold)
  8563             implementorClass := implementorClass ? receiverClass.
  8564 					initialAnswer:implementorClass name
  8564             implementorClass ~~ Object ifTrue:[
  8565 					list:(implementorClass withAllSuperclasses collect:[:each| each name]).
  8565                 implementorClass := Dialog
  8566 		implementorClass size == 0 ifTrue:[
  8566                                         request:('Define ''%1'' in class:' bindWith:sel allBold)
  8567 		    ^ cancelAction value "/ cancelled
  8567                                         initialAnswer:implementorClass name
  8568 		].
  8568                                         list:(implementorClass withAllSuperclasses collect:[:each| each name]).
  8569 		implementorClass := Smalltalk classNamed:implementorClass.
  8569                 implementorClass size == 0 ifTrue:[
  8570 		implementorClass isNil ifTrue:[
  8570                     ^ cancelAction value "/ cancelled
  8571 		    Dialog warn:'No such class'.
  8571                 ].
  8572 		    ^ cancelAction value "/ cancelled
  8572                 implementorClass := Smalltalk classNamed:implementorClass.
  8573 		].
  8573                 implementorClass isNil ifTrue:[
  8574 	    ].
  8574                     Dialog warn:'No such class'.
  8575 	].
  8575                     ^ cancelAction value "/ cancelled
  8576 
  8576                 ].
  8577 	self
  8577             ].
  8578 	    codeAccept:someCode
  8578         ].
  8579 	    inClass:implementorClass
  8579 
  8580 	    unwind:doUnwind
  8580         self
  8581 	    category:category
  8581             codeAccept:someCode
  8582 	    onCancel:cancelAction.
  8582             inClass:implementorClass
       
  8583             unwind:doUnwind
       
  8584             category:category
       
  8585             onCancel:cancelAction.
  8583     ].
  8586     ].
  8584 
  8587 
  8585     "Created: / 17-11-2001 / 21:50:55 / cg"
  8588     "Created: / 17-11-2001 / 21:50:55 / cg"
  8586     "Modified: / 29-08-2006 / 14:22:22 / cg"
  8589     "Modified: / 29-08-2006 / 14:22:22 / cg"
  8587 !
  8590 !