resin 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +2 -0
- data/amber/bin/nodecompile.js +3 -3
- data/amber/css/amber.css +47 -23
- data/amber/images/off.amber.png +0 -0
- data/amber/images/offHover.amber.png +0 -0
- data/amber/images/sprite.amber.png +0 -0
- data/amber/images/tinylogo.amber.png +0 -0
- data/amber/js/Benchfib.deploy.js +34 -34
- data/amber/js/Benchfib.js +49 -49
- data/amber/js/Canvas.deploy.js +937 -937
- data/amber/js/Canvas.js +1622 -1622
- data/amber/js/Compiler-Tests.deploy.js +97 -0
- data/amber/js/Compiler-Tests.js +137 -0
- data/amber/js/Compiler.deploy.js +1030 -924
- data/amber/js/Compiler.js +1613 -1467
- data/amber/js/Documentation.deploy.js +417 -417
- data/amber/js/Documentation.js +728 -728
- data/amber/js/Examples.deploy.js +24 -13
- data/amber/js/Examples.js +36 -19
- data/amber/js/IDE.deploy.js +1583 -1527
- data/amber/js/IDE.js +2586 -2510
- data/amber/js/Kernel-Announcements.deploy.js +19 -19
- data/amber/js/Kernel-Announcements.js +28 -28
- data/amber/js/Kernel-Classes.deploy.js +332 -229
- data/amber/js/Kernel-Classes.js +532 -384
- data/amber/js/Kernel-Collections.deploy.js +1516 -1712
- data/amber/js/Kernel-Collections.js +2436 -2712
- data/amber/js/Kernel-Exceptions.deploy.js +85 -62
- data/amber/js/Kernel-Exceptions.js +131 -98
- data/amber/js/Kernel-Methods.deploy.js +326 -378
- data/amber/js/Kernel-Methods.js +473 -525
- data/amber/js/Kernel-Objects.deploy.js +1777 -2428
- data/amber/js/Kernel-Objects.js +2599 -3426
- data/amber/js/Kernel-Tests.deploy.js +871 -772
- data/amber/js/Kernel-Tests.js +1207 -1083
- data/amber/js/Kernel-Transcript.deploy.js +57 -57
- data/amber/js/Kernel-Transcript.js +94 -94
- data/amber/js/SUnit.deploy.js +116 -116
- data/amber/js/SUnit.js +211 -211
- data/amber/js/amber.js +10 -11
- data/amber/js/boot.js +132 -156
- data/amber/js/init.js +2 -2
- data/amber/js/parser.js +2095 -3014
- data/amber/js/parser.pegjs +1 -1
- data/amber/st/Benchfib.st +22 -22
- data/amber/st/Canvas.st +471 -471
- data/amber/st/Compiler-Tests.st +471 -0
- data/amber/st/Compiler.st +858 -794
- data/amber/st/Examples.st +22 -5
- data/amber/st/IDE.st +1326 -1291
- data/amber/st/Kernel-Announcements.st +2 -2
- data/amber/st/Kernel-Classes.st +148 -90
- data/amber/st/Kernel-Collections.st +950 -1061
- data/amber/st/Kernel-Exceptions.st +33 -25
- data/amber/st/Kernel-Methods.st +151 -151
- data/amber/st/Kernel-Objects.st +891 -1036
- data/amber/st/Kernel-Tests.st +622 -544
- data/amber/st/Kernel-Transcript.st +38 -38
- data/amber/st/SUnit.st +53 -53
- metadata +27 -20
data/amber/js/Kernel-Classes.js
CHANGED
@@ -1,294 +1,327 @@
|
|
1
1
|
smalltalk.addPackage('Kernel-Classes', {});
|
2
2
|
smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
|
3
|
-
smalltalk.Behavior.comment=
|
3
|
+
smalltalk.Behavior.comment="Behavior is the superclass of all class objects. \x0a\x0aIt defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0aInstances know about the subclass/superclass relationships between classes, contain the description that instances are created from, \x0aand hold the method dictionary that's associated with each class.\x0a\x0aBehavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy."
|
4
4
|
smalltalk.addMethod(
|
5
|
-
|
5
|
+
"_addCompiledMethod_",
|
6
6
|
smalltalk.method({
|
7
|
-
selector:
|
8
|
-
category: '
|
9
|
-
fn: function (){
|
7
|
+
selector: "addCompiledMethod:",
|
8
|
+
category: 'compiling',
|
9
|
+
fn: function (aMethod){
|
10
10
|
var self=this;
|
11
|
-
|
11
|
+
smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
|
12
12
|
return self;},
|
13
|
-
args: [],
|
14
|
-
source:
|
15
|
-
messageSends: [
|
13
|
+
args: ["aMethod"],
|
14
|
+
source: "addCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>",
|
15
|
+
messageSends: [],
|
16
16
|
referencedClasses: []
|
17
17
|
}),
|
18
18
|
smalltalk.Behavior);
|
19
19
|
|
20
20
|
smalltalk.addMethod(
|
21
|
-
|
21
|
+
"_allInstanceVariableNames",
|
22
22
|
smalltalk.method({
|
23
|
-
selector:
|
24
|
-
category: '
|
23
|
+
selector: "allInstanceVariableNames",
|
24
|
+
category: 'accessing',
|
25
25
|
fn: function (){
|
26
26
|
var self=this;
|
27
|
-
|
27
|
+
var result=nil;
|
28
|
+
(result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []));
|
29
|
+
(($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})() : nil;
|
30
|
+
return result;
|
28
31
|
return self;},
|
29
32
|
args: [],
|
30
|
-
source:
|
31
|
-
messageSends: [],
|
33
|
+
source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
|
34
|
+
messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
|
32
35
|
referencedClasses: []
|
33
36
|
}),
|
34
37
|
smalltalk.Behavior);
|
35
38
|
|
36
39
|
smalltalk.addMethod(
|
37
|
-
|
40
|
+
"_allSubclasses",
|
38
41
|
smalltalk.method({
|
39
|
-
selector:
|
42
|
+
selector: "allSubclasses",
|
40
43
|
category: 'accessing',
|
41
44
|
fn: function (){
|
42
45
|
var self=this;
|
43
|
-
|
46
|
+
var result=nil;
|
47
|
+
(result=smalltalk.send(self, "_subclasses", []));
|
48
|
+
smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
|
49
|
+
return result;
|
44
50
|
return self;},
|
45
51
|
args: [],
|
46
|
-
source:
|
47
|
-
messageSends: [],
|
52
|
+
source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
|
53
|
+
messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
|
48
54
|
referencedClasses: []
|
49
55
|
}),
|
50
56
|
smalltalk.Behavior);
|
51
57
|
|
52
58
|
smalltalk.addMethod(
|
53
|
-
|
59
|
+
"_basicNew",
|
54
60
|
smalltalk.method({
|
55
|
-
selector:
|
56
|
-
category: '
|
61
|
+
selector: "basicNew",
|
62
|
+
category: 'instance creation',
|
57
63
|
fn: function (){
|
58
64
|
var self=this;
|
59
|
-
return self.
|
65
|
+
return new self.fn();
|
60
66
|
return self;},
|
61
67
|
args: [],
|
62
|
-
source:
|
68
|
+
source: "basicNew\x0a\x09<return new self.fn()>",
|
63
69
|
messageSends: [],
|
64
70
|
referencedClasses: []
|
65
71
|
}),
|
66
72
|
smalltalk.Behavior);
|
67
73
|
|
68
74
|
smalltalk.addMethod(
|
69
|
-
|
75
|
+
"_canUnderstand_",
|
70
76
|
smalltalk.method({
|
71
|
-
selector:
|
72
|
-
category: '
|
73
|
-
fn: function (){
|
77
|
+
selector: "canUnderstand:",
|
78
|
+
category: 'testing',
|
79
|
+
fn: function (aSelector){
|
74
80
|
var self=this;
|
75
|
-
return smalltalk.
|
81
|
+
return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_keys", []), "_includes_", [smalltalk.send(aSelector, "_asString", [])]), "_or_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_superclass", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_superclass", []), "_canUnderstand_", [aSelector]);})]);})]);
|
76
82
|
return self;},
|
77
|
-
args: [],
|
78
|
-
source:
|
79
|
-
messageSends: [],
|
83
|
+
args: ["aSelector"],
|
84
|
+
source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
|
85
|
+
messageSends: ["or:", "includes:", "keys", "methodDictionary", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
|
80
86
|
referencedClasses: []
|
81
87
|
}),
|
82
88
|
smalltalk.Behavior);
|
83
89
|
|
84
90
|
smalltalk.addMethod(
|
85
|
-
|
91
|
+
"_comment",
|
86
92
|
smalltalk.method({
|
87
|
-
selector:
|
93
|
+
selector: "comment",
|
88
94
|
category: 'accessing',
|
89
95
|
fn: function (){
|
90
96
|
var self=this;
|
91
|
-
|
92
|
-
(result=smalltalk.send(self, "_subclasses", []));
|
93
|
-
smalltalk.send(smalltalk.send(self, "_subclasses", []), "_do_", [(function(each){return smalltalk.send(result, "_addAll_", [smalltalk.send(each, "_allSubclasses", [])]);})]);
|
94
|
-
return result;
|
97
|
+
return (($receiver = smalltalk.send(self, "_basicAt_", ["comment"])) == nil || $receiver == undefined) ? (function(){return "";})() : $receiver;
|
95
98
|
return self;},
|
96
99
|
args: [],
|
97
|
-
source:
|
98
|
-
messageSends: ["
|
100
|
+
source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
|
101
|
+
messageSends: ["ifNil:", "basicAt:"],
|
99
102
|
referencedClasses: []
|
100
103
|
}),
|
101
104
|
smalltalk.Behavior);
|
102
105
|
|
103
106
|
smalltalk.addMethod(
|
104
|
-
|
107
|
+
"_comment_",
|
105
108
|
smalltalk.method({
|
106
|
-
selector:
|
109
|
+
selector: "comment:",
|
107
110
|
category: 'accessing',
|
108
|
-
fn: function (){
|
111
|
+
fn: function (aString){
|
109
112
|
var self=this;
|
110
|
-
|
113
|
+
smalltalk.send(self, "_basicAt_put_", ["comment", aString]);
|
111
114
|
return self;},
|
112
|
-
args: [],
|
113
|
-
source:
|
114
|
-
messageSends: ["
|
115
|
-
referencedClasses: [
|
115
|
+
args: ["aString"],
|
116
|
+
source: "comment: aString\x0a self basicAt: 'comment' put: aString",
|
117
|
+
messageSends: ["basicAt:put:"],
|
118
|
+
referencedClasses: []
|
116
119
|
}),
|
117
120
|
smalltalk.Behavior);
|
118
121
|
|
119
122
|
smalltalk.addMethod(
|
120
|
-
|
123
|
+
"_commentStamp",
|
121
124
|
smalltalk.method({
|
122
|
-
selector:
|
125
|
+
selector: "commentStamp",
|
123
126
|
category: 'accessing',
|
124
127
|
fn: function (){
|
125
128
|
var self=this;
|
126
|
-
return self.
|
129
|
+
return (function($rec){smalltalk.send($rec, "_class_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCommentReader || ClassCommentReader), "_new", []));
|
127
130
|
return self;},
|
128
131
|
args: [],
|
129
|
-
source:
|
130
|
-
messageSends: [],
|
131
|
-
referencedClasses: []
|
132
|
+
source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
|
133
|
+
messageSends: ["class:", "yourself", "new"],
|
134
|
+
referencedClasses: ["ClassCommentReader"]
|
132
135
|
}),
|
133
136
|
smalltalk.Behavior);
|
134
137
|
|
135
138
|
smalltalk.addMethod(
|
136
|
-
|
139
|
+
"_commentStamp_prior_",
|
137
140
|
smalltalk.method({
|
138
|
-
selector:
|
141
|
+
selector: "commentStamp:prior:",
|
139
142
|
category: 'accessing',
|
140
|
-
fn: function (){
|
143
|
+
fn: function (aStamp, prior){
|
141
144
|
var self=this;
|
142
|
-
|
143
|
-
var methods = self.fn.prototype.methods;
|
144
|
-
for(var i in methods) {
|
145
|
-
if(methods[i].selector) {
|
146
|
-
dict._at_put_(methods[i].selector, methods[i]);
|
147
|
-
}
|
148
|
-
};
|
149
|
-
return dict;
|
145
|
+
return smalltalk.send(self, "_commentStamp", []);
|
150
146
|
return self;},
|
151
|
-
args: [],
|
152
|
-
source:
|
153
|
-
messageSends: [],
|
147
|
+
args: ["aStamp", "prior"],
|
148
|
+
source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
|
149
|
+
messageSends: ["commentStamp"],
|
154
150
|
referencedClasses: []
|
155
151
|
}),
|
156
152
|
smalltalk.Behavior);
|
157
153
|
|
158
154
|
smalltalk.addMethod(
|
159
|
-
|
155
|
+
"_compile_",
|
160
156
|
smalltalk.method({
|
161
|
-
selector:
|
162
|
-
category: '
|
157
|
+
selector: "compile:",
|
158
|
+
category: 'compiling',
|
163
159
|
fn: function (aString){
|
164
160
|
var self=this;
|
165
|
-
|
161
|
+
smalltalk.send(self, "_compile_category_", [aString, ""]);
|
166
162
|
return self;},
|
167
163
|
args: ["aString"],
|
168
|
-
source:
|
169
|
-
messageSends: ["
|
170
|
-
referencedClasses: [
|
164
|
+
source: "compile: aString\x0a\x09self compile: aString category: ''",
|
165
|
+
messageSends: ["compile:category:"],
|
166
|
+
referencedClasses: []
|
171
167
|
}),
|
172
168
|
smalltalk.Behavior);
|
173
169
|
|
174
170
|
smalltalk.addMethod(
|
175
|
-
|
171
|
+
"_compile_category_",
|
176
172
|
smalltalk.method({
|
177
|
-
selector:
|
173
|
+
selector: "compile:category:",
|
178
174
|
category: 'compiling',
|
179
|
-
fn: function (
|
175
|
+
fn: function (aString, anotherString){
|
180
176
|
var self=this;
|
181
|
-
smalltalk.
|
177
|
+
(function($rec){smalltalk.send($rec, "_install_forClass_category_", [aString, self, anotherString]);return smalltalk.send($rec, "_setupClass_", [self]);})(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []));
|
182
178
|
return self;},
|
183
|
-
args: ["
|
184
|
-
source:
|
185
|
-
messageSends: [],
|
179
|
+
args: ["aString", "anotherString"],
|
180
|
+
source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString forClass: self category: anotherString;\x0a\x09\x09setupClass: self",
|
181
|
+
messageSends: ["install:forClass:category:", "setupClass:", "new"],
|
182
|
+
referencedClasses: ["Compiler"]
|
183
|
+
}),
|
184
|
+
smalltalk.Behavior);
|
185
|
+
|
186
|
+
smalltalk.addMethod(
|
187
|
+
"_inheritsFrom_",
|
188
|
+
smalltalk.method({
|
189
|
+
selector: "inheritsFrom:",
|
190
|
+
category: 'testing',
|
191
|
+
fn: function (aClass){
|
192
|
+
var self=this;
|
193
|
+
return smalltalk.send(smalltalk.send(aClass, "_allSubclasses", []), "_includes_", [self]);
|
194
|
+
return self;},
|
195
|
+
args: ["aClass"],
|
196
|
+
source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
|
197
|
+
messageSends: ["includes:", "allSubclasses"],
|
186
198
|
referencedClasses: []
|
187
199
|
}),
|
188
200
|
smalltalk.Behavior);
|
189
201
|
|
190
202
|
smalltalk.addMethod(
|
191
|
-
|
203
|
+
"_instanceVariableNames",
|
192
204
|
smalltalk.method({
|
193
|
-
selector:
|
205
|
+
selector: "instanceVariableNames",
|
194
206
|
category: 'accessing',
|
195
207
|
fn: function (){
|
196
208
|
var self=this;
|
197
209
|
return self.iVarNames;
|
198
210
|
return self;},
|
199
211
|
args: [],
|
200
|
-
source:
|
212
|
+
source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
|
213
|
+
messageSends: [],
|
214
|
+
referencedClasses: []
|
215
|
+
}),
|
216
|
+
smalltalk.Behavior);
|
217
|
+
|
218
|
+
smalltalk.addMethod(
|
219
|
+
"_methodAt_",
|
220
|
+
smalltalk.method({
|
221
|
+
selector: "methodAt:",
|
222
|
+
category: 'accessing',
|
223
|
+
fn: function (aString){
|
224
|
+
var self=this;
|
225
|
+
return smalltalk.methods(self)[aString];
|
226
|
+
return self;},
|
227
|
+
args: ["aString"],
|
228
|
+
source: "methodAt: aString\x0a\x09<return smalltalk.methods(self)[aString]>",
|
201
229
|
messageSends: [],
|
202
230
|
referencedClasses: []
|
203
231
|
}),
|
204
232
|
smalltalk.Behavior);
|
205
233
|
|
206
234
|
smalltalk.addMethod(
|
207
|
-
|
235
|
+
"_methodDictionary",
|
208
236
|
smalltalk.method({
|
209
|
-
selector:
|
237
|
+
selector: "methodDictionary",
|
210
238
|
category: 'accessing',
|
211
239
|
fn: function (){
|
212
240
|
var self=this;
|
213
|
-
|
241
|
+
var dict = smalltalk.HashedCollection._new();
|
242
|
+
var methods = self.fn.prototype.methods;
|
243
|
+
for(var i in methods) {
|
244
|
+
if(methods[i].selector) {
|
245
|
+
dict._at_put_(methods[i].selector, methods[i]);
|
246
|
+
}
|
247
|
+
};
|
248
|
+
return dict;
|
214
249
|
return self;},
|
215
250
|
args: [],
|
216
|
-
source:
|
217
|
-
messageSends: [
|
251
|
+
source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.fn.prototype.methods;\x0a\x09for(var i in methods) {\x0a\x09\x09if(methods[i].selector) {\x0a\x09\x09\x09dict._at_put_(methods[i].selector, methods[i]);\x0a\x09\x09}\x0a\x09};\x0a\x09return dict>",
|
252
|
+
messageSends: [],
|
218
253
|
referencedClasses: []
|
219
254
|
}),
|
220
255
|
smalltalk.Behavior);
|
221
256
|
|
222
257
|
smalltalk.addMethod(
|
223
|
-
|
258
|
+
"_methodsFor_",
|
224
259
|
smalltalk.method({
|
225
|
-
selector:
|
260
|
+
selector: "methodsFor:",
|
226
261
|
category: 'accessing',
|
227
262
|
fn: function (aString){
|
228
263
|
var self=this;
|
229
|
-
smalltalk.send(self, "
|
264
|
+
return (function($rec){smalltalk.send($rec, "_class_category_", [self, aString]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.ClassCategoryReader || ClassCategoryReader), "_new", []));
|
230
265
|
return self;},
|
231
266
|
args: ["aString"],
|
232
|
-
source:
|
233
|
-
messageSends: ["
|
234
|
-
referencedClasses: []
|
267
|
+
source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
|
268
|
+
messageSends: ["class:category:", "yourself", "new"],
|
269
|
+
referencedClasses: ["ClassCategoryReader"]
|
235
270
|
}),
|
236
271
|
smalltalk.Behavior);
|
237
272
|
|
238
273
|
smalltalk.addMethod(
|
239
|
-
|
274
|
+
"_methodsFor_stamp_",
|
240
275
|
smalltalk.method({
|
241
|
-
selector:
|
276
|
+
selector: "methodsFor:stamp:",
|
242
277
|
category: 'accessing',
|
243
|
-
fn: function (){
|
278
|
+
fn: function (aString, aStamp){
|
244
279
|
var self=this;
|
245
|
-
return
|
280
|
+
return smalltalk.send(self, "_methodsFor_", [aString]);
|
246
281
|
return self;},
|
247
|
-
args: [],
|
248
|
-
source:
|
249
|
-
messageSends: ["
|
250
|
-
referencedClasses: [
|
282
|
+
args: ["aString", "aStamp"],
|
283
|
+
source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
|
284
|
+
messageSends: ["methodsFor:"],
|
285
|
+
referencedClasses: []
|
251
286
|
}),
|
252
287
|
smalltalk.Behavior);
|
253
288
|
|
254
289
|
smalltalk.addMethod(
|
255
|
-
|
290
|
+
"_name",
|
256
291
|
smalltalk.method({
|
257
|
-
selector:
|
258
|
-
category: '
|
259
|
-
fn: function (
|
292
|
+
selector: "name",
|
293
|
+
category: 'accessing',
|
294
|
+
fn: function (){
|
260
295
|
var self=this;
|
261
|
-
|
262
|
-
delete self.fn.prototype.methods[aMethod.selector];
|
263
|
-
smalltalk.init(self);;
|
296
|
+
return self.className || nil;
|
264
297
|
return self;},
|
265
|
-
args: [
|
266
|
-
source:
|
298
|
+
args: [],
|
299
|
+
source: "name\x0a\x09<return self.className || nil>",
|
267
300
|
messageSends: [],
|
268
301
|
referencedClasses: []
|
269
302
|
}),
|
270
303
|
smalltalk.Behavior);
|
271
304
|
|
272
305
|
smalltalk.addMethod(
|
273
|
-
|
306
|
+
"_new",
|
274
307
|
smalltalk.method({
|
275
|
-
selector:
|
276
|
-
category: '
|
277
|
-
fn: function (
|
308
|
+
selector: "new",
|
309
|
+
category: 'instance creation',
|
310
|
+
fn: function (){
|
278
311
|
var self=this;
|
279
|
-
return smalltalk.send(smalltalk.send(
|
312
|
+
return smalltalk.send(smalltalk.send(self, "_basicNew", []), "_initialize", []);
|
280
313
|
return self;},
|
281
|
-
args: [
|
282
|
-
source:
|
283
|
-
messageSends: ["
|
314
|
+
args: [],
|
315
|
+
source: "new\x0a\x09^self basicNew initialize",
|
316
|
+
messageSends: ["initialize", "basicNew"],
|
284
317
|
referencedClasses: []
|
285
318
|
}),
|
286
319
|
smalltalk.Behavior);
|
287
320
|
|
288
321
|
smalltalk.addMethod(
|
289
|
-
|
322
|
+
"_protocols",
|
290
323
|
smalltalk.method({
|
291
|
-
selector:
|
324
|
+
selector: "protocols",
|
292
325
|
category: 'accessing',
|
293
326
|
fn: function (){
|
294
327
|
var self=this;
|
@@ -298,16 +331,16 @@ smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_do_", [(function
|
|
298
331
|
return smalltalk.send(protocols, "_sort", []);
|
299
332
|
return self;},
|
300
333
|
args: [],
|
301
|
-
source:
|
334
|
+
source: "protocols\x0a | protocols |\x0a protocols := Array new.\x0a self methodDictionary do: [:each |\x0a\x09 (protocols includes: each category) ifFalse: [\x0a\x09\x09protocols add: each category]].\x0a ^protocols sort",
|
302
335
|
messageSends: ["new", "do:", "methodDictionary", "ifFalse:", "includes:", "category", "add:", "sort"],
|
303
336
|
referencedClasses: ["Array"]
|
304
337
|
}),
|
305
338
|
smalltalk.Behavior);
|
306
339
|
|
307
340
|
smalltalk.addMethod(
|
308
|
-
|
341
|
+
"_protocolsDo_",
|
309
342
|
smalltalk.method({
|
310
|
-
selector:
|
343
|
+
selector: "protocolsDo:",
|
311
344
|
category: 'accessing',
|
312
345
|
fn: function (aBlock){
|
313
346
|
var self=this;
|
@@ -317,203 +350,182 @@ smalltalk.send(smalltalk.send(smalltalk.send(self, "_methodDictionary", []), "_v
|
|
317
350
|
smalltalk.send(smalltalk.send(self, "_protocols", []), "_do_", [(function(category){return smalltalk.send(aBlock, "_value_value_", [category, smalltalk.send(methodsByCategory, "_at_", [category])]);})]);
|
318
351
|
return self;},
|
319
352
|
args: ["aBlock"],
|
320
|
-
source:
|
353
|
+
source: "protocolsDo: aBlock\x0a\x09\x22Execute aBlock for each method category with\x0a\x09its collection of methods in the sort order of category name.\x22\x0a\x0a\x09| methodsByCategory |\x0a\x09methodsByCategory := HashedCollection new.\x0a\x09self methodDictionary values do: [:m |\x0a\x09\x09(methodsByCategory at: m category ifAbsentPut: [Array new])\x0a \x09\x09\x09add: m]. \x0a\x09self protocols do: [:category |\x0a\x09\x09aBlock value: category value: (methodsByCategory at: category)]",
|
321
354
|
messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
|
322
355
|
referencedClasses: ["HashedCollection", "Array"]
|
323
356
|
}),
|
324
357
|
smalltalk.Behavior);
|
325
358
|
|
326
359
|
smalltalk.addMethod(
|
327
|
-
|
360
|
+
"_prototype",
|
328
361
|
smalltalk.method({
|
329
|
-
selector:
|
362
|
+
selector: "prototype",
|
330
363
|
category: 'accessing',
|
331
364
|
fn: function (){
|
332
365
|
var self=this;
|
333
|
-
|
334
|
-
(result=smalltalk.send(smalltalk.send(self, "_instanceVariableNames", []), "_copy", []));
|
335
|
-
(($receiver = smalltalk.send(self, "_superclass", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(result, "_addAll_", [smalltalk.send(smalltalk.send(self, "_superclass", []), "_allInstanceVariableNames", [])]);})() : nil;
|
336
|
-
return result;
|
366
|
+
return self.fn.prototype;
|
337
367
|
return self;},
|
338
368
|
args: [],
|
339
|
-
source:
|
340
|
-
messageSends: [
|
369
|
+
source: "prototype\x0a\x09<return self.fn.prototype>",
|
370
|
+
messageSends: [],
|
341
371
|
referencedClasses: []
|
342
372
|
}),
|
343
373
|
smalltalk.Behavior);
|
344
374
|
|
345
375
|
smalltalk.addMethod(
|
346
|
-
|
376
|
+
"_removeCompiledMethod_",
|
347
377
|
smalltalk.method({
|
348
|
-
selector:
|
349
|
-
category: '
|
350
|
-
fn: function (
|
378
|
+
selector: "removeCompiledMethod:",
|
379
|
+
category: 'compiling',
|
380
|
+
fn: function (aMethod){
|
351
381
|
var self=this;
|
352
|
-
|
382
|
+
delete self.fn.prototype[aMethod.selector._asSelector()];
|
383
|
+
delete self.fn.prototype.methods[aMethod.selector];
|
384
|
+
smalltalk.init(self);;
|
353
385
|
return self;},
|
354
|
-
args: ["
|
355
|
-
source:
|
386
|
+
args: ["aMethod"],
|
387
|
+
source: "removeCompiledMethod: aMethod\x0a\x09<delete self.fn.prototype[aMethod.selector._asSelector()];\x0a\x09delete self.fn.prototype.methods[aMethod.selector];\x0a\x09smalltalk.init(self);>",
|
356
388
|
messageSends: [],
|
357
389
|
referencedClasses: []
|
358
390
|
}),
|
359
391
|
smalltalk.Behavior);
|
360
392
|
|
361
393
|
smalltalk.addMethod(
|
362
|
-
|
394
|
+
"_subclasses",
|
363
395
|
smalltalk.method({
|
364
|
-
selector:
|
396
|
+
selector: "subclasses",
|
365
397
|
category: 'accessing',
|
366
|
-
fn: function (
|
398
|
+
fn: function (){
|
367
399
|
var self=this;
|
368
|
-
return smalltalk.
|
400
|
+
return smalltalk.subclasses(self);
|
369
401
|
return self;},
|
370
|
-
args: [
|
371
|
-
source:
|
372
|
-
messageSends: [
|
402
|
+
args: [],
|
403
|
+
source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
|
404
|
+
messageSends: [],
|
373
405
|
referencedClasses: []
|
374
406
|
}),
|
375
407
|
smalltalk.Behavior);
|
376
408
|
|
377
409
|
smalltalk.addMethod(
|
378
|
-
|
410
|
+
"_superclass",
|
379
411
|
smalltalk.method({
|
380
|
-
selector:
|
412
|
+
selector: "superclass",
|
381
413
|
category: 'accessing',
|
382
|
-
fn: function (
|
383
|
-
var self=this;
|
384
|
-
return smalltalk.send(self, "_commentStamp", []);
|
385
|
-
return self;},
|
386
|
-
args: ["aStamp", "prior"],
|
387
|
-
source: unescape('commentStamp%3A%20aStamp%20prior%3A%20prior%0A%20%20%20%20%20%20%20%20%5Eself%20commentStamp'),
|
388
|
-
messageSends: ["commentStamp"],
|
389
|
-
referencedClasses: []
|
390
|
-
}),
|
391
|
-
smalltalk.Behavior);
|
392
|
-
|
393
|
-
smalltalk.addMethod(
|
394
|
-
unescape('_compile_'),
|
395
|
-
smalltalk.method({
|
396
|
-
selector: unescape('compile%3A'),
|
397
|
-
category: 'compiling',
|
398
|
-
fn: function (aString){
|
414
|
+
fn: function (){
|
399
415
|
var self=this;
|
400
|
-
|
416
|
+
return self.superclass || nil;
|
401
417
|
return self;},
|
402
|
-
args: [
|
403
|
-
source:
|
404
|
-
messageSends: [
|
418
|
+
args: [],
|
419
|
+
source: "superclass\x0a\x09<return self.superclass || nil>",
|
420
|
+
messageSends: [],
|
405
421
|
referencedClasses: []
|
406
422
|
}),
|
407
423
|
smalltalk.Behavior);
|
408
424
|
|
409
425
|
smalltalk.addMethod(
|
410
|
-
|
426
|
+
"_withAllSubclasses",
|
411
427
|
smalltalk.method({
|
412
|
-
selector:
|
413
|
-
category: '
|
414
|
-
fn: function (
|
428
|
+
selector: "withAllSubclasses",
|
429
|
+
category: 'accessing',
|
430
|
+
fn: function (){
|
415
431
|
var self=this;
|
416
|
-
|
417
|
-
(method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self]));
|
418
|
-
smalltalk.send(method, "_category_", [anotherString]);
|
419
|
-
smalltalk.send(self, "_addCompiledMethod_", [method]);
|
432
|
+
return (function($rec){smalltalk.send($rec, "_addAll_", [smalltalk.send(self, "_allSubclasses", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.Array || Array), "_with_", [self]));
|
420
433
|
return self;},
|
421
|
-
args: [
|
422
|
-
source:
|
423
|
-
messageSends: ["
|
424
|
-
referencedClasses: ["
|
434
|
+
args: [],
|
435
|
+
source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
|
436
|
+
messageSends: ["addAll:", "allSubclasses", "yourself", "with:"],
|
437
|
+
referencedClasses: ["Array"]
|
425
438
|
}),
|
426
439
|
smalltalk.Behavior);
|
427
440
|
|
428
441
|
|
429
442
|
|
430
443
|
smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
|
431
|
-
smalltalk.Class.comment=
|
444
|
+
smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
|
432
445
|
smalltalk.addMethod(
|
433
|
-
|
446
|
+
"_category",
|
434
447
|
smalltalk.method({
|
435
|
-
selector:
|
448
|
+
selector: "category",
|
436
449
|
category: 'accessing',
|
437
450
|
fn: function (){
|
438
451
|
var self=this;
|
439
452
|
return (($receiver = smalltalk.send(self, "_package", [])) == nil || $receiver == undefined) ? (function(){return "Unclassified";})() : (function(){return smalltalk.send(smalltalk.send(self, "_package", []), "_name", []);})();
|
440
453
|
return self;},
|
441
454
|
args: [],
|
442
|
-
source:
|
455
|
+
source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
|
443
456
|
messageSends: ["ifNil:ifNotNil:", "package", "name"],
|
444
457
|
referencedClasses: []
|
445
458
|
}),
|
446
459
|
smalltalk.Class);
|
447
460
|
|
448
461
|
smalltalk.addMethod(
|
449
|
-
|
462
|
+
"_isClass",
|
450
463
|
smalltalk.method({
|
451
|
-
selector:
|
452
|
-
category: '
|
453
|
-
fn: function (
|
464
|
+
selector: "isClass",
|
465
|
+
category: 'testing',
|
466
|
+
fn: function (){
|
454
467
|
var self=this;
|
455
|
-
return
|
468
|
+
return true;
|
456
469
|
return self;},
|
457
|
-
args: [
|
458
|
-
source:
|
459
|
-
messageSends: [
|
470
|
+
args: [],
|
471
|
+
source: "isClass\x0a\x09^true",
|
472
|
+
messageSends: [],
|
460
473
|
referencedClasses: []
|
461
474
|
}),
|
462
475
|
smalltalk.Class);
|
463
476
|
|
464
477
|
smalltalk.addMethod(
|
465
|
-
|
478
|
+
"_package",
|
466
479
|
smalltalk.method({
|
467
|
-
selector:
|
468
|
-
category: '
|
469
|
-
fn: function (
|
480
|
+
selector: "package",
|
481
|
+
category: 'accessing',
|
482
|
+
fn: function (){
|
470
483
|
var self=this;
|
471
|
-
|
472
|
-
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
|
484
|
+
return self.pkg;
|
473
485
|
return self;},
|
474
|
-
args: [
|
475
|
-
source:
|
476
|
-
messageSends: [
|
486
|
+
args: [],
|
487
|
+
source: "package\x0a\x09<return self.pkg>",
|
488
|
+
messageSends: [],
|
477
489
|
referencedClasses: []
|
478
490
|
}),
|
479
491
|
smalltalk.Class);
|
480
492
|
|
481
493
|
smalltalk.addMethod(
|
482
|
-
|
494
|
+
"_package_",
|
483
495
|
smalltalk.method({
|
484
|
-
selector:
|
485
|
-
category: '
|
486
|
-
fn: function (){
|
496
|
+
selector: "package:",
|
497
|
+
category: 'accessing',
|
498
|
+
fn: function (aPackage){
|
487
499
|
var self=this;
|
488
|
-
|
500
|
+
self.pkg = aPackage;
|
489
501
|
return self;},
|
490
|
-
args: [],
|
491
|
-
source:
|
502
|
+
args: ["aPackage"],
|
503
|
+
source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
|
492
504
|
messageSends: [],
|
493
505
|
referencedClasses: []
|
494
506
|
}),
|
495
507
|
smalltalk.Class);
|
496
508
|
|
497
509
|
smalltalk.addMethod(
|
498
|
-
|
510
|
+
"_printString",
|
499
511
|
smalltalk.method({
|
500
|
-
selector:
|
512
|
+
selector: "printString",
|
501
513
|
category: 'printing',
|
502
514
|
fn: function (){
|
503
515
|
var self=this;
|
504
516
|
return smalltalk.send(self, "_name", []);
|
505
517
|
return self;},
|
506
518
|
args: [],
|
507
|
-
source:
|
519
|
+
source: "printString\x0a\x09^self name",
|
508
520
|
messageSends: ["name"],
|
509
521
|
referencedClasses: []
|
510
522
|
}),
|
511
523
|
smalltalk.Class);
|
512
524
|
|
513
525
|
smalltalk.addMethod(
|
514
|
-
|
526
|
+
"_rename_",
|
515
527
|
smalltalk.method({
|
516
|
-
selector:
|
528
|
+
selector: "rename:",
|
517
529
|
category: 'accessing',
|
518
530
|
fn: function (aString){
|
519
531
|
var self=this;
|
@@ -524,71 +536,72 @@ var self=this;
|
|
524
536
|
;
|
525
537
|
return self;},
|
526
538
|
args: ["aString"],
|
527
|
-
source:
|
539
|
+
source: "rename: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = self;\x0a\x09\x09delete smalltalk[self.className];\x0a\x09\x09self.className = aString;\x0a\x09>",
|
528
540
|
messageSends: [],
|
529
541
|
referencedClasses: []
|
530
542
|
}),
|
531
543
|
smalltalk.Class);
|
532
544
|
|
533
545
|
smalltalk.addMethod(
|
534
|
-
|
546
|
+
"_subclass_instanceVariableNames_",
|
535
547
|
smalltalk.method({
|
536
|
-
selector:
|
548
|
+
selector: "subclass:instanceVariableNames:",
|
537
549
|
category: 'class creation',
|
538
|
-
fn: function (aString,
|
550
|
+
fn: function (aString, anotherString){
|
539
551
|
var self=this;
|
540
|
-
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString,
|
552
|
+
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, anotherString, nil]);
|
541
553
|
return self;},
|
542
|
-
args: ["aString", "
|
543
|
-
source:
|
554
|
+
args: ["aString", "anotherString"],
|
555
|
+
source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
|
544
556
|
messageSends: ["subclass:instanceVariableNames:package:"],
|
545
557
|
referencedClasses: []
|
546
558
|
}),
|
547
559
|
smalltalk.Class);
|
548
560
|
|
549
561
|
smalltalk.addMethod(
|
550
|
-
|
562
|
+
"_subclass_instanceVariableNames_category_",
|
551
563
|
smalltalk.method({
|
552
|
-
selector:
|
553
|
-
category: '
|
554
|
-
fn: function (){
|
564
|
+
selector: "subclass:instanceVariableNames:category:",
|
565
|
+
category: 'class creation',
|
566
|
+
fn: function (aString, aString2, aString3){
|
555
567
|
var self=this;
|
556
|
-
|
568
|
+
smalltalk.send(self, "_deprecatedAPI", []);
|
569
|
+
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
|
557
570
|
return self;},
|
558
|
-
args: [],
|
559
|
-
source:
|
560
|
-
messageSends: [],
|
571
|
+
args: ["aString", "aString2", "aString3"],
|
572
|
+
source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for compatibility.\x22\x0a\x09self deprecatedAPI.\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
|
573
|
+
messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
|
561
574
|
referencedClasses: []
|
562
575
|
}),
|
563
576
|
smalltalk.Class);
|
564
577
|
|
565
578
|
smalltalk.addMethod(
|
566
|
-
|
579
|
+
"_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
|
567
580
|
smalltalk.method({
|
568
|
-
selector:
|
569
|
-
category: '
|
570
|
-
fn: function (
|
581
|
+
selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
|
582
|
+
category: 'class creation',
|
583
|
+
fn: function (aString, aString2, classVars, pools, aString3){
|
571
584
|
var self=this;
|
572
|
-
self
|
585
|
+
return smalltalk.send(self, "_subclass_instanceVariableNames_package_", [aString, aString2, aString3]);
|
573
586
|
return self;},
|
574
|
-
args: ["
|
575
|
-
source:
|
576
|
-
messageSends: [],
|
587
|
+
args: ["aString", "aString2", "classVars", "pools", "aString3"],
|
588
|
+
source: "subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3\x0a\x09\x22Just ignore class variables and pools. Added for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: aString2 package: aString3",
|
589
|
+
messageSends: ["subclass:instanceVariableNames:package:"],
|
577
590
|
referencedClasses: []
|
578
591
|
}),
|
579
592
|
smalltalk.Class);
|
580
593
|
|
581
594
|
smalltalk.addMethod(
|
582
|
-
|
595
|
+
"_subclass_instanceVariableNames_package_",
|
583
596
|
smalltalk.method({
|
584
|
-
selector:
|
597
|
+
selector: "subclass:instanceVariableNames:package:",
|
585
598
|
category: 'class creation',
|
586
599
|
fn: function (aString, aString2, aString3){
|
587
600
|
var self=this;
|
588
601
|
return smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_superclass_subclass_instanceVariableNames_package_", [self, smalltalk.send(aString, "_asString", []), aString2, aString3]);
|
589
602
|
return self;},
|
590
603
|
args: ["aString", "aString2", "aString3"],
|
591
|
-
source:
|
604
|
+
source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
|
592
605
|
messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
|
593
606
|
referencedClasses: ["ClassBuilder"]
|
594
607
|
}),
|
@@ -597,67 +610,67 @@ smalltalk.Class);
|
|
597
610
|
|
598
611
|
|
599
612
|
smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
|
600
|
-
smalltalk.Metaclass.comment=
|
613
|
+
smalltalk.Metaclass.comment="Metaclass is the root of the class hierarchy.\x0a\x0aMetaclass instances are metaclasses, one for each real class. \x0aMetaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of."
|
601
614
|
smalltalk.addMethod(
|
602
|
-
|
615
|
+
"_instanceClass",
|
603
616
|
smalltalk.method({
|
604
|
-
selector:
|
617
|
+
selector: "instanceClass",
|
605
618
|
category: 'accessing',
|
606
619
|
fn: function (){
|
607
620
|
var self=this;
|
608
621
|
return self.instanceClass;
|
609
622
|
return self;},
|
610
623
|
args: [],
|
611
|
-
source:
|
624
|
+
source: "instanceClass\x0a\x09<return self.instanceClass>",
|
612
625
|
messageSends: [],
|
613
626
|
referencedClasses: []
|
614
627
|
}),
|
615
628
|
smalltalk.Metaclass);
|
616
629
|
|
617
630
|
smalltalk.addMethod(
|
618
|
-
|
631
|
+
"_instanceVariableNames_",
|
619
632
|
smalltalk.method({
|
620
|
-
selector:
|
633
|
+
selector: "instanceVariableNames:",
|
621
634
|
category: 'accessing',
|
622
635
|
fn: function (aCollection){
|
623
636
|
var self=this;
|
624
637
|
smalltalk.send(smalltalk.send((smalltalk.ClassBuilder || ClassBuilder), "_new", []), "_class_instanceVariableNames_", [self, aCollection]);
|
625
638
|
return self;},
|
626
639
|
args: ["aCollection"],
|
627
|
-
source:
|
640
|
+
source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
|
628
641
|
messageSends: ["class:instanceVariableNames:", "new"],
|
629
642
|
referencedClasses: ["ClassBuilder"]
|
630
643
|
}),
|
631
644
|
smalltalk.Metaclass);
|
632
645
|
|
633
646
|
smalltalk.addMethod(
|
634
|
-
|
647
|
+
"_isMetaclass",
|
635
648
|
smalltalk.method({
|
636
|
-
selector:
|
649
|
+
selector: "isMetaclass",
|
637
650
|
category: 'testing',
|
638
651
|
fn: function (){
|
639
652
|
var self=this;
|
640
653
|
return true;
|
641
654
|
return self;},
|
642
655
|
args: [],
|
643
|
-
source:
|
656
|
+
source: "isMetaclass\x0a\x09^true",
|
644
657
|
messageSends: [],
|
645
658
|
referencedClasses: []
|
646
659
|
}),
|
647
660
|
smalltalk.Metaclass);
|
648
661
|
|
649
662
|
smalltalk.addMethod(
|
650
|
-
|
663
|
+
"_printString",
|
651
664
|
smalltalk.method({
|
652
|
-
selector:
|
665
|
+
selector: "printString",
|
653
666
|
category: 'printing',
|
654
667
|
fn: function (){
|
655
668
|
var self=this;
|
656
669
|
return smalltalk.send(smalltalk.send(smalltalk.send(self, "_instanceClass", []), "_name", []), "__comma", [" class"]);
|
657
670
|
return self;},
|
658
671
|
args: [],
|
659
|
-
source:
|
660
|
-
messageSends: [
|
672
|
+
source: "printString\x0a\x09^self instanceClass name, ' class'",
|
673
|
+
messageSends: [",", "name", "instanceClass"],
|
661
674
|
referencedClasses: []
|
662
675
|
}),
|
663
676
|
smalltalk.Metaclass);
|
@@ -665,27 +678,45 @@ smalltalk.Metaclass);
|
|
665
678
|
|
666
679
|
|
667
680
|
smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
|
668
|
-
smalltalk.ClassBuilder.comment=
|
681
|
+
smalltalk.ClassBuilder.comment="ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`."
|
669
682
|
smalltalk.addMethod(
|
670
|
-
|
683
|
+
"_addSubclassOf_named_instanceVariableNames_",
|
671
684
|
smalltalk.method({
|
672
|
-
selector:
|
673
|
-
category: '
|
674
|
-
fn: function (aClass, aString){
|
685
|
+
selector: "addSubclassOf:named:instanceVariableNames:",
|
686
|
+
category: 'private',
|
687
|
+
fn: function (aClass, aString, aCollection){
|
675
688
|
var self=this;
|
676
|
-
|
689
|
+
smalltalk.addClass(aString, aClass, aCollection);
|
690
|
+
return smalltalk[aString];
|
677
691
|
return self;},
|
678
|
-
args: ["aClass", "aString"],
|
679
|
-
source:
|
680
|
-
messageSends: [
|
692
|
+
args: ["aClass", "aString", "aCollection"],
|
693
|
+
source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection\x0a\x09<smalltalk.addClass(aString, aClass, aCollection);\x0a\x09 return smalltalk[aString]>",
|
694
|
+
messageSends: [],
|
695
|
+
referencedClasses: []
|
696
|
+
}),
|
697
|
+
smalltalk.ClassBuilder);
|
698
|
+
|
699
|
+
smalltalk.addMethod(
|
700
|
+
"_addSubclassOf_named_instanceVariableNames_package_",
|
701
|
+
smalltalk.method({
|
702
|
+
selector: "addSubclassOf:named:instanceVariableNames:package:",
|
703
|
+
category: 'private',
|
704
|
+
fn: function (aClass, aString, aCollection, packageName){
|
705
|
+
var self=this;
|
706
|
+
smalltalk.addClass(aString, aClass, aCollection, packageName);
|
707
|
+
return smalltalk[aString];
|
708
|
+
return self;},
|
709
|
+
args: ["aClass", "aString", "aCollection", "packageName"],
|
710
|
+
source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09 return smalltalk[aString]>",
|
711
|
+
messageSends: [],
|
681
712
|
referencedClasses: []
|
682
713
|
}),
|
683
714
|
smalltalk.ClassBuilder);
|
684
715
|
|
685
716
|
smalltalk.addMethod(
|
686
|
-
|
717
|
+
"_class_instanceVariableNames_",
|
687
718
|
smalltalk.method({
|
688
|
-
selector:
|
719
|
+
selector: "class:instanceVariableNames:",
|
689
720
|
category: 'class creation',
|
690
721
|
fn: function (aClass, aString){
|
691
722
|
var self=this;
|
@@ -694,65 +725,86 @@ smalltalk.send(aClass, "_basicAt_put_", ["iVarNames", smalltalk.send(self, "_ins
|
|
694
725
|
smalltalk.send(self, "_setupClass_", [aClass]);
|
695
726
|
return self;},
|
696
727
|
args: ["aClass", "aString"],
|
697
|
-
source:
|
698
|
-
messageSends: ["ifFalse:", "isMetaclass", "error:",
|
728
|
+
source: "class: aClass instanceVariableNames: aString\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).\x0a\x09self setupClass: aClass",
|
729
|
+
messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:", "instanceVariableNamesFor:", "setupClass:"],
|
699
730
|
referencedClasses: []
|
700
731
|
}),
|
701
732
|
smalltalk.ClassBuilder);
|
702
733
|
|
703
734
|
smalltalk.addMethod(
|
704
|
-
|
735
|
+
"_copyClass_named_",
|
736
|
+
smalltalk.method({
|
737
|
+
selector: "copyClass:named:",
|
738
|
+
category: 'private',
|
739
|
+
fn: function (aClass, aString){
|
740
|
+
var self=this;
|
741
|
+
var newClass=nil;
|
742
|
+
(newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [smalltalk.send(aClass, "_superclass", []), aString, smalltalk.send(aClass, "_instanceVariableNames", []), smalltalk.send(smalltalk.send(aClass, "_package", []), "_name", [])]));
|
743
|
+
smalltalk.send(self, "_setupClass_", [newClass]);
|
744
|
+
smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [smalltalk.send(each, "_source", []), newClass, smalltalk.send(each, "_category", [])]);})]);
|
745
|
+
smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [smalltalk.send(each, "_source", []), smalltalk.send(newClass, "_class", []), smalltalk.send(each, "_category", [])]);})]);
|
746
|
+
smalltalk.send(self, "_setupClass_", [newClass]);
|
747
|
+
return newClass;
|
748
|
+
return self;},
|
749
|
+
args: ["aClass", "aString"],
|
750
|
+
source: "copyClass: aClass named: aString\x0a\x09| newClass |\x0a\x0a\x09newClass := self \x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: aString \x0a\x09\x09instanceVariableNames: aClass instanceVariableNames \x0a\x09\x09package: aClass package name.\x0a\x0a\x09self setupClass: newClass.\x0a\x0a\x09aClass methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass category: each category].\x0a\x0a\x09aClass class methodDictionary values do: [:each |\x0a\x09\x09Compiler new install: each source forClass: newClass class category: each category].\x0a\x0a\x09self setupClass: newClass.\x0a\x09^newClass",
|
751
|
+
messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "setupClass:", "do:", "values", "methodDictionary", "install:forClass:category:", "new", "source", "category", "class"],
|
752
|
+
referencedClasses: ["Compiler"]
|
753
|
+
}),
|
754
|
+
smalltalk.ClassBuilder);
|
755
|
+
|
756
|
+
smalltalk.addMethod(
|
757
|
+
"_instanceVariableNamesFor_",
|
705
758
|
smalltalk.method({
|
706
|
-
selector:
|
759
|
+
selector: "instanceVariableNamesFor:",
|
707
760
|
category: 'private',
|
708
761
|
fn: function (aString){
|
709
762
|
var self=this;
|
710
763
|
return smalltalk.send(smalltalk.send(aString, "_tokenize_", [" "]), "_reject_", [(function(each){return smalltalk.send(each, "_isEmpty", []);})]);
|
711
764
|
return self;},
|
712
765
|
args: ["aString"],
|
713
|
-
source:
|
766
|
+
source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [:each | each isEmpty]",
|
714
767
|
messageSends: ["reject:", "tokenize:", "isEmpty"],
|
715
768
|
referencedClasses: []
|
716
769
|
}),
|
717
770
|
smalltalk.ClassBuilder);
|
718
771
|
|
719
772
|
smalltalk.addMethod(
|
720
|
-
|
773
|
+
"_setupClass_",
|
721
774
|
smalltalk.method({
|
722
|
-
selector:
|
775
|
+
selector: "setupClass:",
|
723
776
|
category: 'private',
|
724
|
-
fn: function (aClass
|
777
|
+
fn: function (aClass){
|
725
778
|
var self=this;
|
726
|
-
smalltalk.
|
727
|
-
return smalltalk[aString];
|
779
|
+
smalltalk.init(aClass);;
|
728
780
|
return self;},
|
729
|
-
args: ["aClass"
|
730
|
-
source:
|
781
|
+
args: ["aClass"],
|
782
|
+
source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
|
731
783
|
messageSends: [],
|
732
784
|
referencedClasses: []
|
733
785
|
}),
|
734
786
|
smalltalk.ClassBuilder);
|
735
787
|
|
736
788
|
smalltalk.addMethod(
|
737
|
-
|
789
|
+
"_superclass_subclass_",
|
738
790
|
smalltalk.method({
|
739
|
-
selector:
|
740
|
-
category: '
|
741
|
-
fn: function (aClass){
|
791
|
+
selector: "superclass:subclass:",
|
792
|
+
category: 'class creation',
|
793
|
+
fn: function (aClass, aString){
|
742
794
|
var self=this;
|
743
|
-
smalltalk.
|
795
|
+
return smalltalk.send(self, "_superclass_subclass_instanceVariableNames_package_", [aClass, aString, "", nil]);
|
744
796
|
return self;},
|
745
|
-
args: ["aClass"],
|
746
|
-
source:
|
747
|
-
messageSends: [],
|
797
|
+
args: ["aClass", "aString"],
|
798
|
+
source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
|
799
|
+
messageSends: ["superclass:subclass:instanceVariableNames:package:"],
|
748
800
|
referencedClasses: []
|
749
801
|
}),
|
750
802
|
smalltalk.ClassBuilder);
|
751
803
|
|
752
804
|
smalltalk.addMethod(
|
753
|
-
|
805
|
+
"_superclass_subclass_instanceVariableNames_package_",
|
754
806
|
smalltalk.method({
|
755
|
-
selector:
|
807
|
+
selector: "superclass:subclass:instanceVariableNames:package:",
|
756
808
|
category: 'class creation',
|
757
809
|
fn: function (aClass, aString, aString2, aString3){
|
758
810
|
var self=this;
|
@@ -762,195 +814,291 @@ smalltalk.send(self, "_setupClass_", [newClass]);
|
|
762
814
|
return newClass;
|
763
815
|
return self;},
|
764
816
|
args: ["aClass", "aString", "aString2", "aString3"],
|
765
|
-
source:
|
817
|
+
source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09^newClass",
|
766
818
|
messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:"],
|
767
819
|
referencedClasses: []
|
768
820
|
}),
|
769
821
|
smalltalk.ClassBuilder);
|
770
822
|
|
823
|
+
|
824
|
+
|
825
|
+
smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
|
826
|
+
smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
|
771
827
|
smalltalk.addMethod(
|
772
|
-
|
828
|
+
"_class_category_",
|
773
829
|
smalltalk.method({
|
774
|
-
selector:
|
775
|
-
category: '
|
776
|
-
fn: function (aClass, aString
|
830
|
+
selector: "class:category:",
|
831
|
+
category: 'accessing',
|
832
|
+
fn: function (aClass, aString){
|
777
833
|
var self=this;
|
778
|
-
|
779
|
-
|
834
|
+
(self['@class']=aClass);
|
835
|
+
(self['@category']=aString);
|
780
836
|
return self;},
|
781
|
-
args: ["aClass", "aString"
|
782
|
-
source:
|
837
|
+
args: ["aClass", "aString"],
|
838
|
+
source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
|
783
839
|
messageSends: [],
|
784
840
|
referencedClasses: []
|
785
841
|
}),
|
786
|
-
smalltalk.
|
842
|
+
smalltalk.ClassCategoryReader);
|
787
843
|
|
788
844
|
smalltalk.addMethod(
|
789
|
-
|
845
|
+
"_compileMethod_",
|
790
846
|
smalltalk.method({
|
791
|
-
selector:
|
847
|
+
selector: "compileMethod:",
|
792
848
|
category: 'private',
|
793
|
-
fn: function (
|
849
|
+
fn: function (aString){
|
794
850
|
var self=this;
|
795
|
-
|
796
|
-
(newClass=smalltalk.send(self, "_addSubclassOf_named_instanceVariableNames_package_", [smalltalk.send(aClass, "_superclass", []), aString, smalltalk.send(aClass, "_instanceVariableNames", []), smalltalk.send(smalltalk.send(aClass, "_package", []), "_name", [])]));
|
797
|
-
smalltalk.send(self, "_setupClass_", [newClass]);
|
798
|
-
smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(newClass, "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), newClass])]);return smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
|
799
|
-
smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_methodDictionary", []), "_values", []), "_do_", [(function(each){smalltalk.send(smalltalk.send(newClass, "_class", []), "_addCompiledMethod_", [smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [smalltalk.send(each, "_source", []), smalltalk.send(newClass, "_class", [])])]);return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(newClass, "_class", []), "_methodDictionary", []), "_at_", [smalltalk.send(each, "_selector", [])]), "_category_", [smalltalk.send(each, "_category", [])]);})]);
|
800
|
-
smalltalk.send(self, "_setupClass_", [newClass]);
|
801
|
-
return newClass;
|
851
|
+
smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_install_forClass_category_", [aString, self['@class'], self['@category']]);
|
802
852
|
return self;},
|
803
|
-
args: ["
|
804
|
-
source:
|
805
|
-
messageSends: ["
|
853
|
+
args: ["aString"],
|
854
|
+
source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
|
855
|
+
messageSends: ["install:forClass:category:", "new"],
|
806
856
|
referencedClasses: ["Compiler"]
|
807
857
|
}),
|
808
|
-
smalltalk.
|
809
|
-
|
810
|
-
|
858
|
+
smalltalk.ClassCategoryReader);
|
811
859
|
|
812
|
-
smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel-Classes');
|
813
|
-
smalltalk.ClassCategoryReader.comment=unescape('ClassCategoryReader%20represents%20a%20mechanism%20for%20retrieving%20class%20descriptions%20stored%20on%20a%20file.')
|
814
860
|
smalltalk.addMethod(
|
815
|
-
|
861
|
+
"_initialize",
|
816
862
|
smalltalk.method({
|
817
|
-
selector:
|
863
|
+
selector: "initialize",
|
818
864
|
category: 'initialization',
|
819
865
|
fn: function (){
|
820
866
|
var self=this;
|
821
|
-
smalltalk.send(self, "_initialize", [], smalltalk.
|
867
|
+
smalltalk.send(self, "_initialize", [], smalltalk.ClassCategoryReader.superclass || nil);
|
822
868
|
(self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []));
|
823
869
|
return self;},
|
824
870
|
args: [],
|
825
|
-
source:
|
871
|
+
source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
|
826
872
|
messageSends: ["initialize", "new"],
|
827
873
|
referencedClasses: ["ChunkParser"]
|
828
874
|
}),
|
829
875
|
smalltalk.ClassCategoryReader);
|
830
876
|
|
831
877
|
smalltalk.addMethod(
|
832
|
-
|
878
|
+
"_scanFrom_",
|
833
879
|
smalltalk.method({
|
834
|
-
selector:
|
880
|
+
selector: "scanFrom:",
|
881
|
+
category: 'fileIn',
|
882
|
+
fn: function (aChunkParser){
|
883
|
+
var self=this;
|
884
|
+
var chunk=nil;
|
885
|
+
(function(){while(!(function(){(chunk=smalltalk.send(aChunkParser, "_nextChunk", []));return smalltalk.send(chunk, "_isEmpty", []);})()) {(function(){return smalltalk.send(self, "_compileMethod_", [chunk]);})()}})();
|
886
|
+
smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_setupClass_", [self['@class']]);
|
887
|
+
return self;},
|
888
|
+
args: ["aChunkParser"],
|
889
|
+
source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09 self compileMethod: chunk].\x0a\x09Compiler new setupClass: class",
|
890
|
+
messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
|
891
|
+
referencedClasses: ["Compiler"]
|
892
|
+
}),
|
893
|
+
smalltalk.ClassCategoryReader);
|
894
|
+
|
895
|
+
|
896
|
+
|
897
|
+
smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel-Classes');
|
898
|
+
smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.\x0aSee `ClassCategoryReader` too."
|
899
|
+
smalltalk.addMethod(
|
900
|
+
"_class_",
|
901
|
+
smalltalk.method({
|
902
|
+
selector: "class:",
|
835
903
|
category: 'accessing',
|
836
|
-
fn: function (aClass
|
904
|
+
fn: function (aClass){
|
837
905
|
var self=this;
|
838
906
|
(self['@class']=aClass);
|
839
|
-
(self['@category']=aString);
|
840
907
|
return self;},
|
841
|
-
args: ["aClass"
|
842
|
-
source:
|
908
|
+
args: ["aClass"],
|
909
|
+
source: "class: aClass\x0a\x09class := aClass",
|
843
910
|
messageSends: [],
|
844
911
|
referencedClasses: []
|
845
912
|
}),
|
846
|
-
smalltalk.
|
913
|
+
smalltalk.ClassCommentReader);
|
914
|
+
|
915
|
+
smalltalk.addMethod(
|
916
|
+
"_initialize",
|
917
|
+
smalltalk.method({
|
918
|
+
selector: "initialize",
|
919
|
+
category: 'initialization',
|
920
|
+
fn: function (){
|
921
|
+
var self=this;
|
922
|
+
smalltalk.send(self, "_initialize", [], smalltalk.ClassCommentReader.superclass || nil);
|
923
|
+
(self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []));
|
924
|
+
return self;},
|
925
|
+
args: [],
|
926
|
+
source: "initialize\x0a\x09super initialize.\x0a\x09chunkParser := ChunkParser new.",
|
927
|
+
messageSends: ["initialize", "new"],
|
928
|
+
referencedClasses: ["ChunkParser"]
|
929
|
+
}),
|
930
|
+
smalltalk.ClassCommentReader);
|
847
931
|
|
848
932
|
smalltalk.addMethod(
|
849
|
-
|
933
|
+
"_scanFrom_",
|
850
934
|
smalltalk.method({
|
851
|
-
selector:
|
935
|
+
selector: "scanFrom:",
|
852
936
|
category: 'fileIn',
|
853
937
|
fn: function (aChunkParser){
|
854
938
|
var self=this;
|
855
939
|
var chunk=nil;
|
856
|
-
(
|
940
|
+
(chunk=smalltalk.send(aChunkParser, "_nextChunk", []));
|
941
|
+
((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_setComment_", [chunk]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [chunk]);})]));
|
857
942
|
return self;},
|
858
943
|
args: ["aChunkParser"],
|
859
|
-
source:
|
860
|
-
messageSends: ["
|
944
|
+
source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
|
945
|
+
messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
|
861
946
|
referencedClasses: []
|
862
947
|
}),
|
863
|
-
smalltalk.
|
948
|
+
smalltalk.ClassCommentReader);
|
864
949
|
|
865
950
|
smalltalk.addMethod(
|
866
|
-
|
951
|
+
"_setComment_",
|
867
952
|
smalltalk.method({
|
868
|
-
selector:
|
953
|
+
selector: "setComment:",
|
869
954
|
category: 'private',
|
870
955
|
fn: function (aString){
|
871
956
|
var self=this;
|
872
|
-
|
873
|
-
(method=smalltalk.send(smalltalk.send((smalltalk.Compiler || Compiler), "_new", []), "_load_forClass_", [aString, self['@class']]));
|
874
|
-
smalltalk.send(method, "_category_", [self['@category']]);
|
875
|
-
smalltalk.send(self['@class'], "_addCompiledMethod_", [method]);
|
957
|
+
smalltalk.send(self['@class'], "_comment_", [aString]);
|
876
958
|
return self;},
|
877
959
|
args: ["aString"],
|
878
|
-
source:
|
879
|
-
messageSends: ["
|
880
|
-
referencedClasses: [
|
960
|
+
source: "setComment: aString\x0a class comment: aString",
|
961
|
+
messageSends: ["comment:"],
|
962
|
+
referencedClasses: []
|
881
963
|
}),
|
882
|
-
smalltalk.
|
964
|
+
smalltalk.ClassCommentReader);
|
883
965
|
|
884
966
|
|
885
967
|
|
886
|
-
smalltalk.addClass('
|
887
|
-
smalltalk.ClassCommentReader.comment=unescape('ClassCommentReader%20represents%20a%20mechanism%20for%20retrieving%20class%20descriptions%20stored%20on%20a%20file.%0ASee%20%60ClassCategoryReader%60%20too.')
|
968
|
+
smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
|
888
969
|
smalltalk.addMethod(
|
889
|
-
|
970
|
+
"_getNodesFrom_",
|
890
971
|
smalltalk.method({
|
891
|
-
selector:
|
972
|
+
selector: "getNodesFrom:",
|
892
973
|
category: 'accessing',
|
893
|
-
fn: function (
|
974
|
+
fn: function (aCollection){
|
894
975
|
var self=this;
|
895
|
-
|
976
|
+
var children=nil;
|
977
|
+
var others=nil;
|
978
|
+
(children=[]);
|
979
|
+
(others=[]);
|
980
|
+
smalltalk.send(aCollection, "_do_", [(function(each){return ((($receiver = smalltalk.send(smalltalk.send(each, "_superclass", []), "__eq", [smalltalk.send(self, "_theClass", [])])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(children, "_add_", [each]);})() : (function(){return smalltalk.send(others, "_add_", [each]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(children, "_add_", [each]);}), (function(){return smalltalk.send(others, "_add_", [each]);})]));})]);
|
981
|
+
(self['@nodes']=smalltalk.send(children, "_collect_", [(function(each){return smalltalk.send((smalltalk.ClassSorterNode || ClassSorterNode), "_on_classes_level_", [each, others, ((($receiver = smalltalk.send(self, "_level", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);})]));
|
896
982
|
return self;},
|
897
|
-
args: ["
|
898
|
-
source:
|
983
|
+
args: ["aCollection"],
|
984
|
+
source: "getNodesFrom: aCollection\x0a\x09| children others |\x0a\x09children := #().\x0a\x09others := #().\x0a\x09aCollection do: [:each |\x0a\x09\x09(each superclass = self theClass)\x0a\x09\x09\x09ifTrue: [children add: each]\x0a\x09\x09\x09ifFalse: [others add: each]].\x0a\x09nodes:= children collect: [:each |\x0a\x09\x09ClassSorterNode on: each classes: others level: self level + 1]",
|
985
|
+
messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
|
986
|
+
referencedClasses: ["ClassSorterNode"]
|
987
|
+
}),
|
988
|
+
smalltalk.ClassSorterNode);
|
989
|
+
|
990
|
+
smalltalk.addMethod(
|
991
|
+
"_level",
|
992
|
+
smalltalk.method({
|
993
|
+
selector: "level",
|
994
|
+
category: 'accessing',
|
995
|
+
fn: function (){
|
996
|
+
var self=this;
|
997
|
+
return self['@level'];
|
998
|
+
return self;},
|
999
|
+
args: [],
|
1000
|
+
source: "level\x0a\x09^level",
|
899
1001
|
messageSends: [],
|
900
1002
|
referencedClasses: []
|
901
1003
|
}),
|
902
|
-
smalltalk.
|
1004
|
+
smalltalk.ClassSorterNode);
|
903
1005
|
|
904
1006
|
smalltalk.addMethod(
|
905
|
-
|
1007
|
+
"_level_",
|
906
1008
|
smalltalk.method({
|
907
|
-
selector:
|
908
|
-
category: '
|
909
|
-
fn: function (
|
1009
|
+
selector: "level:",
|
1010
|
+
category: 'accessing',
|
1011
|
+
fn: function (anInteger){
|
910
1012
|
var self=this;
|
911
|
-
|
912
|
-
(chunk=smalltalk.send(aChunkParser, "_nextChunk", []));
|
913
|
-
((($receiver = smalltalk.send(chunk, "_isEmpty", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_setComment_", [chunk]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_setComment_", [chunk]);})]));
|
1013
|
+
(self['@level']=anInteger);
|
914
1014
|
return self;},
|
915
|
-
args: ["
|
916
|
-
source:
|
917
|
-
messageSends: [
|
1015
|
+
args: ["anInteger"],
|
1016
|
+
source: "level: anInteger\x0a\x09level := anInteger",
|
1017
|
+
messageSends: [],
|
918
1018
|
referencedClasses: []
|
919
1019
|
}),
|
920
|
-
smalltalk.
|
1020
|
+
smalltalk.ClassSorterNode);
|
921
1021
|
|
922
1022
|
smalltalk.addMethod(
|
923
|
-
|
1023
|
+
"_nodes",
|
924
1024
|
smalltalk.method({
|
925
|
-
selector:
|
926
|
-
category: '
|
1025
|
+
selector: "nodes",
|
1026
|
+
category: 'accessing',
|
927
1027
|
fn: function (){
|
928
1028
|
var self=this;
|
929
|
-
|
930
|
-
(self['@chunkParser']=smalltalk.send((smalltalk.ChunkParser || ChunkParser), "_new", []));
|
1029
|
+
return self['@nodes'];
|
931
1030
|
return self;},
|
932
1031
|
args: [],
|
933
|
-
source:
|
934
|
-
messageSends: [
|
935
|
-
referencedClasses: [
|
1032
|
+
source: "nodes\x0a\x09^nodes",
|
1033
|
+
messageSends: [],
|
1034
|
+
referencedClasses: []
|
936
1035
|
}),
|
937
|
-
smalltalk.
|
1036
|
+
smalltalk.ClassSorterNode);
|
938
1037
|
|
939
1038
|
smalltalk.addMethod(
|
940
|
-
|
1039
|
+
"_theClass",
|
941
1040
|
smalltalk.method({
|
942
|
-
selector:
|
943
|
-
category: '
|
944
|
-
fn: function (
|
1041
|
+
selector: "theClass",
|
1042
|
+
category: 'accessing',
|
1043
|
+
fn: function (){
|
945
1044
|
var self=this;
|
946
|
-
|
1045
|
+
return self['@theClass'];
|
947
1046
|
return self;},
|
948
|
-
args: [
|
949
|
-
source:
|
950
|
-
messageSends: [
|
1047
|
+
args: [],
|
1048
|
+
source: "theClass\x0a\x09^theClass",
|
1049
|
+
messageSends: [],
|
951
1050
|
referencedClasses: []
|
952
1051
|
}),
|
953
|
-
smalltalk.
|
1052
|
+
smalltalk.ClassSorterNode);
|
1053
|
+
|
1054
|
+
smalltalk.addMethod(
|
1055
|
+
"_theClass_",
|
1056
|
+
smalltalk.method({
|
1057
|
+
selector: "theClass:",
|
1058
|
+
category: 'accessing',
|
1059
|
+
fn: function (aClass){
|
1060
|
+
var self=this;
|
1061
|
+
(self['@theClass']=aClass);
|
1062
|
+
return self;},
|
1063
|
+
args: ["aClass"],
|
1064
|
+
source: "theClass: aClass\x0a\x09theClass := aClass",
|
1065
|
+
messageSends: [],
|
1066
|
+
referencedClasses: []
|
1067
|
+
}),
|
1068
|
+
smalltalk.ClassSorterNode);
|
1069
|
+
|
1070
|
+
smalltalk.addMethod(
|
1071
|
+
"_traverseClassesWith_",
|
1072
|
+
smalltalk.method({
|
1073
|
+
selector: "traverseClassesWith:",
|
1074
|
+
category: 'visiting',
|
1075
|
+
fn: function (aCollection){
|
1076
|
+
var self=this;
|
1077
|
+
smalltalk.send(aCollection, "_add_", [smalltalk.send(self, "_theClass", [])]);
|
1078
|
+
smalltalk.send(smalltalk.send(smalltalk.send(self, "_nodes", []), "_sorted_", [(function(a, b){return ((($receiver = smalltalk.send(smalltalk.send(a, "_theClass", []), "_name", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(smalltalk.send(b, "_theClass", []), "_name", [])]));})]), "_do_", [(function(aNode){return smalltalk.send(aNode, "_traverseClassesWith_", [aCollection]);})]);
|
1079
|
+
return self;},
|
1080
|
+
args: ["aCollection"],
|
1081
|
+
source: "traverseClassesWith: aCollection\x0a\x09\x22sort classes alphabetically Issue #143\x22\x0a\x0a\x09aCollection add: self theClass.\x0a\x09(self nodes sorted: [:a :b | a theClass name <= b theClass name ]) do: [:aNode |\x0a\x09\x09aNode traverseClassesWith: aCollection ].",
|
1082
|
+
messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
|
1083
|
+
referencedClasses: []
|
1084
|
+
}),
|
1085
|
+
smalltalk.ClassSorterNode);
|
1086
|
+
|
954
1087
|
|
1088
|
+
smalltalk.addMethod(
|
1089
|
+
"_on_classes_level_",
|
1090
|
+
smalltalk.method({
|
1091
|
+
selector: "on:classes:level:",
|
1092
|
+
category: 'instance creation',
|
1093
|
+
fn: function (aClass, aCollection, anInteger){
|
1094
|
+
var self=this;
|
1095
|
+
return (function($rec){smalltalk.send($rec, "_theClass_", [aClass]);smalltalk.send($rec, "_level_", [anInteger]);smalltalk.send($rec, "_getNodesFrom_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
|
1096
|
+
return self;},
|
1097
|
+
args: ["aClass", "aCollection", "anInteger"],
|
1098
|
+
source: "on: aClass classes: aCollection level: anInteger\x0a\x09^self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09level: anInteger;\x0a\x09\x09getNodesFrom: aCollection;\x0a\x09\x09yourself",
|
1099
|
+
messageSends: ["theClass:", "level:", "getNodesFrom:", "yourself", "new"],
|
1100
|
+
referencedClasses: []
|
1101
|
+
}),
|
1102
|
+
smalltalk.ClassSorterNode.klass);
|
955
1103
|
|
956
1104
|
|