author | Claus Gittinger <cg@exept.de> |
Fri, 21 Feb 2020 20:48:14 +0100 | |
changeset 1231 | b7d945ef967a |
parent 1019 | 28f53f2bfb35 |
permissions | -rw-r--r-- |
299 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
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 |
" |
|
87 | 12 |
"{ Package: 'stx:libjavascript' }" |
13 |
||
1019 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
386 | 16 |
AbstractSourceFileWriter subclass:#JavaScriptSourceFileWriter |
87 | 17 |
instanceVariableNames:'classBeingSaved' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Languages-JavaScript-Framework' |
|
21 |
! |
|
22 |
||
299 | 23 |
!JavaScriptSourceFileWriter class methodsFor:'documentation'! |
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
87 | 38 |
|
539 | 39 |
!JavaScriptSourceFileWriter class methodsFor:'utilities - source code'! |
40 |
||
41 |
methodTemplate |
|
42 |
|s| |
|
43 |
||
44 |
s := TextStream on:''. |
|
45 |
||
46 |
s emphasis:(UserPreferences current commentEmphasisAndColor). |
|
47 |
s nextPutAll: |
|
48 |
'// |
|
49 |
// comment stating purpose of this method |
|
50 |
//'. |
|
51 |
s emphasis:nil. |
|
52 |
s nextPutAll: |
|
53 |
' |
|
54 |
function name ( arg1 , ... ) |
|
55 |
{ |
|
56 |
var temp1, ... ; |
|
57 |
||
58 |
statement; |
|
59 |
statement; |
|
60 |
} |
|
61 |
'. |
|
62 |
||
63 |
s cr. |
|
64 |
s emphasis:(UserPreferences current commentEmphasisAndColor). |
|
65 |
s nextPutAll: |
|
66 |
'// change the above template into real code; |
|
67 |
// remove this comment. |
|
68 |
// Then `accept'' either via the menu |
|
69 |
// or via the keyboard (usually CMD-A). |
|
70 |
||
71 |
// You do not need this template; you can also |
|
72 |
// select any existing methods code, change it, |
|
73 |
// and finally `accept''. The method will then be |
|
74 |
// installed under the selector as defined in the |
|
75 |
// actual text - no matter which method is selected |
|
76 |
// in the browser, or where the original text came from. |
|
77 |
||
78 |
// Or clear this text, type in the method from scratch |
|
79 |
// and install it with `accept''. |
|
80 |
'. |
|
81 |
||
82 |
^ s contents |
|
83 |
! |
|
84 |
||
85 |
versionMethodTemplateForCVS |
|
86 |
"careful to avoid expansion by cvs here!!" |
|
87 |
||
88 |
^ ('function version() {\ return ("$' , 'Header$");\}') withCRs |
|
89 |
||
90 |
"Created: / 21-08-2012 / 11:52:59 / cg" |
|
91 |
! ! |
|
92 |
||
87 | 93 |
!JavaScriptSourceFileWriter methodsFor:'fileout'! |
94 |
||
95 |
fileOut:aClass on:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil |
|
96 |
"file out my definition and all methods onto aStream. |
|
97 |
If stampIt is true, a timeStamp comment is prepended. |
|
98 |
If initIt is true, and the class implements a class-initialize method, |
|
99 |
append a corresponding doIt expression for initialization. |
|
100 |
The order by which the fileOut is done is used to put the version string at the end. |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
101 |
Thus, if the version string is expanded (by CVS), the characterPositions of methods should not move. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
102 |
todo: code duplication with SmalltalkChunkSourceFileWriter - please refactor" |
87 | 103 |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
104 |
|meta nonMeta outStream copyrightMethod copyrightText comment collectionOfCategories |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
105 |
versionMethods extensionVersionMethods classesImplementingInitialize |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
106 |
allMetaClassSelectors versionSelectors extensionVersionSelectors |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
107 |
allVersionMethods| |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
108 |
|
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
109 |
self todo:'code duplication with SmalltalkChunkSourceFileWriter - please refactor'. |
87 | 110 |
|
111 |
nonMeta := aClass theNonMetaclass. |
|
112 |
meta := nonMeta class. |
|
113 |
||
114 |
encoderOrNil isNil ifTrue:[ |
|
115 |
outStream := outStreamArg. |
|
116 |
] ifFalse:[ |
|
117 |
outStream := EncodedStream stream:outStreamArg encoder:encoderOrNil. |
|
118 |
outStream nextPutAll:'// Encoding: ' , encoderOrNil nameOfEncoding; cr; cr. |
|
119 |
]. |
|
120 |
||
121 |
(copyrightMethod := meta compiledMethodAt:#copyright) notNil ifTrue:[ |
|
122 |
" |
|
123 |
get the copyright methods source, |
|
124 |
and insert at beginning. |
|
125 |
" |
|
126 |
copyrightText := copyrightMethod source. |
|
127 |
copyrightText isNil ifTrue:[ |
|
128 |
" |
|
129 |
no source available - trigger an error |
|
130 |
" |
|
131 |
ClassDescription fileOutErrorSignal |
|
132 |
raiseRequestWith:nonMeta |
|
133 |
errorString:('no source for class ' , nonMeta name , ' available. Cannot fileOut'). |
|
134 |
^ self |
|
135 |
]. |
|
136 |
" |
|
137 |
strip off the selector-line |
|
138 |
" |
|
139 |
copyrightText := copyrightText asCollectionOfLines asStringCollection. |
|
140 |
copyrightText := copyrightText copyFrom:2 to:(copyrightText size). |
|
141 |
copyrightText := copyrightText asString. |
|
142 |
outStream nextPutAll:copyrightText. |
|
143 |
outStream cr. |
|
144 |
]. |
|
145 |
||
146 |
stampIt ifTrue:[ |
|
147 |
"/ |
|
148 |
"/ first, a timestamp |
|
149 |
"/ |
|
150 |
outStream nextPutAll:'// '. |
|
151 |
outStream nextPutAll:(Smalltalk timeStamp). |
|
152 |
outStream cr; cr. |
|
153 |
]. |
|
154 |
||
155 |
withDefinition ifTrue:[ |
|
156 |
"/ |
|
157 |
"/ then the definition(s) |
|
158 |
"/ |
|
159 |
self fileOutAllDefinitionsOf:nonMeta on:outStream. |
|
160 |
"/ |
|
161 |
"/ a comment - if any |
|
162 |
"/ |
|
163 |
(comment := nonMeta comment) notNil ifTrue:[ |
|
164 |
outStream nextPutLine:'// '. |
|
165 |
comment asCollectionOfLines do:[:eachLine | |
|
166 |
outStream nextPutAll:'// '. |
|
167 |
outStream nextPutLine:eachLine. |
|
168 |
]. |
|
169 |
outStream nextPutLine:'// '. |
|
170 |
]. |
|
171 |
]. |
|
172 |
||
173 |
"/ |
|
174 |
"/ methods from all categories in metaclass (i.e. class methods) |
|
175 |
"/ EXCEPT: the version method is placed at the very end, to |
|
176 |
"/ avoid sourcePosition-shifts when checked out later. |
|
177 |
"/ (RCS expands this string, so its size is not constant) |
|
178 |
"/ |
|
179 |
collectionOfCategories := meta categories asSortedCollection. |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
180 |
|
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
181 |
allMetaClassSelectors := meta methodDictionary keys. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
182 |
versionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isVersionMethodSelector:selector ]. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
183 |
versionMethods := versionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector]. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
184 |
extensionVersionSelectors := allMetaClassSelectors select:[:selector | AbstractSourceCodeManager isExtensionsVersionMethodSelector:selector ]. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
185 |
extensionVersionMethods := extensionVersionSelectors collect:[:eachSelector | meta methodDictionary at:eachSelector]. |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
186 |
allVersionMethods := Set new addAll:versionMethods; addAll:extensionVersionMethods; yourself. |
364
da9109cd3bbd
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
363
diff
changeset
|
187 |
|
87 | 188 |
collectionOfCategories notNil ifTrue:[ |
189 |
"/ |
|
190 |
"/ documentation first (if any), but not the version method |
|
191 |
"/ |
|
192 |
(collectionOfCategories includes:'documentation') ifTrue:[ |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
193 |
self fileOutCategory:'documentation' of:meta except:allVersionMethods only:nil methodFilter:methodFilter on:outStream. |
87 | 194 |
]. |
195 |
||
196 |
"/ |
|
197 |
"/ initialization next (if any) |
|
198 |
"/ |
|
199 |
(collectionOfCategories includes:'initialization') ifTrue:[ |
|
200 |
self fileOutCategory:'initialization' of:meta methodFilter:methodFilter on:outStream. |
|
201 |
]. |
|
202 |
||
203 |
"/ |
|
204 |
"/ instance creation next (if any) |
|
205 |
"/ |
|
206 |
(collectionOfCategories includes:'instance creation') ifTrue:[ |
|
207 |
self fileOutCategory:'instance creation' of:meta methodFilter:methodFilter on:outStream. |
|
208 |
]. |
|
209 |
collectionOfCategories do:[:aCategory | |
|
210 |
((aCategory ~= 'documentation') |
|
211 |
and:[(aCategory ~= 'initialization') |
|
212 |
and:[aCategory ~= 'instance creation']]) ifTrue:[ |
|
213 |
self fileOutCategory:aCategory of:meta methodFilter:methodFilter on:outStream. |
|
214 |
] |
|
215 |
] |
|
216 |
]. |
|
217 |
||
218 |
"/ |
|
219 |
"/ methods from all categories |
|
220 |
"/ |
|
221 |
collectionOfCategories := nonMeta categories asSortedCollection. |
|
222 |
collectionOfCategories notNil ifTrue:[ |
|
223 |
collectionOfCategories do:[:aCategory | |
|
224 |
self fileOutCategory:aCategory of:nonMeta methodFilter:methodFilter on:outStream. |
|
225 |
] |
|
226 |
]. |
|
227 |
||
228 |
"/ |
|
229 |
"/ any private classes' methods |
|
230 |
"/ |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
231 |
nonMeta privateClassesSorted do:[:eachPrivateClass | |
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
232 |
self fileOutAllMethodsOf:eachPrivateClass on:outStream methodFilter:methodFilter |
87 | 233 |
]. |
234 |
||
235 |
||
236 |
"/ |
|
842
20c8e856c588
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
805
diff
changeset
|
237 |
"/ finally, the previously skipped version method (but not the extensionsVersion methods!!) |
87 | 238 |
"/ |
363
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
239 |
versionMethods notEmpty ifTrue:[ |
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
240 |
self fileOutCategory:'documentation' of:meta except:nil only:versionMethods methodFilter:methodFilter on:outStream. |
87 | 241 |
]. |
242 |
||
243 |
initIt ifTrue:[ |
|
244 |
"/ |
|
245 |
"/ optionally an initialize message |
|
246 |
"/ |
|
247 |
classesImplementingInitialize := OrderedCollection new. |
|
248 |
||
249 |
(meta includesSelector:#initialize) ifTrue:[ |
|
250 |
classesImplementingInitialize add:nonMeta |
|
251 |
]. |
|
252 |
nonMeta privateClassesSorted do:[:aPrivateClass | |
|
253 |
(aPrivateClass theMetaclass includesSelector:#initialize) ifTrue:[ |
|
254 |
classesImplementingInitialize add:aPrivateClass |
|
255 |
] |
|
256 |
]. |
|
257 |
classesImplementingInitialize size ~~ 0 ifTrue:[ |
|
258 |
classesImplementingInitialize topologicalSort:[:a :b | b isSubclassOf:a]. |
|
259 |
classesImplementingInitialize do:[:eachClass | |
|
260 |
outStream nextPutLine:'// #initialize: '. |
|
805
eed9632a1922
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
261 |
outStream nextPutAll:'// '. eachClass printClassNameOn:outStream. |
eed9632a1922
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
739
diff
changeset
|
262 |
outStream nextPutLine:'.initialize()'. |
87 | 263 |
]. |
264 |
]. |
|
265 |
] |
|
266 |
! |
|
267 |
||
268 |
fileOutAllDefinitionsOf:aClass on:aStream |
|
269 |
"append expressions on aStream, which defines myself and all of my private classes." |
|
270 |
||
271 |
aClass fileOutDefinitionOn:aStream. |
|
272 |
aStream cr; cr. |
|
273 |
||
274 |
"/ |
|
275 |
"/ optional classInstanceVariables |
|
276 |
"/ |
|
277 |
aClass class instanceVariableString isBlank ifFalse:[ |
|
457
446b2cbb3994
changed: #fileOutAllDefinitionsOf:on:
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
278 |
self breakPoint:#expecco. |
87 | 279 |
aClass fileOutClassInstVarDefinitionOn:aStream. |
280 |
aStream cr; cr |
|
281 |
]. |
|
282 |
||
283 |
"/ here, the full nameSpace prefixes are output, |
|
284 |
"/ to avoid confusing stc |
|
285 |
"/ (which otherwise could not find the correct superclass) |
|
286 |
"/ |
|
287 |
Class fileOutNameSpaceQuerySignal answer:false do:[ |
|
288 |
Class forceNoNameSpaceQuerySignal answer:true do:[ |
|
289 |
aClass privateClassesSorted do:[:aClass | |
|
290 |
aClass class fileOutAllDefinitionsOn:aStream |
|
291 |
] |
|
292 |
] |
|
293 |
]. |
|
294 |
||
457
446b2cbb3994
changed: #fileOutAllDefinitionsOf:on:
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
295 |
"Created: / 15-10-1996 / 11:15:19 / cg" |
446b2cbb3994
changed: #fileOutAllDefinitionsOf:on:
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
296 |
"Modified: / 19-05-2010 / 16:04:52 / cg" |
87 | 297 |
! |
298 |
||
299 |
fileOutCategory:aCategory of:aClass except:skippedMethods only:savedMethods methodFilter:methodFilter on:aStream |
|
300 |
"file out all methods belonging to aCategory, aString onto aStream. |
|
301 |
If skippedMethods is nonNil, those are not saved. |
|
302 |
If savedMethods is nonNil, only those are saved. |
|
303 |
If both are nil, all are saved. See version-method handling in |
|
304 |
fileOut for what this is needed." |
|
305 |
||
343 | 306 |
|source sortedSelectors first privacy interestingMethods| |
87 | 307 |
|
343 | 308 |
interestingMethods := OrderedCollection new. |
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
309 |
interestingMethods := aClass methodsInCategory:aCategory forWhich:methodFilter. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
310 |
interestingMethods := interestingMethods |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
311 |
select:[:method | |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
312 |
|wanted| |
87 | 313 |
|
343 | 314 |
skippedMethods notNil ifTrue:[ |
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
315 |
wanted := (skippedMethods includesIdentical:method) not |
343 | 316 |
] ifFalse:[ |
317 |
savedMethods notNil ifTrue:[ |
|
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
318 |
wanted := (savedMethods includesIdentical:method). |
87 | 319 |
] ifFalse:[ |
343 | 320 |
wanted := true |
321 |
] |
|
322 |
]. |
|
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
323 |
wanted |
739
9087311b0d1d
class: JavaScriptSourceFileWriter
Stefan Vogel <sv@exept.de>
parents:
564
diff
changeset
|
324 |
] as:OrderedCollection. |
343 | 325 |
|
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
326 |
interestingMethods isEmpty ifTrue:[ ^ self ]. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
327 |
first := true. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
328 |
privacy := nil. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
329 |
|
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
330 |
"/ |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
331 |
"/ sort by selector |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
332 |
"/ |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
333 |
sortedSelectors := interestingMethods collect:[:m | aClass selectorAtMethod:m]. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
334 |
sortedSelectors sortWith:interestingMethods. |
343 | 335 |
|
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
336 |
interestingMethods do:[:aMethod | |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
337 |
aStream nextPutLine:'/** category: ', aCategory , ' **/'. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
338 |
aStream cr. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
339 |
source := aMethod source. |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
340 |
source isNil ifTrue:[ |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
341 |
Class fileOutErrorSignal |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
342 |
raiseRequestWith:aClass |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
343 |
errorString:' - no source for method: ', (aMethod displayString) |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
344 |
] ifFalse:[ |
1019 | 345 |
aClass isMetaclass ifTrue:[ |
346 |
"/ should the method know it??? |
|
347 |
(source startsWith:'static ') ifFalse:[ |
|
348 |
aStream nextPutAll:'static '. |
|
349 |
]. |
|
350 |
]. |
|
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
351 |
aStream nextPutAll:source. |
87 | 352 |
]. |
344
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
353 |
aStream cr |
572f0890480b
changed #fileOutCategory:of:except:only:methodFilter:on:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
354 |
]. |
564
6cd6b76c7327
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
355 |
aStream cr |
87 | 356 |
|
1019 | 357 |
"Modified: / 28-08-1995 / 14:30:41 / claus" |
358 |
"Modified: / 12-06-1996 / 11:37:33 / stefan" |
|
359 |
"Modified: / 15-11-1996 / 11:32:21 / cg" |
|
360 |
"Created: / 01-04-1997 / 16:04:33 / stefan" |
|
361 |
"Modified: / 28-08-2018 / 12:05:43 / Claus Gittinger" |
|
87 | 362 |
! ! |
363 |
||
364 |
!JavaScriptSourceFileWriter methodsFor:'source writing'! |
|
365 |
||
366 |
fileOutAllMethodsOf:aClass on:aStream methodFilter:methodFilter |
|
367 |
|collectionOfCategories| |
|
368 |
||
369 |
collectionOfCategories := aClass class categories asSortedCollection. |
|
370 |
collectionOfCategories notNil ifTrue:[ |
|
371 |
collectionOfCategories do:[:aCategory | |
|
372 |
self fileOutCategory:aCategory of:aClass class methodFilter:methodFilter on:aStream. |
|
373 |
] |
|
374 |
]. |
|
375 |
collectionOfCategories := aClass categories asSortedCollection. |
|
376 |
collectionOfCategories notNil ifTrue:[ |
|
377 |
collectionOfCategories do:[:aCategory | |
|
378 |
self fileOutCategory:aCategory of:aClass methodFilter:methodFilter on:aStream. |
|
379 |
] |
|
380 |
]. |
|
381 |
||
382 |
aClass privateClassesSorted do:[:aClass | |
|
383 |
self fileOutAllMethodsOf:aClass on:aStream methodFilter:methodFilter |
|
384 |
]. |
|
385 |
||
386 |
"Created: 15.10.1996 / 11:13:00 / cg" |
|
387 |
"Modified: 22.3.1997 / 16:12:17 / cg" |
|
388 |
! |
|
389 |
||
390 |
fileOutCategory:aCategory of:aClass methodFilter:methodFilter on:aStream |
|
391 |
"file out all methods belonging to aCategory, aString onto aStream" |
|
392 |
||
393 |
self fileOutCategory:aCategory of:aClass except:nil only:nil methodFilter:methodFilter on:aStream |
|
394 |
||
395 |
"Created: 1.4.1997 / 16:04:44 / stefan" |
|
385 | 396 |
! |
397 |
||
398 |
fileOutCommentEndOn:aStream |
|
399 |
"Writes a comment end mark on aStream." |
|
400 |
||
401 |
"/ intentionally left blank - make each line an EOL-comment instead |
|
402 |
! |
|
403 |
||
404 |
fileOutCommentLine:aString on:aStream |
|
405 |
"Writes a single line of comment on a comment to a stream." |
|
406 |
||
407 |
aStream |
|
408 |
nextPutAll:'// '; |
|
409 |
nextPutAll: aString |
|
410 |
! |
|
411 |
||
412 |
fileOutCommentStartOn:aStream |
|
413 |
"Writes a comment start mark on aStream." |
|
414 |
||
415 |
"/ intentionally left blank - make each line an EOL-comment instead |
|
87 | 416 |
! ! |
417 |
||
418 |
!JavaScriptSourceFileWriter class methodsFor:'documentation'! |
|
419 |
||
420 |
version |
|
421 |
^ '$Header$' |
|
363
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
422 |
! |
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
423 |
|
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
424 |
version_CVS |
1c7c6ed4a31a
changed: #fileOut:on:withTimeStamp:withInitialize:withDefinition:methodFilter:encoder:
fm
parents:
344
diff
changeset
|
425 |
^ '$Header$' |
87 | 426 |
! ! |
564
6cd6b76c7327
class: JavaScriptSourceFileWriter
Claus Gittinger <cg@exept.de>
parents:
539
diff
changeset
|
427 |