Skip to content

Commit d936802

Browse files
committed
fix evaluation epilog
1 parent 431c998 commit d936802

File tree

4 files changed

+71
-25
lines changed

4 files changed

+71
-25
lines changed

repository/ViennaTalk-Browser-Core/ViennaEpiLog.class.st

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,12 @@ ViennaEpiLog >> metadataName [
306306
]
307307

308308
{ #category : 'instance creation' }
309-
ViennaEpiLog >> newEvaluation: aString [
309+
ViennaEpiLog >> newEvaluation: aString state: aDictionary [
310310

311-
^ ViennaEvaluationEpiLog after: self expression: aString
311+
^ ViennaEvaluationEpiLog
312+
after: self
313+
expression: aString
314+
state: aDictionary
312315
]
313316

314317
{ #category : 'instance creation' }

repository/ViennaTalk-Browser-Core/ViennaEvaluationEpiLog.class.st

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ Class {
22
#name : 'ViennaEvaluationEpiLog',
33
#superclass : 'ViennaEpiLog',
44
#instVars : [
5-
'#expression => HiDePersistencySlot loader: #hideLoadExpression'
5+
'#expression => HiDePersistencySlot loader: #hideLoadExpression',
6+
'#state => HiDePersistencySlot loader: #hideLoadState'
67
],
78
#category : 'ViennaTalk-Browser-Core-EpiLog',
89
#package : 'ViennaTalk-Browser-Core',
910
#tag : 'EpiLog'
1011
}
1112

1213
{ #category : 'instance creation' }
13-
ViennaEvaluationEpiLog class >> after: aViennaEpiLog expression: aString [
14+
ViennaEvaluationEpiLog class >> after: aViennaEpiLog expression: aString state: aDictionary [
1415

1516
^ (self after: aViennaEpiLog)
1617
expression: aString;
18+
state: aDictionary;
1719
yourself
1820
]
1921

@@ -35,11 +37,19 @@ ViennaEvaluationEpiLog >> expression: aString [
3537
expression := aString
3638
]
3739

40+
{ #category : 'testing' }
41+
ViennaEvaluationEpiLog >> hasStateChange [
42+
43+
^ state notNil and: [ prev isNil or: [ prev state ~= state ] ]
44+
]
45+
3846
{ #category : 'hideho-operations' }
3947
ViennaEvaluationEpiLog >> hideLoad: aFileReference [
4048

4149
super hideLoad: aFileReference.
42-
self hideLoadExpression: aFileReference
50+
self
51+
hideLoadExpression: aFileReference;
52+
hideLoadState: aFileReference
4353
]
4454

4555
{ #category : 'hideho-operations' }
@@ -55,14 +65,31 @@ ViennaEvaluationEpiLog >> hideLoadExpression: aFileReference [
5565
expression := ref contents ]
5666
]
5767

68+
{ #category : 'hideho-operations' }
69+
ViennaEvaluationEpiLog >> hideLoadState [
70+
71+
self hideBaseDirectoryDo: [ :ref | self hideLoadState: ref ]
72+
]
73+
74+
{ #category : 'hideho-operations' }
75+
ViennaEvaluationEpiLog >> hideLoadState: aFileReference [
76+
77+
aFileReference / 'state.json' ifExists: [ :ref |
78+
ref readStreamDo: [ :stream | state := STONJSON fromStream: stream ] ]
79+
]
80+
5881
{ #category : 'hideho-operations' }
5982
ViennaEvaluationEpiLog >> hideSave: aFileReference [
6083

6184
super hideSave: aFileReference.
6285
expression ifNotNil: [
63-
(aFileReference / 'expression.txt')
64-
ensureDelete;
65-
writeStreamDo: [ :stream | stream nextPutAll: expression ] ]
86+
(aFileReference / 'expression.txt')
87+
ensureDelete;
88+
writeStreamDo: [ :stream | stream nextPutAll: expression ] ].
89+
state ifNotNil: [
90+
(aFileReference / 'state.json')
91+
ensureDelete;
92+
writeStreamDo: [ :stream | STONJSON put: state onStream: stream ] ]
6693
]
6794

6895
{ #category : 'initialization' }
@@ -91,3 +118,15 @@ ViennaEvaluationEpiLog >> printOn: aStream [
91118
nextPutAll: 'Eval ';
92119
nextPutAll: self expression
93120
]
121+
122+
{ #category : 'accessing' }
123+
ViennaEvaluationEpiLog >> state [
124+
125+
^ state ifNil: [ prev ifNotNil: #state ifNil: [ Dictionary new ] ]
126+
]
127+
128+
{ #category : 'accessing' }
129+
ViennaEvaluationEpiLog >> state: aDictionary [
130+
131+
state := aDictionary
132+
]

repository/ViennaTalk-Browser-Core/ViennaRefactoringBrowser.class.st

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,9 @@ ViennaRefactoringBrowser >> epiLogEnumerator [
11991199
]
12001200

12011201
{ #category : 'operations-epiLog' }
1202-
ViennaRefactoringBrowser >> epiLogEvaluation: aString [
1202+
ViennaRefactoringBrowser >> epiLogEvaluation: aString state: aDictionary [
12031203

1204-
self epiLog: (self epiLog newEvaluation: aString)
1204+
self epiLog: (self epiLog newEvaluation: aString state: aDictionary)
12051205
]
12061206

12071207
{ #category : 'operations-epiLog' }
@@ -2205,7 +2205,9 @@ ViennaRefactoringBrowser >> initializePlaygroundPagePresenters [
22052205
module: [ self module ];
22062206
withoutLineNumbers;
22072207
whenEvaluatedDo: [ :expression |
2208-
self epiLogEvaluation: expression ];
2208+
self
2209+
epiLogEvaluation: expression
2210+
state: animation state ];
22092211
whenExecutedDo: [ :statement |
22102212
self
22112213
epiLogExecution: statement
@@ -2338,7 +2340,9 @@ ViennaRefactoringBrowser >> initializeSourcePagePresenters [
23382340
whenTextChangedDo: [ self onTheFlyCheckSourceText ];
23392341
whenSubmitDo: [ :text | self accept: text ];
23402342
whenEvaluatedDo: [ :expression |
2341-
self epiLogEvaluation: expression ];
2343+
self
2344+
epiLogEvaluation: expression
2345+
state: animation state ];
23422346
whenExecutedDo: [ :statement |
23432347
self
23442348
epiLogExecution: statement

repository/ViennaTalk-Browser-Core/ViennaVDMSourcePresenter.class.st

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ ViennaVDMSourcePresenter >> animation: aBlock [
4949
ViennaVDMSourcePresenter >> doEvaluateIt [
5050

5151
self selectedTextOrLine trim ifNotEmpty: [ :expression |
52-
| result |
53-
result := self
54-
evaluateExpression: self selectedTextOrLine
55-
ifError: [ :msg |
56-
self
57-
insertPopoverAfterCurrentSelection:
58-
(self newLabel label: msg)
59-
style: 'error'.
60-
^ nil ].
61-
self
62-
insertPopoverAfterCurrentSelection: (self newLabel label: result)
63-
style: 'print'.
64-
self announcer announce: (ViennaEvaluated expression: expression) ]
52+
| result |
53+
result := self
54+
evaluateExpression: self selectedTextOrLine
55+
ifError: [ :msg |
56+
self
57+
insertPopoverAfterCurrentSelection:
58+
(self newLabel label: msg)
59+
style: 'error'.
60+
^ nil ].
61+
self
62+
insertPopoverAfterCurrentSelection: (self newLabel label: result)
63+
style: 'print'.
64+
self announcer announce: (ViennaEvaluated expression: expression) ]
6565
]
6666

6767
{ #category : 'evaluating' }

0 commit comments

Comments
 (0)