From 9851661ce41665fdae22084652460274efc42b8f Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:55:26 +0200 Subject: [PATCH] fixing return skip so that every return can be skipped except the last one --- src/Sindarin/SindarinDebugger.class.st | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Sindarin/SindarinDebugger.class.st b/src/Sindarin/SindarinDebugger.class.st index cddd0a4..ec10f5c 100644 --- a/src/Sindarin/SindarinDebugger.class.st +++ b/src/Sindarin/SindarinDebugger.class.st @@ -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' }