author | Claus Gittinger <cg@exept.de> |
Mon, 16 Feb 2009 14:10:39 +0100 | |
changeset 2165 | 4dde25bad190 |
parent 2097 | 5021a9eddd8e |
child 2324 | f7d2db52861b |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
52 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1079 | 12 |
"{ Package: 'stx:libcomp' }" |
13 |
||
0 | 14 |
MessageNode subclass:#BinaryNode |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
15 |
instanceVariableNames:'' |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
16 |
classVariableNames:'' |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
17 |
poolDictionaries:'' |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
18 |
category:'System-Compiler-Support' |
0 | 19 |
! |
20 |
||
20 | 21 |
!BinaryNode class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
52 | 26 |
All Rights Reserved |
20 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
node for parse-trees, representing binary message sends |
|
261 | 40 |
This is a helper class for the compiler. |
263 | 41 |
|
42 |
[author:] |
|
43 |
Claus Gittinger |
|
44 |
||
20 | 45 |
" |
46 |
! ! |
|
0 | 47 |
|
48 |
!BinaryNode methodsFor:'accessing'! |
|
49 |
||
50 |
arg |
|
51 |
^ argArray at:1 |
|
52 |
! ! |
|
53 |
||
1686 | 54 |
!BinaryNode methodsFor:'checks'! |
55 |
||
2097 | 56 |
plausibilityCheckIn:aParser |
1686 | 57 |
"check for possible precedence error" |
58 |
||
59 |
|rSelector| |
|
60 |
||
61 |
( #( #'*' #'/' #'//' #'\' #'\\' ) includes:selector) ifTrue:[ |
|
62 |
receiver isMessage ifTrue:[ |
|
1992 | 63 |
receiver parenthesized ifFalse:[ |
1718
3cd108bea7cd
parewnthesis plausibility check fixed
Claus Gittinger <cg@exept.de>
parents:
1686
diff
changeset
|
64 |
rSelector := receiver selector. |
3cd108bea7cd
parewnthesis plausibility check fixed
Claus Gittinger <cg@exept.de>
parents:
1686
diff
changeset
|
65 |
( #( #'+' #'-') includes:rSelector) ifTrue:[ |
1735 | 66 |
^ 'possible precedence error - use parenthesis to make evaluation order explicit.' |
1718
3cd108bea7cd
parewnthesis plausibility check fixed
Claus Gittinger <cg@exept.de>
parents:
1686
diff
changeset
|
67 |
]. |
1686 | 68 |
]. |
69 |
]. |
|
70 |
]. |
|
71 |
||
2097 | 72 |
^ super plausibilityCheckIn:aParser. |
1686 | 73 |
! ! |
74 |
||
0 | 75 |
!BinaryNode methodsFor:'code generation'! |
76 |
||
596
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
77 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
78 |
"generate code for this statement - value not needed" |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
79 |
|
1391 | 80 |
(selector == #= |
81 |
or:[selector == #~= |
|
82 |
or:[selector == #==]]) ifTrue:[ |
|
596
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
83 |
receiver isVariable ifTrue:[ |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
84 |
aCompiler |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
85 |
warning:'possible typing error: ''='' instead of '':=''' |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
86 |
position:selectorPosition to:selectorPosition. |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
87 |
] |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
88 |
]. |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
89 |
|
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
90 |
^ super codeForSideEffectOn:aStream inBlock:b for:aCompiler |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
91 |
|
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
92 |
"Created: 5.8.1997 / 02:32:55 / cg" |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
93 |
"Modified: 5.8.1997 / 02:50:18 / cg" |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
94 |
! |
7e1d73e3bc06
watch out for possible '=' vs. ':=' typing error.
Claus Gittinger <cg@exept.de>
parents:
263
diff
changeset
|
95 |
|
104 | 96 |
codeOn:aStream inBlock:b for:aCompiler |
96 | 97 |
|arg1 recVal argVal code| |
0 | 98 |
|
1500
3c4cb012b24b
Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents:
1409
diff
changeset
|
99 |
selector := selector asSymbol. |
3c4cb012b24b
Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents:
1409
diff
changeset
|
100 |
|
49 | 101 |
receiver isSuper ifFalse:[ |
1807 | 102 |
(aCompiler isBuiltInSelector:selector forReceiver:receiver) ifTrue:[ |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
103 |
arg1 := argArray at:1. |
76 | 104 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
105 |
receiver isConstant ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
106 |
recVal := receiver value. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
107 |
(receiver type == #Integer) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
108 |
((selector == #==) or:[selector == #~~]) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
109 |
recVal == 0 ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
110 |
arg1 codeOn:aStream inBlock:b for:aCompiler. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
111 |
(selector == #==) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
112 |
code := #eq0 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
113 |
] ifFalse:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
114 |
code := #ne0 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
115 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
116 |
aStream nextPut:code. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
117 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
118 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
119 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
120 |
]. |
1391 | 121 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
122 |
recVal == nil ifTrue:[ |
797
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
123 |
((selector == #==) or:[selector == #~~]) ifTrue:[ |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
124 |
arg1 codeOn:aStream inBlock:b for:aCompiler. |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
125 |
(selector == #==) ifTrue:[ |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
126 |
code := #isNil |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
127 |
] ifFalse:[ |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
128 |
code := #notNil |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
129 |
]. |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
130 |
aStream nextPut:code. |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
131 |
^ self |
dec188dd71d5
oops - nil + 5 generated wrong code.
Claus Gittinger <cg@exept.de>
parents:
596
diff
changeset
|
132 |
] |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
133 |
]. |
1391 | 134 |
|
1408
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
135 |
"/ disabled this, since it is confusing if the error is reported |
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
136 |
"/ by the argument as receiver (i.e. transforms 1+foo into foo+1) |
1409 | 137 |
"/ and it might also be incorrect. |
1408
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
138 |
"/ (selector == #+) ifTrue:[ |
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
139 |
"/ (recVal == 1) ifTrue:[ |
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
140 |
"/ arg1 codeOn:aStream inBlock:b for:aCompiler. |
1409 | 141 |
"/ aStream nextPut:#plus1; nextPut:lineNr. |
1408
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
142 |
"/ ^ self |
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
143 |
"/ ] |
3f8cf5defc64
disabled 1+foo -> foo+1 transformation
Claus Gittinger <cg@exept.de>
parents:
1391
diff
changeset
|
144 |
"/ ] |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
145 |
]. |
76 | 146 |
|
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
147 |
receiver codeOn:aStream inBlock:b for:aCompiler. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
148 |
arg1 isConstant ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
149 |
argVal := arg1 value. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
150 |
(arg1 type == #Integer) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
151 |
((selector == #==) or:[selector == #~~]) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
152 |
(argVal == 0) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
153 |
(selector == #==) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
154 |
code := #eq0 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
155 |
] ifFalse:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
156 |
code := #ne0 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
157 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
158 |
aStream nextPut:code. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
159 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
160 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
161 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
162 |
selector == #> ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
163 |
argVal == 0 ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
164 |
aStream nextPut:#gt0; nextPut:lineNr. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
165 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
166 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
167 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
168 |
((selector == #+) or:[selector == #-]) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
169 |
(argVal == 1) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
170 |
(selector == #+) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
171 |
code := #plus1 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
172 |
] ifFalse:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
173 |
code := #minus1 |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
174 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
175 |
aStream nextPut:code; nextPut:lineNr. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
176 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
177 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
178 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
179 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
180 |
argVal isNil ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
181 |
(selector == #==) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
182 |
aStream nextPut:#isNil. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
183 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
184 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
185 |
(selector == #~~) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
186 |
aStream nextPut:#notNil. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
187 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
188 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
189 |
] |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
190 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
191 |
arg1 codeOn:aStream inBlock:b for:aCompiler. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
192 |
aStream nextPut:selector. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
193 |
(aCompiler hasLineNumber:selector) ifTrue:[ |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
194 |
aStream nextPut:lineNr. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
195 |
]. |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
196 |
^ self |
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
197 |
] |
0 | 198 |
]. |
104 | 199 |
^ super codeOn:aStream inBlock:b for:aCompiler |
253
759ba0ddb672
oops - must check for receiver when attempting built-in basicNew
Claus Gittinger <cg@exept.de>
parents:
199
diff
changeset
|
200 |
|
885 | 201 |
"Modified: / 4.7.1999 / 19:05:13 / cg" |
0 | 202 |
! ! |
203 |
||
1035 | 204 |
!BinaryNode methodsFor:'evaluation'! |
140 | 205 |
|
1384 | 206 |
evaluateIn:anEnvironment |
1500
3c4cb012b24b
Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents:
1409
diff
changeset
|
207 |
|
3c4cb012b24b
Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents:
1409
diff
changeset
|
208 |
selector := selector asSymbol. |
3c4cb012b24b
Lazy conversion of selector strings to symbols.
Stefan Vogel <sv@exept.de>
parents:
1409
diff
changeset
|
209 |
|
140 | 210 |
receiver isSuper ifTrue:[ |
1384 | 211 |
^ super evaluateIn:anEnvironment |
140 | 212 |
]. |
1384 | 213 |
^ (receiver evaluateIn:anEnvironment) |
214 |
perform:selector |
|
215 |
with:((argArray at:1) evaluateIn:anEnvironment) |
|
140 | 216 |
! ! |
217 |
||
1079 | 218 |
!BinaryNode methodsFor:'printing & storing'! |
0 | 219 |
|
1589 | 220 |
printOn:aStream indent:i |
221 |
|arg| |
|
0 | 222 |
|
1589 | 223 |
receiver printOn:aStream indent:i parenthized:(receiver precedence < self precedence). |
0 | 224 |
aStream space. |
1388 | 225 |
self printSelectorOn:aStream. |
0 | 226 |
aStream space. |
1589 | 227 |
arg := self arg. |
228 |
arg printOn:aStream indent:i + 4 parenthized:(arg precedence <= self precedence). |
|
0 | 229 |
|
1589 | 230 |
"Modified: / 20-04-2005 / 14:31:43 / cg" |
1388 | 231 |
! |
232 |
||
233 |
printSelectorOn:aStream |
|
234 |
selector printString printOn:aStream. |
|
0 | 235 |
! ! |
140 | 236 |
|
237 |
!BinaryNode methodsFor:'queries'! |
|
238 |
||
239 |
isBinaryMessage |
|
240 |
^ true |
|
1589 | 241 |
! |
242 |
||
243 |
precedence |
|
244 |
^ 50 |
|
245 |
||
246 |
"Created: / 20-04-2005 / 14:10:44 / cg" |
|
140 | 247 |
! ! |
248 |
||
148 | 249 |
!BinaryNode class methodsFor:'documentation'! |
250 |
||
251 |
version |
|
2097 | 252 |
^ '$Header: /cvs/stx/stx/libcomp/BinaryNode.st,v 1.43 2008-05-26 08:35:35 cg Exp $' |
148 | 253 |
! ! |