Skip to content

Commit

Permalink
reuse SmaCCMethodNodeSourceIntervalFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajKubelka committed May 14, 2024
1 parent 697f2f6 commit a277f37
Showing 1 changed file with 4 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,6 @@ GtSmaCCTransformationToolkitDebuggerElement >> detailsElement [
^ element
]

{ #category : #ui }
GtSmaCCTransformationToolkitDebuggerElement >> equivalentNodeTo: aNode in: otherTree [
| equivParent nodeIndex equivNode |
aNode isMethod ifTrue: [ ^ otherTree ].
(aNode parent isReturn and: [ aNode parent parent parent isMethod ])
ifTrue:
[ equivNode := otherTree isSequence ifTrue: [ otherTree statements last ] ifFalse: [ otherTree ].
^ equivNode isReturn ifTrue: [ equivNode value ] ifFalse: [ equivNode ] ].
aNode parent isMethod ifTrue: [ otherTree isSequence ifTrue: [ ^ otherTree ] ifFalse: [ ^ otherTree parent ] ].
equivParent := self equivalentNodeTo: aNode parent in: otherTree.
equivParent ifNil: [ ^ nil ].
nodeIndex := aNode parent children identityIndexOf: aNode.
^ equivParent children at: nodeIndex ifAbsent: [ nil ]
]

{ #category : #ui }
GtSmaCCTransformationToolkitDebuggerElement >> executeAction: aDebuggingAction [
aDebuggingAction execute.
Expand Down Expand Up @@ -259,11 +244,10 @@ GtSmaCCTransformationToolkitDebuggerElement >> inspectorListElement [

{ #category : #ui }
GtSmaCCTransformationToolkitDebuggerElement >> intervalFromMethodNode: aNode inSource: aString [
| otherTree otherNode |
otherTree := RBParser parseExpression: aString onError: [ :msg :pos | ^ 1 to: 0 ].
otherNode := self equivalentNodeTo: aNode in: otherTree.
otherNode ifNil: [ ^ 1 to: 0 ].
^ otherNode start to: otherNode stop
^ SmaCCMethodNodeSourceIntervalFinder new
methodNode: aNode;
sourceString: aString;
find
]

{ #category : #ui }
Expand Down

0 comments on commit a277f37

Please sign in to comment.