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