Skip to content

Commit

Permalink
fixing return skip so that every return can be skipped except the las…
Browse files Browse the repository at this point in the history
…t one
  • Loading branch information
adri09070 committed Jun 13, 2023
1 parent df4689b commit 9851661
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Sindarin/SindarinDebugger.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,20 @@ SindarinDebugger >> skipMessageNodeWith: replacementValue [
{ #category : #'stepping - skip' }
SindarinDebugger >> skipReturnNode [

self flag: 'We should be able to skip a return node as long as it''s not the last one in the method'.
^ SindarinSkippingReturnWarning signal: 'Cannot skip a return node'
| node allReturnNodes |
node := self node.

"We collect the list of nodes associated to a return bytecode, via the IR"
allReturnNodes := self method ir children flatCollect: [ :irSequence |
irSequence sequence
select: [ :irInstruction |
irInstruction isReturn ]
thenCollect: [ :irInstruction |
irInstruction sourceNode ] ].
"If this is the last node of the method that is mapped to a return bytecode, we can't skip it and we stop there."
node == allReturnNodes last ifTrue: [
^ SindarinSkippingReturnWarning signal:
'Cannot skip the last return in the method' ]
]

{ #category : #'stepping - skip' }
Expand Down

0 comments on commit 9851661

Please sign in to comment.