Kernel-Classes.st 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. Smalltalk current createPackage: 'Kernel-Classes'!
  2. Object subclass: #Behavior
  3. instanceVariableNames: ''
  4. package: 'Kernel-Classes'!
  5. !Behavior commentStamp!
  6. I am the superclass of all class objects.
  7. I define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).
  8. My instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,
  9. and hold the method dictionary that's associated with each class.
  10. I also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.!
  11. !Behavior methodsFor: 'accessing'!
  12. >> aString
  13. ^ self methodAt: aString
  14. !
  15. allInstanceVariableNames
  16. | result |
  17. result := self instanceVariableNames copy.
  18. self superclass ifNotNil: [
  19. result addAll: self superclass allInstanceVariableNames].
  20. ^result
  21. !
  22. allSelectors
  23. ^ self allSuperclasses
  24. inject: self selectors
  25. into: [ :acc :each | acc addAll: each selectors; yourself ]
  26. !
  27. allSubclasses
  28. "Answer an collection of the receiver's and the receiver's descendent's subclasses. "
  29. | subclasses index |
  30. subclasses := self subclasses.
  31. index := 1.
  32. [ index > subclasses size ]
  33. whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.
  34. index := index + 1 ].
  35. ^ subclasses
  36. !
  37. allSuperclasses
  38. self superclass ifNil: [ ^ #() ].
  39. ^ (OrderedCollection with: self superclass)
  40. addAll: self superclass allSuperclasses;
  41. yourself
  42. !
  43. comment
  44. ^(self basicAt: 'comment') ifNil: ['']
  45. !
  46. comment: aString
  47. self basicAt: 'comment' put: aString.
  48. SystemAnnouncer current
  49. announce: (ClassCommentChanged new
  50. theClass: self;
  51. yourself)
  52. !
  53. commentStamp
  54. ^ClassCommentReader new
  55. class: self;
  56. yourself
  57. !
  58. commentStamp: aStamp prior: prior
  59. ^self commentStamp
  60. !
  61. definition
  62. ^ ''
  63. !
  64. instanceVariableNames
  65. <return self.iVarNames>
  66. !
  67. lookupSelector: selector
  68. "Look up the given selector in my methodDictionary.
  69. Return the corresponding method if found.
  70. Otherwise chase the superclass chain and try again.
  71. Return nil if no method is found."
  72. | lookupClass |
  73. lookupClass := self.
  74. [ lookupClass = nil ] whileFalse: [
  75. (lookupClass includesSelector: selector)
  76. ifTrue: [ ^ lookupClass methodAt: selector ].
  77. lookupClass := lookupClass superclass ].
  78. ^ nil
  79. !
  80. methodAt: aString
  81. ^ self methodDictionary at: aString
  82. !
  83. methodDictionary
  84. <var dict = smalltalk.HashedCollection._new();
  85. var methods = self.methods;
  86. for(var i in methods) {
  87. if(methods[i].selector) {
  88. dict._at_put_(methods[i].selector, methods[i]);
  89. }
  90. };
  91. return dict>
  92. !
  93. methods
  94. ^ self methodDictionary values
  95. !
  96. methodsFor: aString
  97. ^ClassCategoryReader new
  98. class: self category: aString;
  99. yourself
  100. !
  101. methodsFor: aString stamp: aStamp
  102. "Added for compatibility, right now ignores stamp."
  103. ^self methodsFor: aString
  104. !
  105. methodsInProtocol: aString
  106. ^ self methodDictionary values select: [ :each | each protocol = aString ]
  107. !
  108. name
  109. <return self.className || nil>
  110. !
  111. organization
  112. ^ self basicAt: 'organization'
  113. !
  114. ownProtocols
  115. "Answer the protocols of the receiver that are not package extensions"
  116. ^ self protocols reject: [ :each |
  117. each match: '^\*' ]
  118. !
  119. protocols
  120. ^ self organization elements sorted
  121. !
  122. prototype
  123. <return self.fn.prototype>
  124. !
  125. selectors
  126. ^ self methodDictionary keys
  127. !
  128. subclasses
  129. self subclassResponsibility
  130. !
  131. superclass
  132. <return self.superclass || nil>
  133. !
  134. theMetaClass
  135. ^ self class
  136. !
  137. theNonMetaClass
  138. ^ self
  139. !
  140. withAllSubclasses
  141. ^(Array with: self) addAll: self allSubclasses; yourself
  142. ! !
  143. !Behavior methodsFor: 'compiling'!
  144. addCompiledMethod: aMethod
  145. | oldMethod announcement |
  146. oldMethod := self methodDictionary
  147. at: aMethod selector
  148. ifAbsent: [ nil ].
  149. (self protocols includes: aMethod protocol)
  150. ifFalse: [ self organization addElement: aMethod protocol ].
  151. self basicAddCompiledMethod: aMethod.
  152. announcement := oldMethod
  153. ifNil: [
  154. MethodAdded new
  155. method: aMethod;
  156. yourself ]
  157. ifNotNil: [
  158. MethodModified new
  159. oldMethod: oldMethod;
  160. method: aMethod;
  161. yourself ].
  162. SystemAnnouncer current
  163. announce: announcement
  164. !
  165. compile: aString
  166. ^ self compile: aString category: ''
  167. !
  168. compile: aString category: anotherString
  169. ^ Compiler new
  170. install: aString
  171. forClass: self
  172. category: anotherString
  173. !
  174. recompile
  175. ^ Compiler new recompile: self
  176. !
  177. removeCompiledMethod: aMethod
  178. self basicRemoveCompiledMethod: aMethod.
  179. self methods
  180. detect: [ :each | each protocol = aMethod protocol ]
  181. ifNone: [ self organization removeElement: aMethod protocol ].
  182. SystemAnnouncer current
  183. announce: (MethodRemoved new
  184. method: aMethod;
  185. yourself)
  186. ! !
  187. !Behavior methodsFor: 'enumerating'!
  188. allSubclassesDo: aBlock
  189. "Evaluate the argument, aBlock, for each of the receiver's subclasses."
  190. self allSubclasses do: [ :each |
  191. aBlock value: each ]
  192. !
  193. protocolsDo: aBlock
  194. "Execute aBlock for each method category with
  195. its collection of methods in the sort order of category name."
  196. | methodsByCategory |
  197. methodsByCategory := HashedCollection new.
  198. self methodDictionary values do: [:m |
  199. (methodsByCategory at: m category ifAbsentPut: [Array new])
  200. add: m].
  201. self protocols do: [:category |
  202. aBlock value: category value: (methodsByCategory at: category)]
  203. ! !
  204. !Behavior methodsFor: 'instance creation'!
  205. basicNew
  206. <return new self.fn()>
  207. !
  208. new
  209. ^self basicNew initialize
  210. ! !
  211. !Behavior methodsFor: 'private'!
  212. basicAddCompiledMethod: aMethod
  213. <smalltalk.addMethod(aMethod, self)>
  214. !
  215. basicRemoveCompiledMethod: aMethod
  216. <smalltalk.removeMethod(aMethod,self)>
  217. ! !
  218. !Behavior methodsFor: 'testing'!
  219. canUnderstand: aSelector
  220. ^(self methodDictionary keys includes: aSelector asString) or: [
  221. self superclass notNil and: [self superclass canUnderstand: aSelector]]
  222. !
  223. includesBehavior: aClass
  224. ^ self == aClass or: [
  225. self inheritsFrom: aClass ]
  226. !
  227. includesSelector: aString
  228. ^ self methodDictionary includesKey: aString
  229. !
  230. inheritsFrom: aClass
  231. self superclass ifNil: [ ^ false ].
  232. ^ aClass == self superclass or: [
  233. self superclass inheritsFrom: aClass ]
  234. !
  235. isBehavior
  236. ^ true
  237. ! !
  238. Behavior subclass: #Class
  239. instanceVariableNames: ''
  240. package: 'Kernel-Classes'!
  241. !Class commentStamp!
  242. I am __the__ class object.
  243. My instances are the classes of the system.
  244. Class creation is done throught a `ClassBuilder` instance.!
  245. !Class methodsFor: 'accessing'!
  246. category
  247. ^self package ifNil: ['Unclassified'] ifNotNil: [self package name]
  248. !
  249. definition
  250. ^ String streamContents: [ :stream |
  251. stream
  252. nextPutAll: self superclass asString;
  253. nextPutAll: ' subclass: #';
  254. nextPutAll: self name;
  255. nextPutAll: String lf, String tab;
  256. nextPutAll: 'instanceVariableNames: '''.
  257. self instanceVariableNames
  258. do: [ :each | stream nextPutAll: each ]
  259. separatedBy: [ stream nextPutAll: ' ' ].
  260. stream
  261. nextPutAll: '''', String lf, String tab;
  262. nextPutAll: 'package: ''';
  263. nextPutAll: self category;
  264. nextPutAll: '''' ]
  265. !
  266. package
  267. ^ self basicAt: 'pkg'
  268. !
  269. package: aPackage
  270. | oldPackage |
  271. self package = aPackage ifTrue: [ ^ self ].
  272. oldPackage := self package.
  273. self basicAt: 'pkg' put: aPackage.
  274. oldPackage organization removeElement: self.
  275. aPackage organization addElement: self.
  276. SystemAnnouncer current announce: (ClassMoved new
  277. theClass: self;
  278. oldPackage: oldPackage;
  279. yourself)
  280. !
  281. rename: aString
  282. ClassBuilder new renameClass: self to: aString
  283. !
  284. subclasses
  285. <return self.subclasses._copy()>
  286. ! !
  287. !Class methodsFor: 'class creation'!
  288. subclass: aString instanceVariableNames: anotherString
  289. "Kept for compatibility."
  290. ^self subclass: aString instanceVariableNames: anotherString package: nil
  291. !
  292. subclass: aString instanceVariableNames: aString2 category: aString3
  293. "Kept for compatibility."
  294. self deprecatedAPI.
  295. ^self subclass: aString instanceVariableNames: aString2 package: aString3
  296. !
  297. subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3
  298. "Just ignore class variables and pools. Added for compatibility."
  299. ^self subclass: aString instanceVariableNames: aString2 package: aString3
  300. !
  301. subclass: aString instanceVariableNames: aString2 package: aString3
  302. ^ClassBuilder new
  303. superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
  304. ! !
  305. !Class methodsFor: 'converting'!
  306. asJavascript
  307. ^ 'smalltalk.', self name
  308. ! !
  309. !Class methodsFor: 'printing'!
  310. printOn: aStream
  311. aStream nextPutAll: self name
  312. ! !
  313. !Class methodsFor: 'testing'!
  314. isClass
  315. ^true
  316. ! !
  317. Behavior subclass: #Metaclass
  318. instanceVariableNames: ''
  319. package: 'Kernel-Classes'!
  320. !Metaclass commentStamp!
  321. I am the root of the class hierarchy.
  322. My instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.!
  323. !Metaclass methodsFor: 'accessing'!
  324. definition
  325. ^ String streamContents: [ :stream |
  326. stream
  327. nextPutAll: self asString;
  328. nextPutAll: ' instanceVariableNames: '''.
  329. self instanceVariableNames
  330. do: [ :each | stream nextPutAll: each ]
  331. separatedBy: [ stream nextPutAll: ' ' ].
  332. stream nextPutAll: '''' ]
  333. !
  334. instanceClass
  335. <return self.instanceClass>
  336. !
  337. instanceVariableNames: aCollection
  338. ClassBuilder new
  339. class: self instanceVariableNames: aCollection
  340. !
  341. subclasses
  342. ^ (self instanceClass subclasses
  343. select: [ :each | each isMetaclass not ])
  344. collect: [ :each | each theMetaClass ]
  345. !
  346. theMetaClass
  347. ^ self
  348. !
  349. theNonMetaClass
  350. ^ self instanceClass
  351. ! !
  352. !Metaclass methodsFor: 'converting'!
  353. asJavascript
  354. ^ 'smalltalk.', self instanceClass name, '.klass'
  355. ! !
  356. !Metaclass methodsFor: 'printing'!
  357. printOn: aStream
  358. aStream
  359. nextPutAll: self instanceClass name;
  360. nextPutAll: ' class'
  361. ! !
  362. !Metaclass methodsFor: 'testing'!
  363. isMetaclass
  364. ^true
  365. ! !
  366. Object subclass: #ClassBuilder
  367. instanceVariableNames: ''
  368. package: 'Kernel-Classes'!
  369. !ClassBuilder commentStamp!
  370. I am responsible for compiling new classes or modifying existing classes in the system.
  371. Rather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.!
  372. !ClassBuilder methodsFor: 'accessing'!
  373. instanceVariableNamesFor: aString
  374. ^(aString tokenize: ' ') reject: [ :each | each isEmpty ]
  375. ! !
  376. !ClassBuilder methodsFor: 'class definition'!
  377. addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName
  378. | theClass thePackage |
  379. theClass := Smalltalk current at: className.
  380. thePackage := self createPackageNamed: packageName.
  381. theClass ifNotNil: [
  382. theClass package: thePackage.
  383. theClass superclass == aClass ifFalse: [
  384. ^ self
  385. migrateClassNamed: className
  386. superclass: aClass
  387. instanceVariableNames: aCollection
  388. package: packageName ] ].
  389. ^ self
  390. basicAddSubclassOf: aClass
  391. named: className
  392. instanceVariableNames: aCollection
  393. package: packageName
  394. !
  395. class: aClass instanceVariableNames: ivarNames
  396. self basicClass: aClass instanceVariableNames: ivarNames.
  397. self setupClass: aClass.
  398. SystemAnnouncer current
  399. announce: (ClassDefinitionChanged new
  400. theClass: aClass;
  401. yourself)
  402. !
  403. superclass: aClass subclass: className
  404. ^self superclass: aClass subclass: className instanceVariableNames: '' package: nil
  405. !
  406. superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName
  407. | newClass |
  408. newClass := self addSubclassOf: aClass
  409. named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)
  410. package: (packageName ifNil: ['unclassified']).
  411. self setupClass: newClass.
  412. SystemAnnouncer current
  413. announce: (ClassAdded new
  414. theClass: newClass;
  415. yourself).
  416. ^newClass
  417. ! !
  418. !ClassBuilder methodsFor: 'class migration'!
  419. migrateClass: aClass superclass: anotherClass
  420. ^ self
  421. migrateClassNamed: aClass name
  422. superclass: anotherClass
  423. instanceVariableNames: aClass instanceVariableNames
  424. package: aClass package name
  425. !
  426. migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName
  427. | oldClass newClass tmp |
  428. tmp := 'new*', className.
  429. oldClass := Smalltalk current at: className.
  430. newClass := self
  431. addSubclassOf: aClass
  432. named: tmp
  433. instanceVariableNames: aCollection
  434. package: packageName.
  435. self basicSwapClassNames: oldClass with: newClass.
  436. [ self copyClass: oldClass to: newClass ]
  437. on: Error
  438. do: [ :exception |
  439. self
  440. basicSwapClassNames: oldClass with: newClass;
  441. basicRemoveClass: newClass.
  442. exception signal ].
  443. self
  444. rawRenameClass: oldClass to: tmp;
  445. rawRenameClass: newClass to: className.
  446. oldClass subclasses
  447. do: [ :each | self migrateClass: each superclass: newClass ]
  448. displayingProgress: 'Recompiling ', newClass name, '...'.
  449. self basicRemoveClass: oldClass.
  450. SystemAnnouncer current announce: (ClassMigrated new
  451. theClass: newClass;
  452. oldClass: oldClass;
  453. yourself).
  454. ^newClass
  455. !
  456. renameClass: aClass to: className
  457. self basicRenameClass: aClass to: className.
  458. "Recompile the class to fix potential issues with super sends"
  459. aClass recompile.
  460. SystemAnnouncer current
  461. announce: (ClassRenamed new
  462. theClass: aClass;
  463. yourself)
  464. ! !
  465. !ClassBuilder methodsFor: 'copying'!
  466. copyClass: aClass named: className
  467. | newClass |
  468. newClass := self
  469. addSubclassOf: aClass superclass
  470. named: className
  471. instanceVariableNames: aClass instanceVariableNames
  472. package: aClass package name.
  473. self copyClass: aClass to: newClass.
  474. SystemAnnouncer current
  475. announce: (ClassAdded new
  476. theClass: newClass;
  477. yourself).
  478. ^newClass
  479. !
  480. copyClass: aClass to: anotherClass
  481. anotherClass comment: aClass comment.
  482. aClass methodDictionary values do: [ :each |
  483. Compiler new install: each source forClass: anotherClass category: each category ].
  484. self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.
  485. aClass class methodDictionary values do: [ :each |
  486. Compiler new install: each source forClass: anotherClass class category: each category ].
  487. self setupClass: anotherClass
  488. ! !
  489. !ClassBuilder methodsFor: 'method definition'!
  490. installMethod: aCompiledMethod forClass: aBehavior category: aString
  491. aCompiledMethod category: aString.
  492. aBehavior addCompiledMethod: aCompiledMethod.
  493. self setupClass: aBehavior.
  494. ^aCompiledMethod
  495. ! !
  496. !ClassBuilder methodsFor: 'private'!
  497. basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
  498. <
  499. smalltalk.addClass(aString, aClass, aCollection, packageName);
  500. return smalltalk[aString]
  501. >
  502. !
  503. basicClass: aClass instanceVariableNames: aString
  504. self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)
  505. !
  506. basicClass: aClass instanceVariables: aCollection
  507. aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].
  508. aClass basicAt: 'iVarNames' put: aCollection
  509. !
  510. basicRemoveClass: aClass
  511. <smalltalk.removeClass(aClass)>
  512. !
  513. basicRenameClass: aClass to: aString
  514. <
  515. smalltalk[aString] = aClass;
  516. delete smalltalk[aClass.className];
  517. aClass.className = aString;
  518. >
  519. !
  520. basicSwapClassNames: aClass with: anotherClass
  521. <
  522. var tmp = aClass.className;
  523. aClass.className = anotherClass.className;
  524. anotherClass.className = tmp;
  525. >
  526. !
  527. createPackageNamed: aString
  528. ^ Package named: aString ifAbsent: [
  529. Smalltalk current createDefaultPackage: aString ]
  530. !
  531. rawRenameClass: aClass to: aString
  532. <
  533. smalltalk[aString] = aClass;
  534. >
  535. ! !
  536. !ClassBuilder methodsFor: 'public'!
  537. setupClass: aClass
  538. <smalltalk.init(aClass);>
  539. ! !
  540. Object subclass: #ClassCategoryReader
  541. instanceVariableNames: 'class category'
  542. package: 'Kernel-Classes'!
  543. !ClassCategoryReader commentStamp!
  544. I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.!
  545. !ClassCategoryReader methodsFor: 'accessing'!
  546. class: aClass category: aString
  547. class := aClass.
  548. category := aString
  549. ! !
  550. !ClassCategoryReader methodsFor: 'fileIn'!
  551. scanFrom: aChunkParser
  552. | chunk |
  553. [chunk := aChunkParser nextChunk.
  554. chunk isEmpty] whileFalse: [
  555. self compileMethod: chunk].
  556. ClassBuilder new setupClass: class
  557. ! !
  558. !ClassCategoryReader methodsFor: 'initialization'!
  559. initialize
  560. super initialize.
  561. ! !
  562. !ClassCategoryReader methodsFor: 'private'!
  563. compileMethod: aString
  564. Compiler new install: aString forClass: class category: category
  565. ! !
  566. Object subclass: #ClassCommentReader
  567. instanceVariableNames: 'class'
  568. package: 'Kernel-Classes'!
  569. !ClassCommentReader commentStamp!
  570. I provide a mechanism for retrieving class comments stored on a file.
  571. See also `ClassCategoryReader`.!
  572. !ClassCommentReader methodsFor: 'accessing'!
  573. class: aClass
  574. class := aClass
  575. ! !
  576. !ClassCommentReader methodsFor: 'fileIn'!
  577. scanFrom: aChunkParser
  578. | chunk |
  579. chunk := aChunkParser nextChunk.
  580. chunk isEmpty ifFalse: [
  581. self setComment: chunk].
  582. ! !
  583. !ClassCommentReader methodsFor: 'initialization'!
  584. initialize
  585. super initialize.
  586. ! !
  587. !ClassCommentReader methodsFor: 'private'!
  588. setComment: aString
  589. class comment: aString
  590. ! !
  591. Object subclass: #ClassSorterNode
  592. instanceVariableNames: 'theClass level nodes'
  593. package: 'Kernel-Classes'!
  594. !ClassSorterNode commentStamp!
  595. I provide an algorithm for sorting classes alphabetically.
  596. See [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.!
  597. !ClassSorterNode methodsFor: 'accessing'!
  598. getNodesFrom: aCollection
  599. | children others |
  600. children := #().
  601. others := #().
  602. aCollection do: [:each |
  603. (each superclass = self theClass)
  604. ifTrue: [children add: each]
  605. ifFalse: [others add: each]].
  606. nodes:= children collect: [:each |
  607. ClassSorterNode on: each classes: others level: self level + 1]
  608. !
  609. level
  610. ^level
  611. !
  612. level: anInteger
  613. level := anInteger
  614. !
  615. nodes
  616. ^nodes
  617. !
  618. theClass
  619. ^theClass
  620. !
  621. theClass: aClass
  622. theClass := aClass
  623. ! !
  624. !ClassSorterNode methodsFor: 'visiting'!
  625. traverseClassesWith: aCollection
  626. "sort classes alphabetically Issue #143"
  627. aCollection add: self theClass.
  628. (self nodes sorted: [:a :b | a theClass name <= b theClass name ]) do: [:aNode |
  629. aNode traverseClassesWith: aCollection ].
  630. ! !
  631. !ClassSorterNode class methodsFor: 'instance creation'!
  632. on: aClass classes: aCollection level: anInteger
  633. ^self new
  634. theClass: aClass;
  635. level: anInteger;
  636. getNodesFrom: aCollection;
  637. yourself
  638. ! !