author | Stefan Vogel <sv@exept.de> |
Mon, 12 Dec 2016 16:38:47 +0100 | |
changeset 4080 | 08869106d07e |
parent 3338 | cce25bbca254 |
child 4163 | 00ff0d34f206 |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
52 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1080 | 12 |
"{ Package: 'stx:libcomp' }" |
13 |
||
0 | 14 |
ParseNode subclass:#StatementNode |
2503 | 15 |
instanceVariableNames:'expression nextStatement lineNr' |
261 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'System-Compiler-Support' |
|
0 | 19 |
! |
20 |
||
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
21 |
!StatementNode class methodsFor:'documentation'! |
20 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
52 | 26 |
All Rights Reserved |
20 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
node for parse-trees, representing statements |
|
261 | 40 |
This is a helper class for the compiler. |
263 | 41 |
|
42 |
[author:] |
|
43 |
Claus Gittinger |
|
20 | 44 |
" |
45 |
! ! |
|
0 | 46 |
|
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
47 |
!StatementNode class methodsFor:'instance creation'! |
0 | 48 |
|
49 |
expression:e |
|
50 |
^ (self basicNew) expression:e |
|
51 |
! ! |
|
52 |
||
140 | 53 |
!StatementNode methodsFor:'accessing'! |
0 | 54 |
|
140 | 55 |
expression |
56 |
^ expression |
|
0 | 57 |
! |
58 |
||
2598 | 59 |
expression:something |
60 |
||
61 |
expression notNil ifTrue:[expression parent: nil]. |
|
62 |
expression := something. |
|
2667 | 63 |
expression notNil ifTrue:[ |
64 |
expression parent: self. |
|
65 |
startPosition := expression startPosition. |
|
66 |
endPosition := expression endPosition. |
|
67 |
]. |
|
2613
4e1f7de0d215
More fixes to keep node position in the source. Not yet fully implemented
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2598
diff
changeset
|
68 |
|
4e1f7de0d215
More fixes to keep node position in the source. Not yet fully implemented
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2598
diff
changeset
|
69 |
"Modified: / 27-07-2011 / 13:51:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2667 | 70 |
"Modified: / 20-08-2011 / 20:00:56 / cg" |
0 | 71 |
! |
72 |
||
2503 | 73 |
isStatement |
74 |
^true. |
|
75 |
||
76 |
"Created: / 22-02-2011 / 15:04:36 / Jakub <zelenja7@fel.cvut.cz>" |
|
77 |
! |
|
78 |
||
0 | 79 |
last |
80 |
"return the last statement in a list" |
|
81 |
||
82 |
|last this| |
|
83 |
||
84 |
"this could be done more elegant - but with lots of recursion" |
|
85 |
last := self. |
|
86 |
this := self. |
|
87 |
[this notNil] whileTrue:[ |
|
52 | 88 |
last := this. |
89 |
this := this nextStatement |
|
0 | 90 |
]. |
91 |
^ last |
|
92 |
! |
|
93 |
||
711 | 94 |
lineNumber |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
95 |
"return lineNr" |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
96 |
|
1504 | 97 |
lineNr notNil ifTrue:[^ lineNr]. |
98 |
expression notNil ifTrue:[ ^ expression lineNumber ]. |
|
99 |
nextStatement notNil ifTrue:[^ nextStatement lineNumber]. |
|
100 |
^ nil |
|
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
101 |
|
711 | 102 |
"Created: / 14.5.1998 / 19:31:06 / cg" |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
103 |
! |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
104 |
|
711 | 105 |
lineNumber:something |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
106 |
"set lineNr" |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
107 |
|
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
108 |
lineNr := something. |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
109 |
|
711 | 110 |
"Created: / 14.5.1998 / 19:31:11 / cg" |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
111 |
! |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
112 |
|
1504 | 113 |
lineNumberOfFirstMessage |
114 |
|lno| |
|
115 |
||
116 |
lno := self lineNumber. |
|
3277 | 117 |
self messagesDo:[:m | lno := lno min:(m lineNumber)]. |
1504 | 118 |
^ lno |
119 |
! |
|
120 |
||
0 | 121 |
nextStatement |
122 |
^ nextStatement |
|
123 |
! |
|
124 |
||
140 | 125 |
nextStatement:s |
2598 | 126 |
|
127 |
nextStatement notNil ifTrue:[nextStatement parent: nil]. |
|
128 |
nextStatement := s. |
|
129 |
nextStatement notNil ifTrue:[nextStatement parent: parent]. |
|
130 |
||
131 |
"Modified: / 20-07-2011 / 21:42:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
132 |
! |
|
133 |
||
134 |
parent: aParseNode |
|
135 |
||
136 |
super parent: aParseNode. |
|
137 |
nextStatement notNil ifTrue:[nextStatement parent: aParseNode]. |
|
138 |
||
139 |
"Created: / 20-07-2011 / 19:52:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
140 | 140 |
! ! |
141 |
||
142 |
!StatementNode methodsFor:'code generation'! |
|
143 |
||
1379 | 144 |
codeAllForSideEffectOn:aStream inBlock:b for:aCompiler |
145 |
|thisStatement| |
|
146 |
||
147 |
thisStatement := self. |
|
148 |
[thisStatement notNil] whileTrue:[ |
|
149 |
thisStatement codeForSideEffectOn:aStream inBlock:b for:aCompiler. |
|
150 |
thisStatement := thisStatement nextStatement |
|
151 |
]. |
|
152 |
! |
|
153 |
||
140 | 154 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
155 |
"generate code for this statement - value not needed" |
|
156 |
||
985 | 157 |
expression notNil ifTrue:[ |
158 |
expression codeForSideEffectOn:aStream inBlock:b for:aCompiler |
|
159 |
] |
|
0 | 160 |
! |
161 |
||
140 | 162 |
codeOn:aStream inBlock:b for:aCompiler |
163 |
"generate code for this statement" |
|
164 |
||
1313 | 165 |
expression notNil ifTrue:[ |
166 |
expression codeOn:aStream inBlock:b for:aCompiler |
|
167 |
] |
|
0 | 168 |
! ! |
169 |
||
1209 | 170 |
!StatementNode methodsFor:'converting'! |
171 |
||
172 |
asCollectionOfStatements |
|
173 |
"returns a orderedCollection of statements, |
|
174 |
representing the list of which the receiver is the head" |
|
175 |
||
176 |
|coll stat| |
|
177 |
||
178 |
coll := OrderedCollection new. |
|
179 |
stat := self. |
|
180 |
[stat notNil] whileTrue:[ |
|
2695
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
181 |
stat expression isNil ifTrue:[ |
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
182 |
] ifFalse:[ |
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
183 |
coll add:stat. |
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
184 |
]. |
1209 | 185 |
stat := stat nextStatement. |
186 |
]. |
|
187 |
^ coll |
|
2695
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
188 |
|
28c485e5738e
changed: #asCollectionOfStatements
Claus Gittinger <cg@exept.de>
parents:
2667
diff
changeset
|
189 |
"Modified: / 12-09-2011 / 10:02:47 / cg" |
1209 | 190 |
! ! |
191 |
||
1035 | 192 |
!StatementNode methodsFor:'enumerating'! |
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
193 |
|
3338 | 194 |
allNodesDo:aBlock |
195 |
"evaluate aBlock for each node in this node and subnodes" |
|
196 |
||
197 |
|s e| |
|
198 |
||
199 |
s := self. |
|
200 |
[s notNil] whileTrue:[ |
|
201 |
aBlock value:s. |
|
202 |
s ~~ self ifTrue:[ |
|
203 |
s allNodesDo:aBlock. |
|
204 |
]. |
|
205 |
e := s expression. |
|
206 |
e notNil ifTrue:[e allNodesDo:aBlock]. |
|
207 |
s := s nextStatement |
|
208 |
]. |
|
209 |
! |
|
210 |
||
3044 | 211 |
do:aBlock |
212 |
"in st/x, statements is a linked list (not an ordered collection), |
|
213 |
this provides some dialect compatibility (for st2js)" |
|
214 |
||
215 |
| this | |
|
216 |
||
217 |
"/ too stupid: ST/X statements are linked as a list ... |
|
218 |
||
219 |
this := self. |
|
220 |
[this notNil] whileTrue:[ |
|
221 |
aBlock value:this. |
|
222 |
this := this nextStatement |
|
223 |
]. |
|
224 |
! |
|
225 |
||
3277 | 226 |
messageSelectorsDo:aBlock |
3273
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
227 |
"evaluate aBlock for each message-selector sent by this node and subnodes" |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
228 |
|
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
229 |
|s e| |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
230 |
|
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
231 |
s := self. |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
232 |
[s notNil] whileTrue:[ |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
233 |
e := s expression. |
3277 | 234 |
e notNil ifTrue:[e messageSelectorsDo:aBlock]. |
3273
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
235 |
s := s nextStatement |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
236 |
]. |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
237 |
! |
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
238 |
|
1504 | 239 |
messagesDo:aBlock |
3314 | 240 |
"evaluate aBlock for each message-node sent by this node and subnodes" |
3273
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
241 |
|
1504 | 242 |
|s e| |
243 |
||
244 |
s := self. |
|
245 |
[s notNil] whileTrue:[ |
|
246 |
e := s expression. |
|
247 |
e notNil ifTrue:[e messagesDo:aBlock]. |
|
248 |
s := s nextStatement |
|
249 |
]. |
|
250 |
! |
|
251 |
||
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
252 |
nodeDo:anEnumerator |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
253 |
"helper for parse tree walking" |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
254 |
|
1585 | 255 |
|stats this expr| |
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
256 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
257 |
"/ too stupid: ST/X statements are linked as a list ... |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
258 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
259 |
stats := OrderedCollection new. |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
260 |
this := self. |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
261 |
[this notNil] whileTrue:[ |
1592 | 262 |
this isReturnNode ifTrue:[ |
263 |
stats add:this |
|
264 |
] ifFalse:[ |
|
265 |
expr := this expression. |
|
266 |
stats add:(expr ? this). |
|
267 |
]. |
|
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
268 |
this := this nextStatement |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
269 |
]. |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
270 |
^ anEnumerator doSequence:self temporaries:#() statements:stats |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
271 |
|
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
272 |
"Created: 19.6.1997 / 16:45:34 / cg" |
542 | 273 |
"Modified: 19.6.1997 / 17:06:47 / cg" |
3314 | 274 |
! |
275 |
||
276 |
variableNodesDo:aBlock |
|
277 |
"evaluate aBlock for each variable-node in this node and subnodes" |
|
278 |
||
279 |
|s e| |
|
280 |
||
281 |
s := self. |
|
282 |
[s notNil] whileTrue:[ |
|
283 |
e := s expression. |
|
284 |
e notNil ifTrue:[e variableNodesDo:aBlock]. |
|
285 |
s := s nextStatement |
|
286 |
]. |
|
539
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
287 |
! ! |
69a1cd05c7d6
added node-walk facility (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
288 |
|
1035 | 289 |
!StatementNode methodsFor:'evaluation'! |
140 | 290 |
|
1384 | 291 |
evaluateAllIn:anEnvironment |
140 | 292 |
|lastValue thisStatement| |
52 | 293 |
|
140 | 294 |
"this could be done more elegant - but with lots of recursion" |
295 |
thisStatement := self. |
|
296 |
[thisStatement notNil] whileTrue:[ |
|
1384 | 297 |
lastValue := thisStatement evaluateExpressionIn:anEnvironment. |
298 |
thisStatement := thisStatement nextStatement |
|
140 | 299 |
]. |
300 |
^ lastValue |
|
301 |
! |
|
302 |
||
1384 | 303 |
evaluateExpressionIn:anEnvironment |
304 |
^ expression evaluateIn:anEnvironment |
|
305 |
! |
|
306 |
||
307 |
evaluateIn:anEnvironment |
|
308 |
^ self evaluateAllIn:anEnvironment. |
|
52 | 309 |
! ! |
310 |
||
1080 | 311 |
!StatementNode methodsFor:'printing & storing'! |
0 | 312 |
|
313 |
printAllOn:aStream |
|
314 |
self printAllOn:aStream indent:4 |
|
315 |
! |
|
316 |
||
317 |
printAllOn:aStream indent:i |
|
318 |
|thisStatement| |
|
319 |
||
320 |
thisStatement := self. |
|
321 |
[thisStatement notNil] whileTrue:[ |
|
1379 | 322 |
aStream spaces:i. |
323 |
thisStatement printOn:aStream indent:i. |
|
324 |
thisStatement nextStatement notNil ifTrue:[ |
|
1633 | 325 |
aStream nextPut:$.. |
1379 | 326 |
aStream cr. |
327 |
]. |
|
328 |
thisStatement := thisStatement nextStatement |
|
0 | 329 |
] |
140 | 330 |
! |
331 |
||
332 |
printOn:aStream indent:i |
|
2168
be3e52955e96
care for nil expression when printing
Claus Gittinger <cg@exept.de>
parents:
2103
diff
changeset
|
333 |
expression notNil ifTrue:[ expression printOn:aStream indent:i ]. |
0 | 334 |
! ! |
140 | 335 |
|
336 |
!StatementNode methodsFor:'queries'! |
|
337 |
||
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
338 |
collectBlocksInto:aCollection |
511
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
339 |
|this ex| |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
340 |
|
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
341 |
this := self. |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
342 |
[this notNil] whileTrue:[ |
511
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
343 |
ex := this expression. |
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
344 |
ex notNil ifTrue:[ |
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
345 |
ex collectBlocksInto:aCollection. |
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
346 |
]. |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
347 |
this := this nextStatement |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
348 |
]. |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
349 |
|
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
350 |
"Created: 23.10.1996 / 15:44:13 / cg" |
511
c144804051db
handle corrupt expression (nil) in statement
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
351 |
"Modified: 20.4.1997 / 12:10:18 / cg" |
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
352 |
! |
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
353 |
|
2385 | 354 |
containsReturn |
355 |
^ self expression containsReturn |
|
356 |
! |
|
357 |
||
358 |
containsReturnInAnyStatement |
|
359 |
|s| |
|
360 |
||
361 |
s := self. |
|
362 |
[s notNil] whileTrue:[ |
|
2387 | 363 |
s isReturnNode ifTrue:[^ true]. |
2385 | 364 |
s containsReturn ifTrue:[^ true]. |
365 |
s := s nextStatement. |
|
366 |
]. |
|
367 |
^ false |
|
368 |
! |
|
369 |
||
2065 | 370 |
isSimpleConstant |
140 | 371 |
nextStatement notNil ifTrue:[^ false]. |
372 |
^ expression isConstant |
|
332
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
373 |
! |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
374 |
|
2103 | 375 |
isSimpleExpression |
376 |
nextStatement notNil ifTrue:[^ false]. |
|
377 |
^ expression notNil |
|
378 |
! |
|
379 |
||
2065 | 380 |
isSimpleVariable |
381 |
nextStatement notNil ifTrue:[^ false]. |
|
382 |
^ expression isVariable |
|
383 |
! |
|
384 |
||
332
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
385 |
listEndsWithReturn |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
386 |
|thisStatement lastStatement| |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
387 |
|
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
388 |
thisStatement := self. |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
389 |
[thisStatement notNil] whileTrue:[ |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
390 |
lastStatement := thisStatement. |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
391 |
thisStatement := thisStatement nextStatement |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
392 |
]. |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
393 |
|
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
394 |
^ lastStatement isReturnNode |
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
395 |
|
7ffd2016cf73
added query if statementList ends in a return
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
396 |
"Created: 19.8.1996 / 14:32:47 / cg" |
140 | 397 |
! ! |
398 |
||
2503 | 399 |
!StatementNode methodsFor:'testing'! |
400 |
||
401 |
isStatementNode |
|
402 |
||
403 |
^ true |
|
404 |
||
405 |
"Created: / 13-06-2011 / 11:26:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
406 |
"Modified: / 13-06-2011 / 14:05:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
407 |
! ! |
|
408 |
||
2598 | 409 |
!StatementNode methodsFor:'visiting'! |
410 |
||
411 |
acceptVisitor:aVisitor |
|
412 |
"Double dispatch back to the visitor, passing my type encoded in |
|
413 |
the selector (visitor pattern)" |
|
414 |
||
415 |
"stub code automatically generated - please change if required" |
|
416 |
||
417 |
^ aVisitor visitStatementNode:self |
|
418 |
! ! |
|
419 |
||
392
cce48e2f0778
moved lineNr instVar up to here
Claus Gittinger <cg@exept.de>
parents:
332
diff
changeset
|
420 |
!StatementNode class methodsFor:'documentation'! |
148 | 421 |
|
3277 | 422 |
version |
3338 | 423 |
^ '$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.48 2013-10-30 20:12:45 stefan Exp $' |
3277 | 424 |
! |
425 |
||
2503 | 426 |
version_CVS |
3338 | 427 |
^ '$Header: /cvs/stx/stx/libcomp/StatementNode.st,v 1.48 2013-10-30 20:12:45 stefan Exp $' |
2385 | 428 |
! |
429 |
||
2503 | 430 |
version_SVN |
3273
e637f0ae001c
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
431 |
^ '$ Id $' |
148 | 432 |
! ! |
3044 | 433 |