changeset 23621 | f19f56a9e038 |
parent 22846 | 929c112ef2e7 |
child 23622 | ab63a74e52c0 |
23620:96d2b2517324 | 23621:f19f56a9e038 |
---|---|
85 |
85 |
86 !InlineObject class methodsFor:'prototype access'! |
86 !InlineObject class methodsFor:'prototype access'! |
87 |
87 |
88 prototype |
88 prototype |
89 ^ InlineObjectPrototype |
89 ^ InlineObjectPrototype |
90 ! |
|
91 |
|
92 slotNames:names values:slotValues |
|
93 "return a new inline object given slot names and slot values" |
|
94 |
|
95 |subclass inst| |
|
96 |
|
97 Class withoutUpdatingChangesDo:[ |
|
98 subclass := self |
|
99 subclass:#someInlineObject |
|
100 instanceVariableNames:names |
|
101 classVariableNames:nil |
|
102 poolDictionaries:nil |
|
103 category:nil |
|
104 inEnvironment:nil. |
|
105 names do:[:each | |
|
106 subclass compile:('%1 ^ %1' bindWith:each) |
|
107 categorized:'accessing'. |
|
108 subclass compile:('%1:arg %1 := arg.' bindWith:each) |
|
109 categorized:'accessing'. |
|
110 ]. |
|
111 ]. |
|
112 inst := (Array withAll:slotValues) changeClassTo:subclass. |
|
113 ^ inst |
|
114 |
|
115 " |
|
116 InlineObject slotNames:#('foo' 'bar' 'baz') values:#(1 2 3) |
|
117 " |
|
118 |
|
119 "Created: / 21-01-2019 / 13:10:14 / Claus Gittinger" |
|
120 ! |
|
121 |
|
122 slotNamesAndValues:namesAndValues |
|
123 "return a new inline object given slot names and slot values as alternating elements |
|
124 in the argument, namesAndValues" |
|
125 |
|
126 ^ self slotNames:(namesAndValues keysAndValuesSelect:[:idx :val | idx odd]) |
|
127 values:(namesAndValues keysAndValuesSelect:[:idx :val | idx even]) |
|
128 |
|
129 " |
|
130 InlineObject slotNamesAndValues:#('foo' 10 'bar' 20 'baz' 30) |
|
131 " |
|
132 |
|
133 "Created: / 21-01-2019 / 13:15:46 / Claus Gittinger" |
|
90 ! ! |
134 ! ! |
91 |
135 |
92 !InlineObject methodsFor:'printing & storing'! |
136 !InlineObject methodsFor:'printing & storing'! |
93 |
137 |
94 storeOn:aStream |
138 storeOn:aStream |
130 |
174 |
131 !InlineObject::InlineObjectPrototype methodsFor:'accessing'! |
175 !InlineObject::InlineObjectPrototype methodsFor:'accessing'! |
132 |
176 |
133 i1 |
177 i1 |
134 ^ i1 |
178 ^ i1 |
179 |
|
180 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
135 ! |
181 ! |
136 |
182 |
137 i10 |
183 i10 |
138 ^ i10 |
184 ^ i10 |
139 ! |
185 ! |
222 i19 := something. |
268 i19 := something. |
223 ! |
269 ! |
224 |
270 |
225 i1:something |
271 i1:something |
226 i1 := something. |
272 i1 := something. |
273 |
|
274 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
227 ! |
275 ! |
228 |
276 |
229 i2 |
277 i2 |
230 ^ i2 |
278 ^ i2 |
279 |
|
280 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
231 ! |
281 ! |
232 |
282 |
233 i20 |
283 i20 |
234 ^ i20 |
284 ^ i20 |
235 ! |
285 ! |
310 i29 := something. |
360 i29 := something. |
311 ! |
361 ! |
312 |
362 |
313 i2:something |
363 i2:something |
314 i2 := something. |
364 i2 := something. |
365 |
|
366 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
315 ! |
367 ! |
316 |
368 |
317 i3 |
369 i3 |
318 ^ i3 |
370 ^ i3 |
371 |
|
372 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
319 ! |
373 ! |
320 |
374 |
321 i30 |
375 i30 |
322 ^ i30 |
376 ^ i30 |
323 ! |
377 ! |
398 i39 := something. |
452 i39 := something. |
399 ! |
453 ! |
400 |
454 |
401 i3:something |
455 i3:something |
402 i3 := something. |
456 i3 := something. |
457 |
|
458 "Created: / 20-01-2019 / 14:49:52 / Claus Gittinger" |
|
403 ! |
459 ! |
404 |
460 |
405 i4 |
461 i4 |
406 ^ i4 |
462 ^ i4 |
407 ! |
463 ! |