Skip to content

Commit

Permalink
Merge pull request #605 from PalumboN/fix-cleanBlocks-with-dead-conte…
Browse files Browse the repository at this point in the history
…xt-on-debugger

Fix testRecompileMethodToInBlockContext++ using clean blocks
  • Loading branch information
jecisc authored Oct 27, 2023
2 parents 5565a5b + 6b49b36 commit 57370db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/NewTools-Debugger-Tests/StDebuggerActionModelTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ StDebuggerActionModelTest >> methodWithBlockContext [
{ #category : 'helper' }
StDebuggerActionModelTest >> methodWithDeadBlockContext [

^ [ (1+1 ) printString ]
^ [ (1 + 1) printString ]
]

{ #category : 'helper' }
Expand All @@ -127,14 +127,13 @@ StDebuggerActionModelTest >> newSessionWithBlockContext [
| process method |
method := self class >> #methodWithBlockContext.
methodWithBlockContextOriginalSource := method sourceCode.
process := [ method valueWithReceiver: self arguments: #( ) ]
newProcess.
self
setSessionAndDebuggerModelForMethod: method
inContext: process suspendedContext.
process := [ method valueWithReceiver: self arguments: #( ) ] newProcess.
self setSessionAndDebuggerModelForMethod: method inContext: process suspendedContext.

4 timesRepeat: [
debugActionModel stepInto: debugActionModel topContext ]
[ debugActionModel topContext closure isNil ] whileTrue: [
debugActionModel stepInto: debugActionModel topContext ].
"Step on (1 + 1) message"
debugActionModel stepInto: debugActionModel topContext
]

{ #category : 'helper' }
Expand Down
5 changes: 4 additions & 1 deletion src/NewTools-Debugger/StDebuggerActionModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,18 @@ StDebuggerActionModel >> recompileMethodTo: aString inContext: aContext notifyin

| methodContext homePC |
aContext ifNil: [ ^ self ].
"Get the home before to recompile the method, we can lost it (for clean blocks)"
methodContext := aContext home.

self session
recompileMethodTo: aString
inContext: aContext
notifying: aNotifyer.

methodContext := aContext home.
homePC := methodContext isDead
ifTrue: [ methodContext endPC ]
ifFalse: [ methodContext pc ].

previousASTScope := (methodContext compiledCode sourceNodeForPC:
homePC) scope
]
Expand Down

0 comments on commit 57370db

Please sign in to comment.