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