author | Claus Gittinger <cg@exept.de> |
Tue, 24 Apr 2018 18:33:38 +0200 | |
changeset 4237 | 7414f4311853 |
parent 4234 | b79020a649be |
child 4259 | c707f9aa7015 |
child 4277 | 6ee15273e438 |
permissions | -rw-r--r-- |
4232 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
4 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
53 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1044 | 14 |
"{ Package: 'stx:libcomp' }" |
15 |
||
3553 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
0 | 18 |
Object subclass:#ParseNode |
2550 | 19 |
instanceVariableNames:'parent type comments parenthized startPosition endPosition |
20 |
attributes' |
|
1046 | 21 |
classVariableNames:'' |
244
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
22 |
poolDictionaries:'' |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
23 |
category:'System-Compiler-Support' |
0 | 24 |
! |
25 |
||
20 | 26 |
!ParseNode class methodsFor:'documentation'! |
27 |
||
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
53 | 31 |
All Rights Reserved |
20 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
node for parse-trees; abstract class |
|
261 | 45 |
This is a helper class for the compiler. |
263 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
20 | 49 |
" |
50 |
! ! |
|
0 | 51 |
|
52 |
!ParseNode class methodsFor:'instance creation'! |
|
53 |
||
54 |
type:t |
|
55 |
^ (self basicNew) type:t |
|
56 |
! ! |
|
57 |
||
2819 | 58 |
!ParseNode methodsFor:'accessing'! |
2694 | 59 |
|
2819 | 60 |
enclosingBlock |
61 |
"Return closest enclosing block node or nil" |
|
62 |
||
63 |
| block | |
|
64 |
block := parent. |
|
3485 | 65 |
[ block notNil and:[block realNode isBlockNode not] ] whileTrue:[ |
66 |
block := block realNode parent. |
|
2819 | 67 |
]. |
68 |
^block. |
|
69 |
||
70 |
"Created: / 16-02-2012 / 22:46:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
71 |
! |
|
140 | 72 |
|
2505 | 73 |
endPosition |
3542 | 74 |
"the node's last character position in the original source" |
75 |
||
2505 | 76 |
^ endPosition |
77 |
! |
|
78 |
||
2265 | 79 |
endPosition:aCharacterPosition |
2505 | 80 |
|
81 |
endPosition := aCharacterPosition |
|
82 |
||
2618
256319b44ac8
More fixes for start/end position
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2564
diff
changeset
|
83 |
"Modified: / 28-07-2011 / 10:03:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2265 | 84 |
! |
85 |
||
2548 | 86 |
line |
87 |
||
88 |
"Compatibility" |
|
89 |
||
90 |
^self lineNumber |
|
91 |
||
92 |
"Created: / 09-07-2011 / 22:30:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
93 |
! |
|
94 |
||
95 |
lineNumber |
|
96 |
||
97 |
^nil |
|
98 |
||
99 |
"Created: / 09-07-2011 / 22:30:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
100 |
! |
|
101 |
||
140 | 102 |
lineNumber:dummy |
103 |
"set linenumber - ignored here" |
|
104 |
||
105 |
^ self |
|
106 |
! |
|
107 |
||
2550 | 108 |
parent |
109 |
||
110 |
^parent |
|
111 |
||
112 |
"Created: / 11-07-2011 / 17:36:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
113 |
! |
|
114 |
||
115 |
parent: aParseNode |
|
116 |
||
117 |
parent := aParseNode |
|
118 |
||
119 |
"Created: / 11-07-2011 / 17:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
120 |
! |
|
121 |
||
1990
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
122 |
parenthesized |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
123 |
^ parenthized ? false |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
124 |
! |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
125 |
|
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
126 |
parenthesized:aBoolean |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
127 |
parenthized := aBoolean |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
128 |
! |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
129 |
|
140 | 130 |
parenthized |
1990
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
131 |
"obsolete - typo in message name - use parenthesized" |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
132 |
|
1338 | 133 |
^ parenthized ? false |
140 | 134 |
! |
135 |
||
136 |
parenthized:aBoolean |
|
1990
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
137 |
"obsolete - typo in message name - use parenthesized:" |
ede012b2bd5b
oops - parenthesized was written with typo
Claus Gittinger <cg@exept.de>
parents:
1804
diff
changeset
|
138 |
|
140 | 139 |
parenthized := aBoolean |
140 |
! |
|
141 |
||
3483 | 142 |
realNode |
143 |
^ self |
|
144 |
! |
|
145 |
||
3300 | 146 |
selectorPartPositions:selectorPartPositions |
147 |
"/ ignored here, but implemented because sent without checking |
|
148 |
"/ when parsing keyword messages to an optimized messageNode |
|
149 |
"/ (which become optimized to a constantNode by the folder) |
|
150 |
||
151 |
"Created: / 28-08-2013 / 21:17:22 / cg" |
|
152 |
! |
|
153 |
||
598 | 154 |
selectorPosition:aCharacterPosition |
155 |
"ignored here" |
|
156 |
||
157 |
"Created: 5.8.1997 / 16:32:17 / cg" |
|
158 |
! |
|
159 |
||
2505 | 160 |
startPosition |
3542 | 161 |
"the node's character position in the original source" |
162 |
||
2505 | 163 |
^ startPosition |
164 |
! |
|
165 |
||
2550 | 166 |
startPosition:start |
2505 | 167 |
|
2550 | 168 |
startPosition := start |
2505 | 169 |
|
170 |
"Modified: / 08-04-2011 / 22:03:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2265 | 171 |
! |
172 |
||
2550 | 173 |
startPosition:start endPosition: end |
174 |
||
175 |
startPosition := start. |
|
2564
43f35a40884d
- parse tree nodes are no longer shared
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2550
diff
changeset
|
176 |
endPosition := end. |
43f35a40884d
- parse tree nodes are no longer shared
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2550
diff
changeset
|
177 |
^self |
2550 | 178 |
|
179 |
"Created: / 11-07-2011 / 17:44:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
180 |
! |
|
181 |
||
140 | 182 |
type |
183 |
"return the nodes type" |
|
184 |
||
185 |
^ type |
|
186 |
! ! |
|
187 |
||
2546
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
188 |
!ParseNode methodsFor:'attributes access'! |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
189 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
190 |
objectAttributes |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
191 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
192 |
^attributes |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
193 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
194 |
"Created: / 09-07-2011 / 12:17:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
195 |
! |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
196 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
197 |
objectAttributes: anObject |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
198 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
199 |
attributes := anObject |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
200 |
|
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
201 |
"Created: / 09-07-2011 / 12:18:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
202 |
! ! |
5ae96e911e36
ParseNode: added attributes instvar for other tools to store
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2533
diff
changeset
|
203 |
|
140 | 204 |
!ParseNode methodsFor:'checks'! |
205 |
||
2095 | 206 |
plausibilityCheckIn:aParser |
140 | 207 |
^ nil |
208 |
! ! |
|
209 |
||
210 |
!ParseNode methodsFor:'code generation'! |
|
211 |
||
212 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
|
213 |
"generate code for this statement - value not needed" |
|
214 |
||
215 |
self codeOn:aStream inBlock:b for:aCompiler. |
|
216 |
aStream nextPut:#drop |
|
373 | 217 |
! |
218 |
||
843
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
219 |
codeForSimpleReturnOn:aStream inBlock:b lineNumber:lineNrOrNil for:aCompiler |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
220 |
"generate code to return myself as a simple method return" |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
221 |
|
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
222 |
self codeOn:aStream inBlock:b for:aCompiler. |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
223 |
lineNrOrNil notNil ifTrue:[ |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
224 |
self codeLineNumber:lineNrOrNil on:aStream for:aCompiler |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
225 |
]. |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
226 |
aStream nextPut:#retTop. |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
227 |
|
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
228 |
|
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
229 |
! |
522c116f86d9
boolean-return expression rewrite
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
230 |
|
1056 | 231 |
codeInlineOn:aStream inBlock:b valueNeeded:valueNeeded for:aCompiler |
232 |
"generate code for this statement - value is needed" |
|
233 |
||
234 |
self codeOn:aStream inBlock:b for:aCompiler. |
|
235 |
! |
|
236 |
||
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
237 |
codeLineNumber:nr on:codeStream for:aCompiler |
373 | 238 |
"generate lineNumber information" |
239 |
||
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
240 |
aCompiler codeLineNumber:nr on:codeStream |
2029 | 241 |
! |
242 |
||
243 |
codeOn:aStream inBlock:codeBlock for:aCompiler |
|
244 |
^ self subclassResponsibility |
|
140 | 245 |
! ! |
246 |
||
1804
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
247 |
!ParseNode methodsFor:'code generation helpers'! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
248 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
249 |
emitPushGlobalWithLiteralIndex:litIndex on:aTokenCodeStream for:aCompiler |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
250 |
litIndex <= 255 ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
251 |
aTokenCodeStream nextPut:#pushGlobalS; nextPut:litIndex |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
252 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
253 |
litIndex <= 16rFFFF ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
254 |
aTokenCodeStream nextPut:#pushGlobalL; nextPut:litIndex; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
255 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
256 |
aTokenCodeStream nextPut:#pushGlobalVL; nextPut:0; nextPut:litIndex; nextPut:0; nextPut:0; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
257 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
258 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
259 |
! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
260 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
261 |
emitPushLiteral:value on:aTokenCodeStream for:aCompiler |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
262 |
|index| |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
263 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
264 |
index := aCompiler addLiteral:value. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
265 |
self emitPushLiteralIndex:index on:aTokenCodeStream for:aCompiler |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
266 |
! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
267 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
268 |
emitPushLiteralIndex:index on:aTokenCodeStream for:aCompiler |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
269 |
index <= 8 ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
270 |
aTokenCodeStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
271 |
nextPut:(#(pushLit1 pushLit2 pushLit3 pushLit4 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
272 |
pushLit5 pushLit6 pushLit7 pushLit8) at:index). |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
273 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
274 |
index <= 255 ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
275 |
aTokenCodeStream nextPut:#pushLitS; nextPut:index |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
276 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
277 |
index <= 16rFFFF ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
278 |
aTokenCodeStream nextPut:#pushLitL; nextPut:index; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
279 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
280 |
aTokenCodeStream nextPut:#pushLitVL; nextPut:0; nextPut:index; nextPut:0; nextPut:0; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
281 |
] |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
282 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
283 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
284 |
! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
285 |
|
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
286 |
emitSendLiteralIndex:litIndex numArgs:nargs line:lineNr on:aStream for:aCompiler |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
287 |
lineNr >= 255 ifTrue:[ |
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
288 |
self codeLineNumber: lineNr on: aStream for:aCompiler. |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
289 |
]. |
1804
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
290 |
(litIndex <= 255) ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
291 |
nargs <= 3 ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
292 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
293 |
nextPut:(#(send0 send1 send2 send3) at:(nargs+1)); nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
294 |
nextPut:litIndex. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
295 |
^ self. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
296 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
297 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
298 |
nextPut:#send; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
299 |
nextPut:litIndex; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
300 |
nextPut:nargs. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
301 |
^ self. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
302 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
303 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
304 |
(litIndex <= 16rFFFF) ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
305 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
306 |
nextPut:#sendL; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
307 |
nextPut:litIndex; nextPut:0; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
308 |
nextPut:nargs. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
309 |
^ self. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
310 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
311 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
312 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
313 |
nextPut:#sendVL; nextPut:0; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
314 |
nextPut:litIndex; nextPut:0; nextPut:0; nextPut:0; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
315 |
nextPut:nargs. |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
316 |
|
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
317 |
"Modified: / 13-04-2013 / 11:02:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1804
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
318 |
! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
319 |
|
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
320 |
emitStoreGlobalWithLiteralIndex:litIndex on:aTokenCodeStream for:aCompiler |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
321 |
litIndex <= 255 ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
322 |
aTokenCodeStream nextPut:#storeGlobalS; nextPut:litIndex |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
323 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
324 |
litIndex <= 16rFFFF ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
325 |
aTokenCodeStream nextPut:#storeGlobalL; nextPut:litIndex; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
326 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
327 |
aTokenCodeStream nextPut:#storeGlobalVL; nextPut:0; nextPut:litIndex; nextPut:0; nextPut:0; nextPut:0; nextPut:0 |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
328 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
329 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
330 |
! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
331 |
|
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
332 |
emitSuperSendLiteralIndex:litIndex classLiteralIndex:clsLitIndex numArgs:nargs line:lineNr on:aStream for:aCompiler |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
333 |
lineNr >= 255 ifTrue:[ |
3165
7894a735faac
Emit #lineno16 byte codes only, if line number really changes
Stefan Vogel <sv@exept.de>
parents:
3110
diff
changeset
|
334 |
self codeLineNumber: lineNr on: aStream for:aCompiler. |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
335 |
]. |
1804
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
336 |
(litIndex <= 255 and:[clsLitIndex <= 255]) ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
337 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
338 |
nextPut:#superSend; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
339 |
nextPut:litIndex; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
340 |
nextPut:nargs; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
341 |
nextPut:clsLitIndex. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
342 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
343 |
(litIndex <= 16rFFFF and:[clsLitIndex <= 16rFFFF]) ifTrue:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
344 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
345 |
nextPut:#superSendL; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
346 |
nextPut:litIndex; nextPut:0; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
347 |
nextPut:nargs; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
348 |
nextPut:clsLitIndex; nextPut:0. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
349 |
] ifFalse:[ |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
350 |
aStream |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
351 |
nextPut:#superSendVL; nextPut:0; nextPut:lineNr; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
352 |
nextPut:litIndex; nextPut:0; nextPut:0; nextPut:0; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
353 |
nextPut:nargs; |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
354 |
nextPut:clsLitIndex; nextPut:0; nextPut:0; nextPut:0. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
355 |
]. |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
356 |
]. |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
357 |
|
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
358 |
"Modified: / 13-04-2013 / 11:01:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1804
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
359 |
! ! |
7c22dbaa8d10
some code savers for common code-emit
Claus Gittinger <cg@exept.de>
parents:
1725
diff
changeset
|
360 |
|
1503 | 361 |
!ParseNode methodsFor:'enumeration'! |
362 |
||
3337 | 363 |
allNodesDo:aBlock |
364 |
"evaluate aBlock for each variable-node here and in subnodes" |
|
365 |
||
4232 | 366 |
aBlock value:self. |
367 |
self allSubNodesDo:aBlock. |
|
368 |
! |
|
369 |
||
370 |
allSubNodesDo:aBlock |
|
4234 | 371 |
"/ self subclassResponsibility. |
3337 | 372 |
! |
373 |
||
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
374 |
messageNodesDo:aBlock |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
375 |
"evaluate aBlock for each message-node here and in subnodes" |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
376 |
|
3315 | 377 |
self messagesDo:aBlock |
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
378 |
! |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
379 |
|
3276 | 380 |
messageSelectors |
3337 | 381 |
"return a collection of message selectors" |
3276 | 382 |
|
383 |
|setOfSymbols| |
|
384 |
||
385 |
setOfSymbols := Set new. |
|
3279 | 386 |
self messageSelectorsDo:[:each | setOfSymbols add:each ]. |
3276 | 387 |
^ setOfSymbols |
388 |
! |
|
389 |
||
3279 | 390 |
messageSelectorsDo:aBlock |
391 |
"evaluate aBlock for each message-selector here and in subnodes" |
|
392 |
||
393 |
^ self |
|
394 |
! |
|
395 |
||
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
396 |
messages |
3276 | 397 |
"return a collection of messageNodes" |
398 |
||
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
399 |
|setOfMessages| |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
400 |
|
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
401 |
setOfMessages := Set new. |
3279 | 402 |
self messagesDo:[:each | setOfMessages add:each ]. |
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
403 |
^ setOfMessages |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
404 |
! |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
405 |
|
1503 | 406 |
messagesDo:aBlock |
3275
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
407 |
"evaluate aBlock for each message-node here and in subnodes" |
921a8afad859
renamed messagesDo: to messageNodes: do
Claus Gittinger <cg@exept.de>
parents:
3184
diff
changeset
|
408 |
|
1503 | 409 |
^ self |
3315 | 410 |
! |
411 |
||
412 |
variableNodesDo:aBlock |
|
413 |
"evaluate aBlock for each variable-node here and in subnodes" |
|
414 |
||
415 |
^ self |
|
1503 | 416 |
! ! |
417 |
||
140 | 418 |
!ParseNode methodsFor:'evaluation'! |
419 |
||
1383 | 420 |
evaluate |
421 |
^ self evaluateIn:nil |
|
422 |
! |
|
423 |
||
140 | 424 |
evaluateForCascade |
1383 | 425 |
^ self evaluateForCascadeIn:nil |
426 |
! |
|
427 |
||
428 |
evaluateForCascadeIn:anEnvironment |
|
429 |
^ self evaluateIn:anEnvironment |
|
430 |
! |
|
431 |
||
432 |
evaluateIn:anEnvironment |
|
433 |
self subclassResponsibility |
|
2505 | 434 |
! |
435 |
||
436 |
isStatement |
|
437 |
^false. |
|
438 |
||
439 |
"Created: / 22-02-2011 / 16:29:50 / Jakub <zelenja7@fel.cvut.cz>" |
|
140 | 440 |
! ! |
441 |
||
1080 | 442 |
!ParseNode methodsFor:'printing & storing'! |
140 | 443 |
|
444 |
printOn:aStream |
|
914 | 445 |
"append a user printed representation of the receiver to aStream. |
446 |
The format is suitable for a human - not meant to be read back." |
|
447 |
||
140 | 448 |
self printOn:aStream indent:0 |
449 |
! |
|
450 |
||
1588 | 451 |
printOn:aStream indent:indent |
452 |
"append a user printed representation of the receiver to aStream. |
|
453 |
The format is suitable for a human - not meant to be read back." |
|
454 |
||
455 |
self subclassResponsibility |
|
456 |
||
457 |
"Created: / 20-04-2005 / 14:21:46 / cg" |
|
458 |
! |
|
459 |
||
460 |
printOn:aStream indent:indent parenthized:parenthized |
|
461 |
parenthized ifTrue:[ |
|
462 |
aStream nextPutAll:'(' |
|
463 |
]. |
|
464 |
self printOn:aStream indent:indent. |
|
465 |
parenthized ifTrue:[ |
|
466 |
aStream nextPutAll:')' |
|
467 |
]. |
|
468 |
||
469 |
"Created: / 20-04-2005 / 14:21:28 / cg" |
|
140 | 470 |
! ! |
471 |
||
472 |
!ParseNode methodsFor:'private'! |
|
473 |
||
474 |
type:t |
|
475 |
"set the nodes type" |
|
476 |
||
477 |
type := t |
|
478 |
! ! |
|
479 |
||
0 | 480 |
!ParseNode methodsFor:'queries'! |
481 |
||
244
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
482 |
canReuseAsArg:anotherNode |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
483 |
^ false |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
484 |
|
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
485 |
"Created: 14.4.1996 / 00:43:08 / cg" |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
486 |
! |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
487 |
|
395 | 488 |
collectBlocksInto:aCollection |
489 |
^ self |
|
490 |
||
491 |
"Created: 23.10.1996 / 15:45:00 / cg" |
|
492 |
! |
|
493 |
||
2382 | 494 |
containsReturn |
495 |
^ false |
|
496 |
! |
|
497 |
||
3296 | 498 |
positionToInsertPeriodForStatementSeparation |
499 |
^ self endPosition + (parenthized == true ifTrue:1 ifFalse:0) |
|
500 |
||
501 |
"Created: 14.4.1996 / 00:43:08 / cg" |
|
502 |
! |
|
503 |
||
2327 | 504 |
precedence |
505 |
^ 9999 |
|
506 |
! |
|
507 |
||
508 |
withConstantValueDo:aBlock |
|
509 |
"return true, if this evaluates to a constant value |
|
510 |
and evaluate aBlock with it" |
|
511 |
||
512 |
^ false |
|
513 |
! ! |
|
514 |
||
515 |
!ParseNode methodsFor:'testing'! |
|
516 |
||
140 | 517 |
isAssignment |
518 |
"return true, if this is a node for an assignment" |
|
519 |
||
520 |
^ false |
|
521 |
! |
|
522 |
||
523 |
isBinaryMessage |
|
524 |
"return true, if this is a node for a binary send" |
|
525 |
||
526 |
^ false |
|
527 |
! |
|
528 |
||
529 |
isBlockNode |
|
530 |
"return true, if this is a node for a block" |
|
531 |
||
532 |
^ false |
|
533 |
! |
|
534 |
||
2533 | 535 |
isBreakPointNode |
536 |
^ false |
|
537 |
||
538 |
"Created: / 05-07-2011 / 21:14:01 / cg" |
|
539 |
! |
|
540 |
||
744
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
541 |
isCascade |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
542 |
^ false |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
543 |
|
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
544 |
"Created: / 16.7.1998 / 20:11:33 / cg" |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
545 |
! |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
546 |
|
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
547 |
isCascadeToSuper |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
548 |
^ false |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
549 |
|
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
550 |
"Created: / 16.7.1998 / 19:51:07 / cg" |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
551 |
! |
e871f9f072f8
changes for cascades to super/here semantics.
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
552 |
|
0 | 553 |
isConstant |
13 | 554 |
"return true, if this is a node for a constant" |
555 |
||
556 |
^ false |
|
557 |
! |
|
558 |
||
1533 | 559 |
isErrorNode |
560 |
^ false |
|
561 |
! |
|
562 |
||
53 | 563 |
isGlobal |
564 |
"return true, if this is a node for a global variable" |
|
565 |
||
566 |
^ false |
|
567 |
! |
|
568 |
||
2000 | 569 |
isGlobalNamed:globalName |
570 |
"return true, if this is a node for a particular global variable" |
|
571 |
||
572 |
^ false |
|
573 |
||
574 |
"Created: / 05-03-2007 / 15:13:23 / cg" |
|
575 |
! |
|
576 |
||
1310
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
577 |
isGlobalVariable |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
578 |
^ false |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
579 |
! |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
580 |
|
1528 | 581 |
isImmutable |
582 |
"not used with ST/X - |
|
583 |
for JavaScript nodes return true here." |
|
584 |
||
585 |
^ true |
|
586 |
! |
|
587 |
||
2403
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
588 |
isImplicitJavaScriptMessage |
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
589 |
"return true, if this is a node for an implicit getter/setter send" |
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
590 |
|
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
591 |
^ false |
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
592 |
|
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
593 |
"Created: / 05-07-2010 / 14:11:41 / cg" |
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
594 |
! |
79c95fae81e8
added: #isImplicitJavaScriptMessage
Claus Gittinger <cg@exept.de>
parents:
2402
diff
changeset
|
595 |
|
4237 | 596 |
isInnerFunction |
597 |
^ false |
|
598 |
! |
|
599 |
||
1725 | 600 |
isInnerJavaScriptBlock |
601 |
^ false |
|
602 |
! |
|
603 |
||
2862 | 604 |
isJAVA |
605 |
"Return true, if receiver is global variable node JAVA. |
|
606 |
Used to highlight Java class references." |
|
607 |
||
608 |
^false |
|
609 |
||
610 |
"Created: / 19-04-2012 / 09:36:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
611 |
! |
|
612 |
||
613 |
isJavaPackageReference |
|
614 |
"Return true, given node is JAVA package reference in form: |
|
615 |
JAVA package1 package2 |
|
616 |
" |
|
617 |
||
618 |
^false |
|
619 |
||
620 |
"Created: / 19-04-2012 / 09:53:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
621 |
! |
|
622 |
||
3184 | 623 |
isJavaScriptAndExpression |
624 |
^ false |
|
625 |
! |
|
626 |
||
2402
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
627 |
isJavaScriptArrayAccess |
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
628 |
"return true, if this is a node for a javascript array reference i.e. expr[]" |
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
629 |
|
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
630 |
^ false |
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
631 |
|
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
632 |
"Created: / 05-07-2010 / 14:04:27 / cg" |
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
633 |
! |
da3d16a4193d
changed: #testplanItem:groupPattern:executor:testPlanExecutor:
Claus Gittinger <cg@exept.de>
parents:
2401
diff
changeset
|
634 |
|
2400 | 635 |
isJavaScriptBlock |
636 |
"return true, if this is a node for a javascript block" |
|
637 |
||
638 |
^ false |
|
639 |
||
640 |
"Created: / 09-06-2010 / 01:53:19 / cg" |
|
641 |
! |
|
642 |
||
3438 | 643 |
isJavaScriptClassNode |
644 |
^ false |
|
645 |
! |
|
646 |
||
2401
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
647 |
isJavaScriptConditionalExpression |
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
648 |
"return true, if this is a node for a ?: expression" |
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
649 |
|
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
650 |
^ false |
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
651 |
|
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
652 |
"Created: / 09-06-2010 / 01:55:15 / cg" |
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
653 |
! |
3bfe65bdcc64
added: #isJavaScriptConditionalExpression
Claus Gittinger <cg@exept.de>
parents:
2400
diff
changeset
|
654 |
|
3184 | 655 |
isJavaScriptOrExpression |
656 |
^ false |
|
657 |
! |
|
658 |
||
3812 | 659 |
isLiteral |
660 |
"for compatibility with RB-AST" |
|
661 |
||
662 |
^ self isConstant |
|
663 |
! |
|
664 |
||
3474 | 665 |
isLocalVariable |
666 |
^ false |
|
667 |
! |
|
668 |
||
140 | 669 |
isMessage |
670 |
"return true, if this is a node for a message expression" |
|
19 | 671 |
|
672 |
^ false |
|
673 |
! |
|
674 |
||
3414 | 675 |
isMethodNode |
676 |
^ false |
|
677 |
! |
|
678 |
||
1310
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
679 |
isMethodVariable |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
680 |
^ false |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
681 |
! |
feb30ab0c221
better variabletype queries.
Claus Gittinger <cg@exept.de>
parents:
1114
diff
changeset
|
682 |
|
2327 | 683 |
isNew |
684 |
"return true, if this is a new XXXX node" |
|
685 |
||
686 |
^ false |
|
687 |
! |
|
688 |
||
2088 | 689 |
isPostIncDec |
690 |
"for JavaScript" |
|
691 |
||
692 |
^ false |
|
693 |
! |
|
694 |
||
695 |
isPreIncDec |
|
696 |
"for JavaScript" |
|
697 |
||
698 |
^ false |
|
699 |
! |
|
700 |
||
140 | 701 |
isPrimary |
702 |
"return true, if this is a node for a primary (i.e. non-send)" |
|
13 | 703 |
|
704 |
^ false |
|
705 |
! |
|
706 |
||
707 |
isReturnNode |
|
708 |
"return true, if this is a node for a return expression" |
|
709 |
||
0 | 710 |
^ false |
711 |
! |
|
712 |
||
3974 | 713 |
isSelector |
714 |
"return true, if this is a selector-node" |
|
715 |
||
716 |
^ false |
|
717 |
! |
|
718 |
||
862 | 719 |
isSelf |
720 |
"return true, if this is a self-node" |
|
721 |
||
722 |
^ false |
|
723 |
! |
|
724 |
||
2505 | 725 |
isStatementNode |
726 |
"return true, if this is a statement node" |
|
727 |
||
728 |
^ false |
|
729 |
||
730 |
"Created: / 13-06-2011 / 11:26:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
731 |
! |
|
732 |
||
140 | 733 |
isSuper |
734 |
"return true, if this is a super-node" |
|
13 | 735 |
|
0 | 736 |
^ false |
737 |
! |
|
738 |
||
2089 | 739 |
isThis |
740 |
"for JavaScript" |
|
741 |
||
742 |
^ false |
|
743 |
! |
|
744 |
||
0 | 745 |
isUnaryMessage |
13 | 746 |
"return true, if this is a node for a unary send" |
747 |
||
0 | 748 |
^ false |
244
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
749 |
! |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
750 |
|
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
751 |
isVariable |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
752 |
"return true, if this is a node for a variable" |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
753 |
|
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
754 |
^ false |
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
755 |
|
2ce60e837d52
use dup if possible when pushing args
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
756 |
"Created: 14.4.1996 / 00:46:44 / cg" |
2694 | 757 |
! |
758 |
||
759 |
isVariableNode |
|
760 |
"return true, if this is a node for a variable" |
|
761 |
||
762 |
^ self isVariable |
|
763 |
||
764 |
"Created: / 12-09-2011 / 09:32:17 / cg" |
|
0 | 765 |
! ! |
766 |
||
148 | 767 |
!ParseNode class methodsFor:'documentation'! |
768 |
||
3276 | 769 |
version |
3812 | 770 |
^ '$Header$' |
3276 | 771 |
! |
772 |
||
2505 | 773 |
version_CVS |
3812 | 774 |
^ '$Header$' |
148 | 775 |
! ! |
3110
f517641d3673
Emit LINE16 bytecode insn just before a SEND bytecode is emmited when
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2862
diff
changeset
|
776 |