98
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
|
12 |
|
1208
|
13 |
"{ Package: 'stx:libcomp' }"
|
|
14 |
|
1106
|
15 |
ParseNode subclass:#MethodNode
|
1208
|
16 |
instanceVariableNames:'selector arguments locals statements'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'System-Compiler ST-80-compatibility'
|
98
|
20 |
!
|
|
21 |
|
1106
|
22 |
!MethodNode class methodsFor:'documentation'!
|
98
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
|
38 |
documentation
|
|
39 |
"
|
|
40 |
This is a pure mimicri class.
|
|
41 |
It is not used by ST/X, but provided to support limited
|
|
42 |
compatibility for applications which build up codetrees,
|
|
43 |
knowing internals of ST-80's compiler class hierarchy.
|
|
44 |
This classes protocol is not (not meant to be) fully covering
|
|
45 |
the corresponding ST-80's classes protocol. It maps ST-80 messages
|
|
46 |
to corresponding ST/X messages (as far as possible).
|
|
47 |
|
|
48 |
NO WARRANTY and GUARANTEE; this class may be removed without notice.
|
|
49 |
"
|
|
50 |
! !
|
|
51 |
|
1106
|
52 |
!MethodNode methodsFor:'accessing'!
|
|
53 |
|
1788
|
54 |
arguments
|
|
55 |
^ arguments
|
|
56 |
!
|
|
57 |
|
|
58 |
arguments:something
|
|
59 |
arguments := something.
|
|
60 |
!
|
|
61 |
|
|
62 |
arguments:argVars locals:localVars statements:stats
|
|
63 |
arguments := argVars.
|
|
64 |
locals := localVars.
|
|
65 |
statements := stats.
|
|
66 |
|
|
67 |
"Created: / 06-08-2006 / 03:04:18 / cg"
|
|
68 |
!
|
|
69 |
|
|
70 |
locals
|
|
71 |
^ locals
|
|
72 |
!
|
|
73 |
|
1208
|
74 |
selector
|
|
75 |
^ selector
|
|
76 |
!
|
|
77 |
|
1788
|
78 |
selector:sel
|
|
79 |
selector := sel.
|
|
80 |
|
|
81 |
"Created: / 06-08-2006 / 01:17:42 / cg"
|
|
82 |
!
|
|
83 |
|
1106
|
84 |
selector:sel arguments:argVars locals:localVars statements:stats
|
|
85 |
selector := sel.
|
|
86 |
arguments := argVars.
|
|
87 |
locals := localVars.
|
|
88 |
statements := stats.
|
|
89 |
!
|
98
|
90 |
|
1208
|
91 |
statementCollection
|
|
92 |
"returns an orderedColl for my linked statement list"
|
|
93 |
|
|
94 |
|coll stat|
|
|
95 |
|
|
96 |
coll := OrderedCollection new.
|
|
97 |
stat := statements.
|
|
98 |
[stat notNil] whileTrue:[
|
|
99 |
coll add:stat.
|
|
100 |
stat := stat nextStatement.
|
|
101 |
].
|
|
102 |
^ coll
|
|
103 |
!
|
|
104 |
|
|
105 |
statements
|
|
106 |
^ statements
|
1788
|
107 |
!
|
|
108 |
|
|
109 |
statements:something
|
|
110 |
statements := something.
|
98
|
111 |
! !
|
|
112 |
|
1106
|
113 |
!MethodNode methodsFor:'code generation'!
|
98
|
114 |
|
1788
|
115 |
codeForSideEffectOn:aStream inBlock:b for:aCompiler
|
|
116 |
statements do:[:stat |
|
|
117 |
stat isSequenceable ifTrue:[
|
|
118 |
stat do:[:eachSubStat |
|
|
119 |
eachSubStat codeForSideEffectOn:aStream inBlock:nil for:aCompiler
|
|
120 |
]
|
|
121 |
] ifFalse:[
|
|
122 |
stat codeForSideEffectOn:aStream inBlock:nil for:aCompiler
|
|
123 |
].
|
|
124 |
].
|
|
125 |
|
|
126 |
"Created: / 06-08-2006 / 03:29:54 / cg"
|
|
127 |
"Modified: / 06-08-2006 / 23:19:01 / cg"
|
|
128 |
!
|
|
129 |
|
106
|
130 |
emitEffect:aStream
|
98
|
131 |
statements do:[:stat |
|
106
|
132 |
stat codeForSideEffectOn:aStream inBlock:nil for:nil
|
98
|
133 |
].
|
|
134 |
! !
|
|
135 |
|
1106
|
136 |
!MethodNode methodsFor:'printing'!
|
98
|
137 |
|
|
138 |
printOn:aStream indent:i
|
|
139 |
|n parts|
|
|
140 |
|
1788
|
141 |
selector isNil ifTrue:[
|
|
142 |
self basicPrintOn:aStream.
|
|
143 |
^ self.
|
|
144 |
].
|
|
145 |
|
98
|
146 |
n := selector numArgs.
|
|
147 |
n == 0 ifTrue:[
|
1788
|
148 |
aStream nextPutAll:selector printString.
|
98
|
149 |
] ifFalse:[
|
1788
|
150 |
parts := selector partsIfSelector.
|
|
151 |
parts with:arguments do:[:part :arg |
|
|
152 |
aStream nextPutAll:part.
|
|
153 |
aStream nextPutAll:arg name.
|
|
154 |
aStream space.
|
|
155 |
]
|
98
|
156 |
].
|
|
157 |
aStream cr.
|
|
158 |
|
1788
|
159 |
statements notNil ifTrue:[
|
|
160 |
statements do:[:stat |
|
|
161 |
aStream spaces:i+4.
|
|
162 |
stat printOn:aStream indent:i+4.
|
|
163 |
aStream nextPut:$..
|
|
164 |
aStream cr.
|
|
165 |
].
|
1106
|
166 |
].
|
1788
|
167 |
|
|
168 |
"Modified: / 06-08-2006 / 15:12:15 / cg"
|
98
|
169 |
! !
|
1208
|
170 |
|
|
171 |
!MethodNode class methodsFor:'documentation'!
|
|
172 |
|
|
173 |
version
|
1788
|
174 |
^ '$Header: /cvs/stx/stx/libcomp/MethodNode.st,v 1.11 2006-08-07 11:00:15 cg Exp $'
|
1208
|
175 |
! !
|