author | Jan Vrany <jan.vrany@labware.com> |
Thu, 27 Oct 2022 14:53:59 +0100 | |
branch | jv |
changeset 4735 | 3b11fb3ede98 |
parent 4723 | 524785227024 |
permissions | -rw-r--r-- |
2512 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
4656
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
3 |
COPYRIGHT (c) 2020 LabWare |
2512 | 4 |
All Rights Reserved |
5 |
||
6 |
This software is furnished under a license and may be used |
|
7 |
only in accordance with the terms of that license and with the |
|
8 |
inclusion of the above copyright notice. This software may not |
|
9 |
be provided or otherwise made available to, or used by, any |
|
10 |
other person. No title to or ownership of the software is |
|
11 |
hereby transferred. |
|
12 |
" |
|
13 |
"{ Package: 'stx:libcomp' }" |
|
14 |
||
3609 | 15 |
"{ NameSpace: Smalltalk }" |
16 |
||
2512 | 17 |
ParseNode subclass:#BreakpointNode |
2540 | 18 |
instanceVariableNames:'breakpoint expression lineNumber' |
2512 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'System-Compiler-Debugging' |
|
22 |
! |
|
23 |
||
24 |
!BreakpointNode class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
4656
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
29 |
COPYRIGHT (c) 2020 LabWare |
2512 | 30 |
All Rights Reserved |
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
3346 | 39 |
! |
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
compiler support for statement breakpoints. |
|
44 |
" |
|
2512 | 45 |
! ! |
46 |
||
47 |
!BreakpointNode methodsFor:'accessing'! |
|
48 |
||
49 |
breakpoint |
|
50 |
^ breakpoint |
|
51 |
! |
|
52 |
||
53 |
breakpoint:something |
|
54 |
breakpoint := something. |
|
55 |
! |
|
56 |
||
4513 | 57 |
endPosition |
58 |
^ expression endPosition |
|
59 |
! |
|
60 |
||
2512 | 61 |
expression |
62 |
^ expression |
|
63 |
! |
|
64 |
||
4657
fceb50f108b6
Set parent in `BreakpointNode >> #expression:`
Jan Vrany <jan.vrany@labware.com>
parents:
4656
diff
changeset
|
65 |
expression: aParseNode |
fceb50f108b6
Set parent in `BreakpointNode >> #expression:`
Jan Vrany <jan.vrany@labware.com>
parents:
4656
diff
changeset
|
66 |
expression := aParseNode. |
fceb50f108b6
Set parent in `BreakpointNode >> #expression:`
Jan Vrany <jan.vrany@labware.com>
parents:
4656
diff
changeset
|
67 |
expression parent: self |
fceb50f108b6
Set parent in `BreakpointNode >> #expression:`
Jan Vrany <jan.vrany@labware.com>
parents:
4656
diff
changeset
|
68 |
|
fceb50f108b6
Set parent in `BreakpointNode >> #expression:`
Jan Vrany <jan.vrany@labware.com>
parents:
4656
diff
changeset
|
69 |
"Modified: / 08-08-2020 / 22:46:45 / Jan Vrany <jan.vrany@labware.com>" |
2540 | 70 |
! |
71 |
||
72 |
lineNumber |
|
73 |
^ lineNumber |
|
74 |
! |
|
75 |
||
3466 | 76 |
lineNumber:lineNumberArg |
77 |
self assert:(lineNumberArg >= 0). |
|
78 |
lineNumber := lineNumberArg. |
|
3482 | 79 |
! |
80 |
||
81 |
realNode |
|
82 |
^ expression |
|
3515 | 83 |
! |
84 |
||
85 |
selectorPosition |
|
86 |
^ expression selectorPosition |
|
4513 | 87 |
! |
88 |
||
89 |
startPosition |
|
90 |
^ expression startPosition |
|
2512 | 91 |
! ! |
92 |
||
93 |
!BreakpointNode methodsFor:'code generation'! |
|
94 |
||
3349 | 95 |
codeForCascadeOn:aStream inBlock:b for:aCompiler |
96 |
|node| |
|
97 |
||
4222 | 98 |
node := UnaryNode |
3349 | 99 |
receiver: (ConstantNode value: breakpoint) |
100 |
selector: #break. |
|
101 |
node lineNumber:lineNumber. |
|
102 |
node codeForSideEffectOn:aStream inBlock:b for:aCompiler. |
|
103 |
expression notNil ifTrue:[ |
|
104 |
expression codeForCascadeOn:aStream inBlock:b for:aCompiler |
|
105 |
]. |
|
4222 | 106 |
|
107 |
"Modified: / 26-03-2018 / 15:39:38 / stefan" |
|
3349 | 108 |
! |
109 |
||
3446 | 110 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
111 |
|node| |
|
112 |
||
4222 | 113 |
node := UnaryNode |
3446 | 114 |
receiver: (ConstantNode value: breakpoint) |
115 |
selector: #break. |
|
116 |
node lineNumber:lineNumber. |
|
117 |
node codeForSideEffectOn:aStream inBlock:b for:aCompiler. |
|
118 |
expression notNil ifTrue:[ |
|
119 |
expression codeForSideEffectOn:aStream inBlock:b for:aCompiler |
|
120 |
]. |
|
4222 | 121 |
|
122 |
"Modified: / 26-03-2018 / 15:39:33 / stefan" |
|
3446 | 123 |
! |
124 |
||
2512 | 125 |
codeOn:aStream inBlock:codeBlock for:aCompiler |
2540 | 126 |
|node| |
2512 | 127 |
|
4594 | 128 |
"/ Transcript showCR:'**** bpCode: %1 expr: %2' with:lineNumber with:expression printString. |
129 |
||
4222 | 130 |
node := UnaryNode |
2540 | 131 |
receiver: (ConstantNode value: breakpoint) |
132 |
selector: #break. |
|
133 |
node lineNumber:lineNumber. |
|
134 |
node codeForSideEffectOn:aStream inBlock:codeBlock for:aCompiler. |
|
3226 | 135 |
expression notNil ifTrue:[ |
136 |
expression codeOn:aStream inBlock:codeBlock for:aCompiler |
|
137 |
]. |
|
2512 | 138 |
|
139 |
"Created: / 16-06-2011 / 15:17:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3226 | 140 |
"Modified: / 22-07-2013 / 16:08:34 / cg" |
4222 | 141 |
"Modified: / 26-03-2018 / 15:38:22 / stefan" |
2512 | 142 |
! ! |
143 |
||
4513 | 144 |
!BreakpointNode methodsFor:'enumerating'! |
145 |
||
146 |
childrenDo:aBlock |
|
147 |
aBlock value:expression |
|
148 |
! ! |
|
149 |
||
4656
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
150 |
!BreakpointNode methodsFor:'enumeration'! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
151 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
152 |
allSubNodesDo:aBlock |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
153 |
aBlock value: expression. |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
154 |
expression allSubNodesDo:aBlock. |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
155 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
156 |
"Created: / 08-08-2020 / 08:45:51 / Jan Vrany <jan.vrany@labware.com>" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
157 |
! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
158 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
159 |
blockNodesDo:aBlock recursively: aBoolean |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
160 |
" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
161 |
Evaluate `aBlock` for each `BlockNode` in receicer's subtree. |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
162 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
163 |
If, `aBoolean` is true, then recurse into block nodes themselves, |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
164 |
evaluating `aBlock` for (all) nested blocks. |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
165 |
If `aBoolean` is false, stop at any block node. |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
166 |
" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
167 |
^ expression blockNodesDo:aBlock recursively: aBoolean |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
168 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
169 |
"Created: / 08-08-2020 / 08:46:44 / Jan Vrany <jan.vrany@labware.com>" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
170 |
! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
171 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
172 |
messagesDo:aBlock |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
173 |
"evaluate aBlock for each message-node here and in subnodes" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
174 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
175 |
^ expression messagesDo:aBlock |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
176 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
177 |
"Created: / 08-08-2020 / 08:46:12 / Jan Vrany <jan.vrany@labware.com>" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
178 |
! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
179 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
180 |
variableNodesDo:aBlock |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
181 |
"evaluate aBlock for each variable-node here and in subnodes" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
182 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
183 |
^ expression variableNodesDo:aBlock |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
184 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
185 |
"Created: / 08-08-2020 / 08:46:24 / Jan Vrany <jan.vrany@labware.com>" |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
186 |
! ! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
187 |
|
4365 | 188 |
!BreakpointNode methodsFor:'evaluation'! |
189 |
||
190 |
evaluateIn:anEnvironment |
|
191 |
^ expression evaluateIn:anEnvironment |
|
192 |
||
193 |
"Created: / 20-02-2019 / 22:17:35 / Claus Gittinger" |
|
194 |
! ! |
|
195 |
||
3350 | 196 |
!BreakpointNode methodsFor:'node protocol forwarding'! |
2544 | 197 |
|
3350 | 198 |
arg1 |
199 |
"must forward - otherwise cascades won't work" |
|
2544 | 200 |
|
3350 | 201 |
^ expression arg1 |
202 |
! |
|
2534 | 203 |
|
3609 | 204 |
args |
205 |
"must forward - otherwise keywordExpression won't work" |
|
206 |
||
207 |
^ expression args |
|
208 |
! |
|
209 |
||
3640 | 210 |
argumentCount |
211 |
"must forward - otherwise checkCondition won't work" |
|
212 |
||
213 |
^ expression argumentCount |
|
214 |
! |
|
215 |
||
3350 | 216 |
arguments |
217 |
"must forward - otherwise cascades won't work" |
|
2534 | 218 |
|
3350 | 219 |
^ expression arguments |
3349 | 220 |
! |
221 |
||
222 |
isMessage |
|
223 |
"must forward - otherwise cascades won't work" |
|
224 |
||
225 |
^ expression isMessage |
|
226 |
! |
|
227 |
||
4686 | 228 |
isUnaryMessage |
229 |
"must forward - otherwise cascades won't work" |
|
230 |
||
231 |
^ expression isUnaryMessage |
|
232 |
||
233 |
"Created: / 26-07-2020 / 18:24:18 / cg" |
|
234 |
! |
|
235 |
||
3610 | 236 |
numArgs |
4557 | 237 |
<resource: #obsolete> |
238 |
||
4072 | 239 |
"must forward - otherwise checkCondition won't work. |
240 |
Please use argumentCount, which is ANSI" |
|
3610 | 241 |
|
242 |
^ expression numArgs |
|
243 |
! |
|
244 |
||
4047 | 245 |
plausibilityCheckIn:aParser |
246 |
^ expression plausibilityCheckIn:aParser |
|
247 |
||
248 |
"Created: / 20-11-2016 / 19:17:54 / cg" |
|
249 |
! |
|
250 |
||
3349 | 251 |
receiver |
252 |
"must forward - otherwise cascades won't work" |
|
253 |
||
254 |
^ expression receiver |
|
255 |
! |
|
256 |
||
257 |
selector |
|
258 |
"must forward - otherwise cascades won't work" |
|
259 |
||
260 |
^ expression selector |
|
2534 | 261 |
! ! |
262 |
||
3350 | 263 |
!BreakpointNode methodsFor:'printing'! |
264 |
||
265 |
printOn:aStream indent:indent |
|
266 |
"append a user printed representation of the receiver to aStream. |
|
267 |
The format is suitable for a human - not meant to be read back." |
|
268 |
||
4594 | 269 |
aStream show:'BP [%1] before: ' with:lineNumber. |
270 |
expression printOn:aStream indent:indent. |
|
3350 | 271 |
|
272 |
"Created: / 06-07-2011 / 14:31:10 / cg" |
|
273 |
! ! |
|
274 |
||
275 |
!BreakpointNode methodsFor:'testing'! |
|
276 |
||
277 |
isBreakPointNode |
|
278 |
^ true |
|
279 |
||
280 |
"Created: / 05-07-2011 / 21:13:52 / cg" |
|
281 |
! ! |
|
282 |
||
2512 | 283 |
!BreakpointNode class methodsFor:'documentation'! |
284 |
||
3350 | 285 |
version |
4047 | 286 |
^ '$Header$' |
3350 | 287 |
! |
288 |
||
2512 | 289 |
version_CVS |
4047 | 290 |
^ '$Header$' |
2512 | 291 |
! |
292 |
||
4656
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
293 |
version_HG |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
294 |
|
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
295 |
^ '$Changeset: <not expanded> $' |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
296 |
! |
a5dfa5a9cbca
Fix various node enumeration methods for `BreakpointNode`
Jan Vrany <jan.vrany@labware.com>
parents:
4222
diff
changeset
|
297 |
|
2512 | 298 |
version_SVN |
3226 | 299 |
^ '$ Id $' |
2512 | 300 |
! ! |
3226 | 301 |