diff --git a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st index a8475fcd..8f99c3d9 100644 --- a/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderDebugSessionInSpaceEvaluationStatus.class.st @@ -10,7 +10,8 @@ Class { 'debugSession', 'debugger', 'sourceInterval', - 'sourceString' + 'sourceString', + 'evaluatedCode' ], #category : #'GToolkit-Coder-UI-Coders - Evaluation' } @@ -53,6 +54,41 @@ GtCoderDebugSessionInSpaceEvaluationStatus >> debuggerSpace [ space ] +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode [ + + ^ evaluatedCode ifNil: [ + evaluatedCode := GtSourceCoderNoEvaluatedCode default ] +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeContext [ + "Return a stack context that corresponds to a given evaluated code." + + + self debugSession process ifNil: [ ^ nil ]. + + ^ self evaluatedCode findRelevantContextInStack: self debugSession context stack +] + +{ #category : #accessing } +GtCoderDebugSessionInSpaceEvaluationStatus >> evaluatedCodeInterval [ + "Return an interval that corresponds to a given evaluated code." + + + ^ GtCoderEvaluatedCodeIntervalFinder new + debugSession: self debugSession; + context: self evaluatedCodeContext; + evaluatedCode: self evaluatedCode; + sourceString: self sourceString; + find +] + { #category : #testing } GtCoderDebugSessionInSpaceEvaluationStatus >> hasDebugSessionInSpace [ ^ true diff --git a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st index 4cbba233..26dc410a 100644 --- a/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st +++ b/src/GToolkit-Coder-UI/GtCoderEmbeddedDebugSessionEvaluationStatus.class.st @@ -23,7 +23,8 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> asDebugSessionInSpaceEvaluationSt debugSession: anAnnouncement releasedSession; debugger: anAnnouncement debugger; sourceInterval: self sourceInterval; - sourceString: self sourceString + sourceString: self sourceString; + evaluatedCode: self evaluatedCode ] { #category : #accessing } @@ -63,17 +64,12 @@ GtCoderEmbeddedDebugSessionEvaluationStatus >> evaluatedCodeInterval [ "Return an interval that corresponds to a given evaluated code." - | aContext | - aContext := self evaluatedCodeContext. - aContext ifNil: [ ^ nil ]. - - (self debugSession process isNil or: [ aContext isDead ]) ifTrue: [ ^ nil ]. - - ^ self - forPharo11OrNewer: [ self debugSession pcRangeForContext: aContext ] - forPharo10: [ self evaluatedCode - findSourceIntervalForContext: aContext - sourceString: self sourceString ] + ^ GtCoderEvaluatedCodeIntervalFinder new + debugSession: self debugSession; + context: self evaluatedCodeContext; + evaluatedCode: self evaluatedCode; + sourceString: self sourceString; + find ] { #category : #accessing } diff --git a/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st new file mode 100644 index 00000000..31232cdd --- /dev/null +++ b/src/GToolkit-Coder-UI/GtCoderEvaluatedCodeIntervalFinder.class.st @@ -0,0 +1,74 @@ +Class { + #name : #GtCoderEvaluatedCodeIntervalFinder, + #superclass : #Object, + #instVars : [ + 'debugSession', + 'context', + 'sourceString', + 'evaluatedCode' + ], + #category : #'GToolkit-Coder-UI-Coders - Evaluation' +} + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> context [ + + ^ context +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> context: aContext [ + context := aContext +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> debugSession [ + + ^ debugSession +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> debugSession: anObject [ + debugSession := anObject +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode [ + + ^ evaluatedCode +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> evaluatedCode: anObject [ + evaluatedCode := anObject +] + +{ #category : #finding } +GtCoderEvaluatedCodeIntervalFinder >> find [ + "Return an interval that corresponds to a given evaluated code." + + + debugSession ifNil: [ ^ nil ]. + debugSession process ifNil: [ ^ nil ]. + context ifNil: [ ^ nil ]. + context isDead ifTrue: [ ^ nil ]. + + ^ self + forPharo11OrNewer: [ self debugSession pcRangeForContext: context ] + forPharo10: [ evaluatedCode ifNil: [ ^ nil ]. + sourceString ifNil: [ ^ nil ]. + self evaluatedCode + findSourceIntervalForContext: context + sourceString: sourceString ] +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> sourceString [ + + ^ sourceString +] + +{ #category : #accessing } +GtCoderEvaluatedCodeIntervalFinder >> sourceString: anObject [ + sourceString := anObject +]