1
0

Kernel-Classes.js 73 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832
  1. smalltalk.addPackage('Kernel-Classes', {});
  2. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  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. smalltalk.addMethod(
  5. "_addCompiledMethod_",
  6. smalltalk.method({
  7. selector: "addCompiledMethod:",
  8. category: 'compiling',
  9. fn: function (aMethod){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) { var $1,$2;
  12. _st(self)._basicAddCompiledMethod_(aMethod);
  13. $1=_st((smalltalk.MethodAdded || MethodAdded))._new();
  14. _st($1)._theClass_(self);
  15. _st($1)._method_(aMethod);
  16. $2=_st($1)._yourself();
  17. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  18. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  19. args: ["aMethod"],
  20. source: "addCompiledMethod: aMethod\x0a\x09self basicAddCompiledMethod: aMethod.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodAdded new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  21. messageSends: ["basicAddCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"],
  22. referencedClasses: ["MethodAdded", "SystemAnnouncer"]
  23. }),
  24. smalltalk.Behavior);
  25. smalltalk.addMethod(
  26. "_allInstanceVariableNames",
  27. smalltalk.method({
  28. selector: "allInstanceVariableNames",
  29. category: 'accessing',
  30. fn: function (){
  31. var self=this;
  32. var result;
  33. return smalltalk.withContext(function($ctx1) { var $1,$2;
  34. result=_st(_st(self)._instanceVariableNames())._copy();
  35. $1=_st(self)._superclass();
  36. if(($receiver = $1) == nil || $receiver == undefined){
  37. $1;
  38. } else {
  39. _st(result)._addAll_(_st(_st(self)._superclass())._allInstanceVariableNames());
  40. };
  41. $2=result;
  42. return $2;
  43. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result}, smalltalk.Behavior)})},
  44. args: [],
  45. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09 result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  46. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "addAll:", "allInstanceVariableNames", "superclass"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.Behavior);
  50. smalltalk.addMethod(
  51. "_allSubclasses",
  52. smalltalk.method({
  53. selector: "allSubclasses",
  54. category: 'accessing',
  55. fn: function (){
  56. var self=this;
  57. var result;
  58. return smalltalk.withContext(function($ctx1) { var $1;
  59. result=_st(self)._subclasses();
  60. _st(_st(self)._subclasses())._do_((function(each){
  61. return smalltalk.withContext(function($ctx2) { return _st(result)._addAll_(_st(each)._allSubclasses());
  62. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  63. $1=result;
  64. return $1;
  65. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{result:result}, smalltalk.Behavior)})},
  66. args: [],
  67. source: "allSubclasses\x0a\x09| result |\x0a\x09result := self subclasses.\x0a\x09self subclasses do: [:each |\x0a\x09 result addAll: each allSubclasses].\x0a\x09^result",
  68. messageSends: ["subclasses", "do:", "addAll:", "allSubclasses"],
  69. referencedClasses: []
  70. }),
  71. smalltalk.Behavior);
  72. smalltalk.addMethod(
  73. "_allSuperclasses",
  74. smalltalk.method({
  75. selector: "allSuperclasses",
  76. category: 'accessing',
  77. fn: function (){
  78. var self=this;
  79. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$2;
  80. $1=_st(self)._superclass();
  81. if(($receiver = $1) == nil || $receiver == undefined){
  82. return [];
  83. } else {
  84. $1;
  85. };
  86. $3=_st((smalltalk.OrderedCollection || OrderedCollection))._with_(_st(self)._superclass());
  87. _st($3)._addAll_(_st(_st(self)._superclass())._allSuperclasses());
  88. $4=_st($3)._yourself();
  89. $2=$4;
  90. return $2;
  91. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{}, smalltalk.Behavior)})},
  92. args: [],
  93. source: "allSuperclasses\x0a\x09\x0a self superclass ifNil: [ ^ #() ].\x0a \x0a\x09^ (OrderedCollection with: self superclass) \x0a \x09addAll: self superclass allSuperclasses;\x0a yourself",
  94. messageSends: ["ifNil:", "superclass", "addAll:", "allSuperclasses", "with:", "yourself"],
  95. referencedClasses: ["OrderedCollection"]
  96. }),
  97. smalltalk.Behavior);
  98. smalltalk.addMethod(
  99. "_basicAddCompiledMethod_",
  100. smalltalk.method({
  101. selector: "basicAddCompiledMethod:",
  102. category: 'private',
  103. fn: function (aMethod){
  104. var self=this;
  105. return smalltalk.withContext(function($ctx1) { smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self);
  106. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  107. args: ["aMethod"],
  108. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>",
  109. messageSends: [],
  110. referencedClasses: []
  111. }),
  112. smalltalk.Behavior);
  113. smalltalk.addMethod(
  114. "_basicNew",
  115. smalltalk.method({
  116. selector: "basicNew",
  117. category: 'instance creation',
  118. fn: function (){
  119. var self=this;
  120. return smalltalk.withContext(function($ctx1) { return new self.fn();
  121. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Behavior)})},
  122. args: [],
  123. source: "basicNew\x0a\x09<return new self.fn()>",
  124. messageSends: [],
  125. referencedClasses: []
  126. }),
  127. smalltalk.Behavior);
  128. smalltalk.addMethod(
  129. "_basicRemoveCompiledMethod_",
  130. smalltalk.method({
  131. selector: "basicRemoveCompiledMethod:",
  132. category: 'private',
  133. fn: function (aMethod){
  134. var self=this;
  135. return smalltalk.withContext(function($ctx1) {
  136. smalltalk.removeMethod(aMethod)
  137. smalltalk.init(self);
  138. ;
  139. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  140. args: ["aMethod"],
  141. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<\x0a \x09smalltalk.removeMethod(aMethod)\x0a\x09\x09smalltalk.init(self);\x0a >",
  142. messageSends: [],
  143. referencedClasses: []
  144. }),
  145. smalltalk.Behavior);
  146. smalltalk.addMethod(
  147. "_canUnderstand_",
  148. smalltalk.method({
  149. selector: "canUnderstand:",
  150. category: 'testing',
  151. fn: function (aSelector){
  152. var self=this;
  153. return smalltalk.withContext(function($ctx1) { var $1;
  154. $1=_st(_st(_st(_st(self)._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  155. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(self)._superclass())._notNil())._and_((function(){
  156. return smalltalk.withContext(function($ctx3) { return _st(_st(self)._superclass())._canUnderstand_(aSelector);
  157. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  159. return $1;
  160. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector}, smalltalk.Behavior)})},
  161. args: ["aSelector"],
  162. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  163. messageSends: ["or:", "and:", "canUnderstand:", "superclass", "notNil", "includes:", "asString", "keys", "methodDictionary"],
  164. referencedClasses: []
  165. }),
  166. smalltalk.Behavior);
  167. smalltalk.addMethod(
  168. "_comment",
  169. smalltalk.method({
  170. selector: "comment",
  171. category: 'accessing',
  172. fn: function (){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) { var $2,$1;
  175. $2=_st(self)._basicAt_("comment");
  176. if(($receiver = $2) == nil || $receiver == undefined){
  177. $1="";
  178. } else {
  179. $1=$2;
  180. };
  181. return $1;
  182. }, function($ctx1) {$ctx1.fill(self,"comment",{}, smalltalk.Behavior)})},
  183. args: [],
  184. source: "comment\x0a ^(self basicAt: 'comment') ifNil: ['']",
  185. messageSends: ["ifNil:", "basicAt:"],
  186. referencedClasses: []
  187. }),
  188. smalltalk.Behavior);
  189. smalltalk.addMethod(
  190. "_comment_",
  191. smalltalk.method({
  192. selector: "comment:",
  193. category: 'accessing',
  194. fn: function (aString){
  195. var self=this;
  196. return smalltalk.withContext(function($ctx1) { var $1,$2;
  197. _st(self)._basicAt_put_("comment",aString);
  198. $1=_st((smalltalk.ClassCommentChanged || ClassCommentChanged))._new();
  199. _st($1)._theClass_(self);
  200. $2=_st($1)._yourself();
  201. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  202. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString}, smalltalk.Behavior)})},
  203. args: ["aString"],
  204. source: "comment: aString\x0a self basicAt: 'comment' put: aString.\x0a SystemAnnouncer current\x0a \x09announce: (ClassCommentChanged new\x0a \x09theClass: self;\x0a yourself)",
  205. messageSends: ["basicAt:put:", "announce:", "theClass:", "new", "yourself", "current"],
  206. referencedClasses: ["ClassCommentChanged", "SystemAnnouncer"]
  207. }),
  208. smalltalk.Behavior);
  209. smalltalk.addMethod(
  210. "_commentStamp",
  211. smalltalk.method({
  212. selector: "commentStamp",
  213. category: 'accessing',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  217. $2=_st((smalltalk.ClassCommentReader || ClassCommentReader))._new();
  218. _st($2)._class_(self);
  219. $3=_st($2)._yourself();
  220. $1=$3;
  221. return $1;
  222. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{}, smalltalk.Behavior)})},
  223. args: [],
  224. source: "commentStamp\x0a ^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  225. messageSends: ["class:", "new", "yourself"],
  226. referencedClasses: ["ClassCommentReader"]
  227. }),
  228. smalltalk.Behavior);
  229. smalltalk.addMethod(
  230. "_commentStamp_prior_",
  231. smalltalk.method({
  232. selector: "commentStamp:prior:",
  233. category: 'accessing',
  234. fn: function (aStamp,prior){
  235. var self=this;
  236. return smalltalk.withContext(function($ctx1) { var $1;
  237. $1=_st(self)._commentStamp();
  238. return $1;
  239. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior}, smalltalk.Behavior)})},
  240. args: ["aStamp", "prior"],
  241. source: "commentStamp: aStamp prior: prior\x0a ^self commentStamp",
  242. messageSends: ["commentStamp"],
  243. referencedClasses: []
  244. }),
  245. smalltalk.Behavior);
  246. smalltalk.addMethod(
  247. "_compile_",
  248. smalltalk.method({
  249. selector: "compile:",
  250. category: 'compiling',
  251. fn: function (aString){
  252. var self=this;
  253. return smalltalk.withContext(function($ctx1) { _st(self)._compile_category_(aString,"");
  254. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.Behavior)})},
  255. args: ["aString"],
  256. source: "compile: aString\x0a\x09self compile: aString category: ''",
  257. messageSends: ["compile:category:"],
  258. referencedClasses: []
  259. }),
  260. smalltalk.Behavior);
  261. smalltalk.addMethod(
  262. "_compile_category_",
  263. smalltalk.method({
  264. selector: "compile:category:",
  265. category: 'compiling',
  266. fn: function (aString,anotherString){
  267. var self=this;
  268. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(aString,self,anotherString);
  269. return self}, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString}, smalltalk.Behavior)})},
  270. args: ["aString", "anotherString"],
  271. source: "compile: aString category: anotherString\x0a\x09Compiler new\x0a\x09\x09install: aString \x0a forClass: self \x0a category: anotherString",
  272. messageSends: ["install:forClass:category:", "new"],
  273. referencedClasses: ["Compiler"]
  274. }),
  275. smalltalk.Behavior);
  276. smalltalk.addMethod(
  277. "_definition",
  278. smalltalk.method({
  279. selector: "definition",
  280. category: 'accessing',
  281. fn: function (){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) { return "";
  284. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Behavior)})},
  285. args: [],
  286. source: "definition\x0a\x09^ ''",
  287. messageSends: [],
  288. referencedClasses: []
  289. }),
  290. smalltalk.Behavior);
  291. smalltalk.addMethod(
  292. "_includesSelector_",
  293. smalltalk.method({
  294. selector: "includesSelector:",
  295. category: 'testing',
  296. fn: function (aSymbol){
  297. var self=this;
  298. return smalltalk.withContext(function($ctx1) { var $1;
  299. $1=_st(_st(self)._methodDictionary())._includesKey_(_st(aSymbol)._asString());
  300. return $1;
  301. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aSymbol:aSymbol}, smalltalk.Behavior)})},
  302. args: ["aSymbol"],
  303. source: "includesSelector: aSymbol\x0a\x09^ self methodDictionary includesKey: aSymbol asString",
  304. messageSends: ["includesKey:", "asString", "methodDictionary"],
  305. referencedClasses: []
  306. }),
  307. smalltalk.Behavior);
  308. smalltalk.addMethod(
  309. "_inheritsFrom_",
  310. smalltalk.method({
  311. selector: "inheritsFrom:",
  312. category: 'testing',
  313. fn: function (aClass){
  314. var self=this;
  315. return smalltalk.withContext(function($ctx1) { var $1;
  316. $1=_st(_st(aClass)._allSubclasses())._includes_(self);
  317. return $1;
  318. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass}, smalltalk.Behavior)})},
  319. args: ["aClass"],
  320. source: "inheritsFrom: aClass\x0a\x09^aClass allSubclasses includes: self",
  321. messageSends: ["includes:", "allSubclasses"],
  322. referencedClasses: []
  323. }),
  324. smalltalk.Behavior);
  325. smalltalk.addMethod(
  326. "_instanceVariableNames",
  327. smalltalk.method({
  328. selector: "instanceVariableNames",
  329. category: 'accessing',
  330. fn: function (){
  331. var self=this;
  332. return smalltalk.withContext(function($ctx1) { return self.iVarNames;
  333. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{}, smalltalk.Behavior)})},
  334. args: [],
  335. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  336. messageSends: [],
  337. referencedClasses: []
  338. }),
  339. smalltalk.Behavior);
  340. smalltalk.addMethod(
  341. "_lookupSelector_",
  342. smalltalk.method({
  343. selector: "lookupSelector:",
  344. category: 'accessing',
  345. fn: function (selector){
  346. var self=this;
  347. var lookupClass;
  348. return smalltalk.withContext(function($ctx1) { var $1,$2;
  349. var $early={};
  350. try {
  351. lookupClass=self;
  352. _st((function(){
  353. return smalltalk.withContext(function($ctx2) { return _st(lookupClass).__eq(nil);
  354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  355. return smalltalk.withContext(function($ctx2) { $1=_st(lookupClass)._includesSelector_(selector);
  356. if(smalltalk.assert($1)){
  357. $2=_st(lookupClass)._methodAt_(selector);
  358. throw $early=[$2];
  359. };
  360. lookupClass=_st(lookupClass)._superclass();
  361. return lookupClass;
  362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  363. return nil;
  364. }
  365. catch(e) {if(e===$early)return e[0]; throw e}
  366. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass}, smalltalk.Behavior)})},
  367. args: ["selector"],
  368. source: "lookupSelector: selector\x0a\x09\x22Look up the given selector in my methodDictionary.\x0a\x09Return the corresponding method if found.\x0a\x09Otherwise chase the superclass chain and try again.\x0a\x09Return nil if no method is found.\x22\x0a \x0a\x09| lookupClass |\x0a \x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a \x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  369. messageSends: ["whileFalse:", "ifTrue:", "methodAt:", "includesSelector:", "superclass", "="],
  370. referencedClasses: []
  371. }),
  372. smalltalk.Behavior);
  373. smalltalk.addMethod(
  374. "_methodAt_",
  375. smalltalk.method({
  376. selector: "methodAt:",
  377. category: 'accessing',
  378. fn: function (aSymbol){
  379. var self=this;
  380. return smalltalk.withContext(function($ctx1) { var $1;
  381. $1=_st(_st(self)._methodDictionary())._at_(_st(aSymbol)._asString());
  382. return $1;
  383. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aSymbol:aSymbol}, smalltalk.Behavior)})},
  384. args: ["aSymbol"],
  385. source: "methodAt: aSymbol\x0a\x09^ self methodDictionary at: aSymbol asString",
  386. messageSends: ["at:", "asString", "methodDictionary"],
  387. referencedClasses: []
  388. }),
  389. smalltalk.Behavior);
  390. smalltalk.addMethod(
  391. "_methodDictionary",
  392. smalltalk.method({
  393. selector: "methodDictionary",
  394. category: 'accessing',
  395. fn: function (){
  396. var self=this;
  397. return smalltalk.withContext(function($ctx1) { var dict = smalltalk.HashedCollection._new();
  398. var methods = self.methods;
  399. for(var i in methods) {
  400. if(methods[i].selector) {
  401. dict._at_put_(methods[i].selector, methods[i]);
  402. }
  403. };
  404. return dict;
  405. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{}, smalltalk.Behavior)})},
  406. args: [],
  407. source: "methodDictionary\x0a\x09<var dict = smalltalk.HashedCollection._new();\x0a\x09var methods = self.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>",
  408. messageSends: [],
  409. referencedClasses: []
  410. }),
  411. smalltalk.Behavior);
  412. smalltalk.addMethod(
  413. "_methods",
  414. smalltalk.method({
  415. selector: "methods",
  416. category: 'accessing',
  417. fn: function (){
  418. var self=this;
  419. return smalltalk.withContext(function($ctx1) { var $1;
  420. $1=_st(_st(self)._methodDictionary())._values();
  421. return $1;
  422. }, function($ctx1) {$ctx1.fill(self,"methods",{}, smalltalk.Behavior)})},
  423. args: [],
  424. source: "methods\x0a\x09^ self methodDictionary values",
  425. messageSends: ["values", "methodDictionary"],
  426. referencedClasses: []
  427. }),
  428. smalltalk.Behavior);
  429. smalltalk.addMethod(
  430. "_methodsFor_",
  431. smalltalk.method({
  432. selector: "methodsFor:",
  433. category: 'accessing',
  434. fn: function (aString){
  435. var self=this;
  436. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  437. $2=_st((smalltalk.ClassCategoryReader || ClassCategoryReader))._new();
  438. _st($2)._class_category_(self,aString);
  439. $3=_st($2)._yourself();
  440. $1=$3;
  441. return $1;
  442. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString}, smalltalk.Behavior)})},
  443. args: ["aString"],
  444. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09 class: self category: aString;\x0a\x09 yourself",
  445. messageSends: ["class:category:", "new", "yourself"],
  446. referencedClasses: ["ClassCategoryReader"]
  447. }),
  448. smalltalk.Behavior);
  449. smalltalk.addMethod(
  450. "_methodsFor_stamp_",
  451. smalltalk.method({
  452. selector: "methodsFor:stamp:",
  453. category: 'accessing',
  454. fn: function (aString,aStamp){
  455. var self=this;
  456. return smalltalk.withContext(function($ctx1) { var $1;
  457. $1=_st(self)._methodsFor_(aString);
  458. return $1;
  459. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp}, smalltalk.Behavior)})},
  460. args: ["aString", "aStamp"],
  461. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  462. messageSends: ["methodsFor:"],
  463. referencedClasses: []
  464. }),
  465. smalltalk.Behavior);
  466. smalltalk.addMethod(
  467. "_methodsInProtocol_",
  468. smalltalk.method({
  469. selector: "methodsInProtocol:",
  470. category: 'accessing',
  471. fn: function (aString){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) { var $1;
  474. $1=_st(_st(_st(self)._methodDictionary())._values())._select_((function(each){
  475. return smalltalk.withContext(function($ctx2) { return _st(_st(each)._protocol()).__eq(aString);
  476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  477. return $1;
  478. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString}, smalltalk.Behavior)})},
  479. args: ["aString"],
  480. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  481. messageSends: ["select:", "=", "protocol", "values", "methodDictionary"],
  482. referencedClasses: []
  483. }),
  484. smalltalk.Behavior);
  485. smalltalk.addMethod(
  486. "_name",
  487. smalltalk.method({
  488. selector: "name",
  489. category: 'accessing',
  490. fn: function (){
  491. var self=this;
  492. return smalltalk.withContext(function($ctx1) { return self.className || nil;
  493. return self}, function($ctx1) {$ctx1.fill(self,"name",{}, smalltalk.Behavior)})},
  494. args: [],
  495. source: "name\x0a\x09<return self.className || nil>",
  496. messageSends: [],
  497. referencedClasses: []
  498. }),
  499. smalltalk.Behavior);
  500. smalltalk.addMethod(
  501. "_new",
  502. smalltalk.method({
  503. selector: "new",
  504. category: 'instance creation',
  505. fn: function (){
  506. var self=this;
  507. return smalltalk.withContext(function($ctx1) { var $1;
  508. $1=_st(_st(self)._basicNew())._initialize();
  509. return $1;
  510. }, function($ctx1) {$ctx1.fill(self,"new",{}, smalltalk.Behavior)})},
  511. args: [],
  512. source: "new\x0a\x09^self basicNew initialize",
  513. messageSends: ["initialize", "basicNew"],
  514. referencedClasses: []
  515. }),
  516. smalltalk.Behavior);
  517. smalltalk.addMethod(
  518. "_organization",
  519. smalltalk.method({
  520. selector: "organization",
  521. category: 'accessing',
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) { var $1;
  525. $1=_st(self)._basicAt_("organization");
  526. return $1;
  527. }, function($ctx1) {$ctx1.fill(self,"organization",{}, smalltalk.Behavior)})},
  528. args: [],
  529. source: "organization\x0a\x09^ self basicAt: 'organization'",
  530. messageSends: ["basicAt:"],
  531. referencedClasses: []
  532. }),
  533. smalltalk.Behavior);
  534. smalltalk.addMethod(
  535. "_protocols",
  536. smalltalk.method({
  537. selector: "protocols",
  538. category: 'accessing',
  539. fn: function (){
  540. var self=this;
  541. return smalltalk.withContext(function($ctx1) { var $1;
  542. $1=_st(_st(_st(self)._organization())._elements())._sorted();
  543. return $1;
  544. }, function($ctx1) {$ctx1.fill(self,"protocols",{}, smalltalk.Behavior)})},
  545. args: [],
  546. source: "protocols\x0a ^ self organization elements sorted",
  547. messageSends: ["sorted", "elements", "organization"],
  548. referencedClasses: []
  549. }),
  550. smalltalk.Behavior);
  551. smalltalk.addMethod(
  552. "_protocolsDo_",
  553. smalltalk.method({
  554. selector: "protocolsDo:",
  555. category: 'accessing',
  556. fn: function (aBlock){
  557. var self=this;
  558. var methodsByCategory;
  559. return smalltalk.withContext(function($ctx1) { methodsByCategory=_st((smalltalk.HashedCollection || HashedCollection))._new();
  560. _st(_st(_st(self)._methodDictionary())._values())._do_((function(m){
  561. return smalltalk.withContext(function($ctx2) { return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  562. return smalltalk.withContext(function($ctx3) { return _st((smalltalk.Array || Array))._new();
  563. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})})))._add_(m);
  564. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1)})}));
  565. _st(_st(self)._protocols())._do_((function(category){
  566. return smalltalk.withContext(function($ctx2) { return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  567. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  568. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory}, smalltalk.Behavior)})},
  569. args: ["aBlock"],
  570. 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)]",
  571. messageSends: ["new", "do:", "add:", "at:ifAbsentPut:", "category", "values", "methodDictionary", "value:value:", "at:", "protocols"],
  572. referencedClasses: ["HashedCollection", "Array"]
  573. }),
  574. smalltalk.Behavior);
  575. smalltalk.addMethod(
  576. "_prototype",
  577. smalltalk.method({
  578. selector: "prototype",
  579. category: 'accessing',
  580. fn: function (){
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) { return self.fn.prototype;
  583. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{}, smalltalk.Behavior)})},
  584. args: [],
  585. source: "prototype\x0a\x09<return self.fn.prototype>",
  586. messageSends: [],
  587. referencedClasses: []
  588. }),
  589. smalltalk.Behavior);
  590. smalltalk.addMethod(
  591. "_removeCompiledMethod_",
  592. smalltalk.method({
  593. selector: "removeCompiledMethod:",
  594. category: 'compiling',
  595. fn: function (aMethod){
  596. var self=this;
  597. return smalltalk.withContext(function($ctx1) { var $1,$2;
  598. _st(self)._basicRemoveCompiledMethod_(aMethod);
  599. $1=_st((smalltalk.MethodRemoved || MethodRemoved))._new();
  600. _st($1)._theClass_(self);
  601. _st($1)._method_(aMethod);
  602. $2=_st($1)._yourself();
  603. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  604. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod}, smalltalk.Behavior)})},
  605. args: ["aMethod"],
  606. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a \x0a SystemAnnouncer current\x0a \x09\x09announce: (MethodRemoved new\x0a \x09theClass: self;\x0a method: aMethod;\x0a yourself)",
  607. messageSends: ["basicRemoveCompiledMethod:", "announce:", "theClass:", "new", "method:", "yourself", "current"],
  608. referencedClasses: ["MethodRemoved", "SystemAnnouncer"]
  609. }),
  610. smalltalk.Behavior);
  611. smalltalk.addMethod(
  612. "_selectors",
  613. smalltalk.method({
  614. selector: "selectors",
  615. category: 'accessing',
  616. fn: function (){
  617. var self=this;
  618. return smalltalk.withContext(function($ctx1) { var $1;
  619. $1=_st(_st(self)._methodDictionary())._keys();
  620. return $1;
  621. }, function($ctx1) {$ctx1.fill(self,"selectors",{}, smalltalk.Behavior)})},
  622. args: [],
  623. source: "selectors\x0a\x09^ self methodDictionary keys",
  624. messageSends: ["keys", "methodDictionary"],
  625. referencedClasses: []
  626. }),
  627. smalltalk.Behavior);
  628. smalltalk.addMethod(
  629. "_subclasses",
  630. smalltalk.method({
  631. selector: "subclasses",
  632. category: 'accessing',
  633. fn: function (){
  634. var self=this;
  635. return smalltalk.withContext(function($ctx1) { return smalltalk.subclasses(self);
  636. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{}, smalltalk.Behavior)})},
  637. args: [],
  638. source: "subclasses\x0a\x09<return smalltalk.subclasses(self)>",
  639. messageSends: [],
  640. referencedClasses: []
  641. }),
  642. smalltalk.Behavior);
  643. smalltalk.addMethod(
  644. "_superclass",
  645. smalltalk.method({
  646. selector: "superclass",
  647. category: 'accessing',
  648. fn: function (){
  649. var self=this;
  650. return smalltalk.withContext(function($ctx1) { return self.superclass || nil;
  651. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{}, smalltalk.Behavior)})},
  652. args: [],
  653. source: "superclass\x0a\x09<return self.superclass || nil>",
  654. messageSends: [],
  655. referencedClasses: []
  656. }),
  657. smalltalk.Behavior);
  658. smalltalk.addMethod(
  659. "_theMetaClass",
  660. smalltalk.method({
  661. selector: "theMetaClass",
  662. category: 'accessing',
  663. fn: function (){
  664. var self=this;
  665. return smalltalk.withContext(function($ctx1) { var $1;
  666. $1=_st(self)._class();
  667. return $1;
  668. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{}, smalltalk.Behavior)})},
  669. args: [],
  670. source: "theMetaClass\x0a\x09^ self class",
  671. messageSends: ["class"],
  672. referencedClasses: []
  673. }),
  674. smalltalk.Behavior);
  675. smalltalk.addMethod(
  676. "_theNonMetaClass",
  677. smalltalk.method({
  678. selector: "theNonMetaClass",
  679. category: 'accessing',
  680. fn: function (){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) { var $1;
  683. $1=self;
  684. return $1;
  685. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{}, smalltalk.Behavior)})},
  686. args: [],
  687. source: "theNonMetaClass\x0a\x09^ self",
  688. messageSends: [],
  689. referencedClasses: []
  690. }),
  691. smalltalk.Behavior);
  692. smalltalk.addMethod(
  693. "_withAllSubclasses",
  694. smalltalk.method({
  695. selector: "withAllSubclasses",
  696. category: 'accessing',
  697. fn: function (){
  698. var self=this;
  699. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  700. $2=_st((smalltalk.Array || Array))._with_(self);
  701. _st($2)._addAll_(_st(self)._allSubclasses());
  702. $3=_st($2)._yourself();
  703. $1=$3;
  704. return $1;
  705. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{}, smalltalk.Behavior)})},
  706. args: [],
  707. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  708. messageSends: ["addAll:", "allSubclasses", "with:", "yourself"],
  709. referencedClasses: ["Array"]
  710. }),
  711. smalltalk.Behavior);
  712. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  713. smalltalk.Class.comment="Class is __the__ class object. \x0a\x0aInstances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder`"
  714. smalltalk.addMethod(
  715. "_asJavascript",
  716. smalltalk.method({
  717. selector: "asJavascript",
  718. category: 'converting',
  719. fn: function (){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) { var $1;
  722. $1=_st("smalltalk.").__comma(_st(self)._name());
  723. return $1;
  724. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Class)})},
  725. args: [],
  726. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  727. messageSends: [",", "name"],
  728. referencedClasses: []
  729. }),
  730. smalltalk.Class);
  731. smalltalk.addMethod(
  732. "_category",
  733. smalltalk.method({
  734. selector: "category",
  735. category: 'accessing',
  736. fn: function (){
  737. var self=this;
  738. return smalltalk.withContext(function($ctx1) { var $2,$1;
  739. $2=_st(self)._package();
  740. if(($receiver = $2) == nil || $receiver == undefined){
  741. $1="Unclassified";
  742. } else {
  743. $1=_st(_st(self)._package())._name();
  744. };
  745. return $1;
  746. }, function($ctx1) {$ctx1.fill(self,"category",{}, smalltalk.Class)})},
  747. args: [],
  748. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  749. messageSends: ["ifNil:ifNotNil:", "name", "package"],
  750. referencedClasses: []
  751. }),
  752. smalltalk.Class);
  753. smalltalk.addMethod(
  754. "_definition",
  755. smalltalk.method({
  756. selector: "definition",
  757. category: 'accessing',
  758. fn: function (){
  759. var self=this;
  760. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1;
  761. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  762. return smalltalk.withContext(function($ctx2) { $2=stream;
  763. _st($2)._nextPutAll_(_st(_st(self)._superclass())._asString());
  764. _st($2)._nextPutAll_(" subclass: #");
  765. _st($2)._nextPutAll_(_st(self)._name());
  766. _st($2)._nextPutAll_(_st(_st((smalltalk.String || String))._lf()).__comma(_st((smalltalk.String || String))._tab()));
  767. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  768. $3;
  769. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  770. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each);
  771. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  772. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" ");
  773. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  774. $4=stream;
  775. _st($4)._nextPutAll_(_st(_st("'").__comma(_st((smalltalk.String || String))._lf())).__comma(_st((smalltalk.String || String))._tab()));
  776. _st($4)._nextPutAll_("package: '");
  777. _st($4)._nextPutAll_(_st(self)._category());
  778. $5=_st($4)._nextPutAll_("'");
  779. return $5;
  780. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  781. return $1;
  782. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Class)})},
  783. args: [],
  784. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09nextPutAll: self superclass asString;\x0a\x09 \x09nextPutAll: ' subclass: #';\x0a\x09 \x09nextPutAll: self name;\x0a\x09 \x09nextPutAll: String lf, String tab;\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames \x0a \x09do: [ :each | stream nextPutAll: each ] \x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09 \x09nextPutAll: '''', String lf, String tab;\x0a\x09 \x09nextPutAll: 'package: ''';\x0a\x09 \x09nextPutAll: self category;\x0a\x09 \x09nextPutAll: '''' ]",
  785. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "tab", "lf", "do:separatedBy:", "instanceVariableNames", "category"],
  786. referencedClasses: ["String"]
  787. }),
  788. smalltalk.Class);
  789. smalltalk.addMethod(
  790. "_isClass",
  791. smalltalk.method({
  792. selector: "isClass",
  793. category: 'testing',
  794. fn: function (){
  795. var self=this;
  796. return smalltalk.withContext(function($ctx1) { return true;
  797. }, function($ctx1) {$ctx1.fill(self,"isClass",{}, smalltalk.Class)})},
  798. args: [],
  799. source: "isClass\x0a\x09^true",
  800. messageSends: [],
  801. referencedClasses: []
  802. }),
  803. smalltalk.Class);
  804. smalltalk.addMethod(
  805. "_package",
  806. smalltalk.method({
  807. selector: "package",
  808. category: 'accessing',
  809. fn: function (){
  810. var self=this;
  811. return smalltalk.withContext(function($ctx1) { return self.pkg;
  812. return self}, function($ctx1) {$ctx1.fill(self,"package",{}, smalltalk.Class)})},
  813. args: [],
  814. source: "package\x0a\x09<return self.pkg>",
  815. messageSends: [],
  816. referencedClasses: []
  817. }),
  818. smalltalk.Class);
  819. smalltalk.addMethod(
  820. "_package_",
  821. smalltalk.method({
  822. selector: "package:",
  823. category: 'accessing',
  824. fn: function (aPackage){
  825. var self=this;
  826. return smalltalk.withContext(function($ctx1) { self.pkg = aPackage;
  827. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage}, smalltalk.Class)})},
  828. args: ["aPackage"],
  829. source: "package: aPackage\x0a\x09<self.pkg = aPackage>",
  830. messageSends: [],
  831. referencedClasses: []
  832. }),
  833. smalltalk.Class);
  834. smalltalk.addMethod(
  835. "_printString",
  836. smalltalk.method({
  837. selector: "printString",
  838. category: 'printing',
  839. fn: function (){
  840. var self=this;
  841. return smalltalk.withContext(function($ctx1) { var $1;
  842. $1=_st(self)._name();
  843. return $1;
  844. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Class)})},
  845. args: [],
  846. source: "printString\x0a\x09^self name",
  847. messageSends: ["name"],
  848. referencedClasses: []
  849. }),
  850. smalltalk.Class);
  851. smalltalk.addMethod(
  852. "_rename_",
  853. smalltalk.method({
  854. selector: "rename:",
  855. category: 'accessing',
  856. fn: function (aString){
  857. var self=this;
  858. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._renameClass_to_(self,aString);
  859. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString}, smalltalk.Class)})},
  860. args: ["aString"],
  861. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  862. messageSends: ["renameClass:to:", "new"],
  863. referencedClasses: ["ClassBuilder"]
  864. }),
  865. smalltalk.Class);
  866. smalltalk.addMethod(
  867. "_subclass_instanceVariableNames_",
  868. smalltalk.method({
  869. selector: "subclass:instanceVariableNames:",
  870. category: 'class creation',
  871. fn: function (aString,anotherString){
  872. var self=this;
  873. return smalltalk.withContext(function($ctx1) { var $1;
  874. $1=_st(self)._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  875. return $1;
  876. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString}, smalltalk.Class)})},
  877. args: ["aString", "anotherString"],
  878. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  879. messageSends: ["subclass:instanceVariableNames:package:"],
  880. referencedClasses: []
  881. }),
  882. smalltalk.Class);
  883. smalltalk.addMethod(
  884. "_subclass_instanceVariableNames_category_",
  885. smalltalk.method({
  886. selector: "subclass:instanceVariableNames:category:",
  887. category: 'class creation',
  888. fn: function (aString,aString2,aString3){
  889. var self=this;
  890. return smalltalk.withContext(function($ctx1) { var $1;
  891. _st(self)._deprecatedAPI();
  892. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  893. return $1;
  894. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.Class)})},
  895. args: ["aString", "aString2", "aString3"],
  896. 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",
  897. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  898. referencedClasses: []
  899. }),
  900. smalltalk.Class);
  901. smalltalk.addMethod(
  902. "_subclass_instanceVariableNames_classVariableNames_poolDictionaries_category_",
  903. smalltalk.method({
  904. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  905. category: 'class creation',
  906. fn: function (aString,aString2,classVars,pools,aString3){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) { var $1;
  909. $1=_st(self)._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  910. return $1;
  911. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3}, smalltalk.Class)})},
  912. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  913. 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",
  914. messageSends: ["subclass:instanceVariableNames:package:"],
  915. referencedClasses: []
  916. }),
  917. smalltalk.Class);
  918. smalltalk.addMethod(
  919. "_subclass_instanceVariableNames_package_",
  920. smalltalk.method({
  921. selector: "subclass:instanceVariableNames:package:",
  922. category: 'class creation',
  923. fn: function (aString,aString2,aString3){
  924. var self=this;
  925. return smalltalk.withContext(function($ctx1) { var $1;
  926. $1=_st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  927. return $1;
  928. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3}, smalltalk.Class)})},
  929. args: ["aString", "aString2", "aString3"],
  930. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09 superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  931. messageSends: ["superclass:subclass:instanceVariableNames:package:", "asString", "new"],
  932. referencedClasses: ["ClassBuilder"]
  933. }),
  934. smalltalk.Class);
  935. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  936. 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."
  937. smalltalk.addMethod(
  938. "_asJavascript",
  939. smalltalk.method({
  940. selector: "asJavascript",
  941. category: 'converting',
  942. fn: function (){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) { var $1;
  945. $1=_st(_st("smalltalk.").__comma(_st(_st(self)._instanceClass())._name())).__comma(".klass");
  946. return $1;
  947. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Metaclass)})},
  948. args: [],
  949. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  950. messageSends: [",", "name", "instanceClass"],
  951. referencedClasses: []
  952. }),
  953. smalltalk.Metaclass);
  954. smalltalk.addMethod(
  955. "_definition",
  956. smalltalk.method({
  957. selector: "definition",
  958. category: 'accessing',
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  962. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  963. return smalltalk.withContext(function($ctx2) { $2=stream;
  964. _st($2)._nextPutAll_(_st(self)._asString());
  965. _st($2)._nextPutAll_(" class ");
  966. $3=_st($2)._nextPutAll_("instanceVariableNames: '");
  967. $3;
  968. _st(_st(self)._instanceVariableNames())._do_separatedBy_((function(each){
  969. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(each);
  970. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  971. return smalltalk.withContext(function($ctx3) { return _st(stream)._nextPutAll_(" ");
  972. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  973. return _st(stream)._nextPutAll_("'");
  974. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  975. return $1;
  976. }, function($ctx1) {$ctx1.fill(self,"definition",{}, smalltalk.Metaclass)})},
  977. args: [],
  978. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09 \x09 \x09nextPutAll: self asString;\x0a\x09 \x09nextPutAll: ' class ';\x0a\x09 \x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09 \x09do: [ :each | stream nextPutAll: each ]\x0a\x09 \x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  979. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  980. referencedClasses: ["String"]
  981. }),
  982. smalltalk.Metaclass);
  983. smalltalk.addMethod(
  984. "_instanceClass",
  985. smalltalk.method({
  986. selector: "instanceClass",
  987. category: 'accessing',
  988. fn: function (){
  989. var self=this;
  990. return smalltalk.withContext(function($ctx1) { return self.instanceClass;
  991. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{}, smalltalk.Metaclass)})},
  992. args: [],
  993. source: "instanceClass\x0a\x09<return self.instanceClass>",
  994. messageSends: [],
  995. referencedClasses: []
  996. }),
  997. smalltalk.Metaclass);
  998. smalltalk.addMethod(
  999. "_instanceVariableNames_",
  1000. smalltalk.method({
  1001. selector: "instanceVariableNames:",
  1002. category: 'accessing',
  1003. fn: function (aCollection){
  1004. var self=this;
  1005. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._class_instanceVariableNames_(self,aCollection);
  1006. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection}, smalltalk.Metaclass)})},
  1007. args: ["aCollection"],
  1008. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09 class: self instanceVariableNames: aCollection",
  1009. messageSends: ["class:instanceVariableNames:", "new"],
  1010. referencedClasses: ["ClassBuilder"]
  1011. }),
  1012. smalltalk.Metaclass);
  1013. smalltalk.addMethod(
  1014. "_isMetaclass",
  1015. smalltalk.method({
  1016. selector: "isMetaclass",
  1017. category: 'testing',
  1018. fn: function (){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) { return true;
  1021. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{}, smalltalk.Metaclass)})},
  1022. args: [],
  1023. source: "isMetaclass\x0a\x09^true",
  1024. messageSends: [],
  1025. referencedClasses: []
  1026. }),
  1027. smalltalk.Metaclass);
  1028. smalltalk.addMethod(
  1029. "_printString",
  1030. smalltalk.method({
  1031. selector: "printString",
  1032. category: 'printing',
  1033. fn: function (){
  1034. var self=this;
  1035. return smalltalk.withContext(function($ctx1) { var $1;
  1036. $1=_st(_st(_st(self)._instanceClass())._name()).__comma(" class");
  1037. return $1;
  1038. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Metaclass)})},
  1039. args: [],
  1040. source: "printString\x0a\x09^self instanceClass name, ' class'",
  1041. messageSends: [",", "name", "instanceClass"],
  1042. referencedClasses: []
  1043. }),
  1044. smalltalk.Metaclass);
  1045. smalltalk.addMethod(
  1046. "_theMetaClass",
  1047. smalltalk.method({
  1048. selector: "theMetaClass",
  1049. category: 'accessing',
  1050. fn: function (){
  1051. var self=this;
  1052. return smalltalk.withContext(function($ctx1) { var $1;
  1053. $1=self;
  1054. return $1;
  1055. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{}, smalltalk.Metaclass)})},
  1056. args: [],
  1057. source: "theMetaClass\x0a\x09^ self",
  1058. messageSends: [],
  1059. referencedClasses: []
  1060. }),
  1061. smalltalk.Metaclass);
  1062. smalltalk.addMethod(
  1063. "_theNonMetaClass",
  1064. smalltalk.method({
  1065. selector: "theNonMetaClass",
  1066. category: 'accessing',
  1067. fn: function (){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) { var $1;
  1070. $1=_st(self)._instanceClass();
  1071. return $1;
  1072. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{}, smalltalk.Metaclass)})},
  1073. args: [],
  1074. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  1075. messageSends: ["instanceClass"],
  1076. referencedClasses: []
  1077. }),
  1078. smalltalk.Metaclass);
  1079. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  1080. 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:`."
  1081. smalltalk.addMethod(
  1082. "_addSubclassOf_named_instanceVariableNames_package_",
  1083. smalltalk.method({
  1084. selector: "addSubclassOf:named:instanceVariableNames:package:",
  1085. category: 'private',
  1086. fn: function (aClass,aString,aCollection,packageName){
  1087. var self=this;
  1088. var theClass;
  1089. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1090. theClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(aString);
  1091. $1=theClass;
  1092. if(($receiver = $1) == nil || $receiver == undefined){
  1093. $1;
  1094. } else {
  1095. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  1096. if(! smalltalk.assert($2)){
  1097. $3=_st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(aString,aClass,aCollection,packageName);
  1098. return $3;
  1099. };
  1100. };
  1101. $4=_st(self)._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
  1102. return $4;
  1103. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName,theClass:theClass}, smalltalk.ClassBuilder)})},
  1104. args: ["aClass", "aString", "aCollection", "packageName"],
  1105. source: "addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a | theClass |\x0a \x0a theClass := Smalltalk current at: aString.\x0a \x0a \x09theClass ifNotNil: [ \x0a \x09theClass superclass == aClass ifFalse: [\x0a \x09\x09^ self \x0a \x09\x09migrateClassNamed: aString \x0a \x09 \x09superclass: aClass \x0a \x09 \x09instanceVariableNames: aCollection \x0a \x09package: packageName ] ].\x0a\x0a\x09^ self \x0a \x09basicAddSubclassOf: aClass \x0a named: aString \x0a instanceVariableNames: aCollection \x0a package: packageName",
  1106. messageSends: ["at:", "current", "ifNotNil:", "ifFalse:", "migrateClassNamed:superclass:instanceVariableNames:package:", "==", "superclass", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  1107. referencedClasses: ["Smalltalk"]
  1108. }),
  1109. smalltalk.ClassBuilder);
  1110. smalltalk.addMethod(
  1111. "_basicAddSubclassOf_named_instanceVariableNames_package_",
  1112. smalltalk.method({
  1113. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  1114. category: 'private',
  1115. fn: function (aClass,aString,aCollection,packageName){
  1116. var self=this;
  1117. return smalltalk.withContext(function($ctx1) {
  1118. smalltalk.addClass(aString, aClass, aCollection, packageName);
  1119. return smalltalk[aString]
  1120. ;
  1121. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName}, smalltalk.ClassBuilder)})},
  1122. args: ["aClass", "aString", "aCollection", "packageName"],
  1123. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09smalltalk.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return smalltalk[aString]\x0a\x09>",
  1124. messageSends: [],
  1125. referencedClasses: []
  1126. }),
  1127. smalltalk.ClassBuilder);
  1128. smalltalk.addMethod(
  1129. "_basicClass_instanceVariableNames_",
  1130. smalltalk.method({
  1131. selector: "basicClass:instanceVariableNames:",
  1132. category: 'private',
  1133. fn: function (aClass,aString){
  1134. var self=this;
  1135. return smalltalk.withContext(function($ctx1) { _st(self)._basicClass_instanceVariables_(aClass,_st(self)._instanceVariableNamesFor_(aString));
  1136. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  1137. args: ["aClass", "aString"],
  1138. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  1139. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  1140. referencedClasses: []
  1141. }),
  1142. smalltalk.ClassBuilder);
  1143. smalltalk.addMethod(
  1144. "_basicClass_instanceVariables_",
  1145. smalltalk.method({
  1146. selector: "basicClass:instanceVariables:",
  1147. category: 'private',
  1148. fn: function (aClass,aCollection){
  1149. var self=this;
  1150. return smalltalk.withContext(function($ctx1) { var $1;
  1151. $1=_st(aClass)._isMetaclass();
  1152. if(! smalltalk.assert($1)){
  1153. _st(self)._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  1154. };
  1155. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  1156. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection}, smalltalk.ClassBuilder)})},
  1157. args: ["aClass", "aCollection"],
  1158. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  1159. messageSends: ["ifFalse:", "error:", ",", "name", "isMetaclass", "basicAt:put:"],
  1160. referencedClasses: []
  1161. }),
  1162. smalltalk.ClassBuilder);
  1163. smalltalk.addMethod(
  1164. "_basicRemoveClass_",
  1165. smalltalk.method({
  1166. selector: "basicRemoveClass:",
  1167. category: 'private',
  1168. fn: function (aClass){
  1169. var self=this;
  1170. return smalltalk.withContext(function($ctx1) { smalltalk.removeClass(aClass);
  1171. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass}, smalltalk.ClassBuilder)})},
  1172. args: ["aClass"],
  1173. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  1174. messageSends: [],
  1175. referencedClasses: []
  1176. }),
  1177. smalltalk.ClassBuilder);
  1178. smalltalk.addMethod(
  1179. "_basicRenameClass_to_",
  1180. smalltalk.method({
  1181. selector: "basicRenameClass:to:",
  1182. category: 'private',
  1183. fn: function (aClass,aString){
  1184. var self=this;
  1185. return smalltalk.withContext(function($ctx1) {
  1186. smalltalk[aString] = aClass;
  1187. delete smalltalk[aClass.className];
  1188. aClass.className = aString;
  1189. ;
  1190. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  1191. args: ["aClass", "aString"],
  1192. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09\x09delete smalltalk[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  1193. messageSends: [],
  1194. referencedClasses: []
  1195. }),
  1196. smalltalk.ClassBuilder);
  1197. smalltalk.addMethod(
  1198. "_class_instanceVariableNames_",
  1199. smalltalk.method({
  1200. selector: "class:instanceVariableNames:",
  1201. category: 'api',
  1202. fn: function (aClass,aString){
  1203. var self=this;
  1204. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1205. _st(self)._basicClass_instanceVariableNames_(aClass,aString);
  1206. _st(self)._setupClass_(aClass);
  1207. $1=_st((smalltalk.ClassDefinitionChanged || ClassDefinitionChanged))._new();
  1208. _st($1)._theClass_(aClass);
  1209. $2=_st($1)._yourself();
  1210. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  1211. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  1212. args: ["aClass", "aString"],
  1213. source: "class: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariableNames: aString.\x0a self setupClass: aClass.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassDefinitionChanged new\x0a \x09theClass: aClass;\x0a yourself)",
  1214. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  1215. referencedClasses: ["ClassDefinitionChanged", "SystemAnnouncer"]
  1216. }),
  1217. smalltalk.ClassBuilder);
  1218. smalltalk.addMethod(
  1219. "_copyClass_named_",
  1220. smalltalk.method({
  1221. selector: "copyClass:named:",
  1222. category: 'private',
  1223. fn: function (aClass,aString){
  1224. var self=this;
  1225. var newClass;
  1226. return smalltalk.withContext(function($ctx1) { var $1;
  1227. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),aString,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  1228. _st(self)._copyClass_to_(aClass,newClass);
  1229. $1=newClass;
  1230. return $1;
  1231. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,aString:aString,newClass:newClass}, smalltalk.ClassBuilder)})},
  1232. args: ["aClass", "aString"],
  1233. 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 copyClass: aClass to: newClass.\x0a \x0a\x09^newClass",
  1234. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:"],
  1235. referencedClasses: []
  1236. }),
  1237. smalltalk.ClassBuilder);
  1238. smalltalk.addMethod(
  1239. "_copyClass_to_",
  1240. smalltalk.method({
  1241. selector: "copyClass:to:",
  1242. category: 'private',
  1243. fn: function (aClass,anotherClass){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) { _st(anotherClass)._comment_(_st(aClass)._comment());
  1246. _st(_st(_st(aClass)._methodDictionary())._values())._do_((function(each){
  1247. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(_st(each)._source(),anotherClass,_st(each)._category());
  1248. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1249. _st(self)._basicClass_instanceVariables_(_st(anotherClass)._class(),_st(_st(aClass)._class())._instanceVariableNames());
  1250. _st(_st(_st(_st(aClass)._class())._methodDictionary())._values())._do_((function(each){
  1251. return smalltalk.withContext(function($ctx2) { return _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(_st(each)._source(),_st(anotherClass)._class(),_st(each)._category());
  1252. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1253. _st(self)._setupClass_(anotherClass);
  1254. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass}, smalltalk.ClassBuilder)})},
  1255. args: ["aClass", "anotherClass"],
  1256. source: "copyClass: aClass to: anotherClass\x0a\x0a\x09anotherClass comment: aClass comment.\x0a\x0a\x09aClass methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass category: each category ].\x0a\x0a\x09self basicClass: anotherClass class instanceVariables: aClass class instanceVariableNames.\x0a\x0a\x09aClass class methodDictionary values do: [ :each |\x0a\x09\x09Compiler new install: each source forClass: anotherClass class category: each category ].\x0a\x0a\x09self setupClass: anotherClass",
  1257. messageSends: ["comment:", "comment", "do:", "install:forClass:category:", "source", "category", "new", "values", "methodDictionary", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  1258. referencedClasses: ["Compiler"]
  1259. }),
  1260. smalltalk.ClassBuilder);
  1261. smalltalk.addMethod(
  1262. "_installMethod_forClass_category_",
  1263. smalltalk.method({
  1264. selector: "installMethod:forClass:category:",
  1265. category: 'api',
  1266. fn: function (aCompiledMethod,aBehavior,aString){
  1267. var self=this;
  1268. return smalltalk.withContext(function($ctx1) { var $1;
  1269. _st(aCompiledMethod)._category_(aString);
  1270. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  1271. _st(self)._setupClass_(aBehavior);
  1272. $1=aCompiledMethod;
  1273. return $1;
  1274. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString}, smalltalk.ClassBuilder)})},
  1275. args: ["aCompiledMethod", "aBehavior", "aString"],
  1276. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  1277. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  1278. referencedClasses: []
  1279. }),
  1280. smalltalk.ClassBuilder);
  1281. smalltalk.addMethod(
  1282. "_instanceVariableNamesFor_",
  1283. smalltalk.method({
  1284. selector: "instanceVariableNamesFor:",
  1285. category: 'private',
  1286. fn: function (aString){
  1287. var self=this;
  1288. return smalltalk.withContext(function($ctx1) { var $1;
  1289. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  1290. return smalltalk.withContext(function($ctx2) { return _st(each)._isEmpty();
  1291. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1292. return $1;
  1293. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString}, smalltalk.ClassBuilder)})},
  1294. args: ["aString"],
  1295. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  1296. messageSends: ["reject:", "isEmpty", "tokenize:"],
  1297. referencedClasses: []
  1298. }),
  1299. smalltalk.ClassBuilder);
  1300. smalltalk.addMethod(
  1301. "_migrateClass_superclass_",
  1302. smalltalk.method({
  1303. selector: "migrateClass:superclass:",
  1304. category: 'private',
  1305. fn: function (aClass,anotherClass){
  1306. var self=this;
  1307. return smalltalk.withContext(function($ctx1) { _st(console)._log_(_st(aClass)._name());
  1308. _st(self)._migrateClassNamed_superclass_instanceVariableNames_package_(_st(aClass)._name(),anotherClass,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  1309. return self}, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass}, smalltalk.ClassBuilder)})},
  1310. args: ["aClass", "anotherClass"],
  1311. source: "migrateClass: aClass superclass: anotherClass\x0a\x09console log: aClass name.\x0a\x09self \x0a \x09migrateClassNamed: aClass name\x0a superclass: anotherClass\x0a instanceVariableNames: aClass instanceVariableNames\x0a package: aClass package name",
  1312. messageSends: ["log:", "name", "migrateClassNamed:superclass:instanceVariableNames:package:", "instanceVariableNames", "package"],
  1313. referencedClasses: []
  1314. }),
  1315. smalltalk.ClassBuilder);
  1316. smalltalk.addMethod(
  1317. "_migrateClassNamed_superclass_instanceVariableNames_package_",
  1318. smalltalk.method({
  1319. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  1320. category: 'private',
  1321. fn: function (aString,aClass,aCollection,packageName){
  1322. var self=this;
  1323. var oldClass,newClass;
  1324. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1325. oldClass=_st(_st((smalltalk.Smalltalk || Smalltalk))._current())._at_(aString);
  1326. _st(self)._basicRenameClass_to_(oldClass,_st("Old").__comma(aString));
  1327. newClass=_st(self)._addSubclassOf_named_instanceVariableNames_package_(aClass,aString,aCollection,packageName);
  1328. _st(_st(oldClass)._subclasses())._do_((function(each){
  1329. return smalltalk.withContext(function($ctx2) { return _st(self)._migrateClass_superclass_(each,newClass);
  1330. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1331. _st((function(){
  1332. return smalltalk.withContext(function($ctx2) { return _st(self)._copyClass_to_(oldClass,newClass);
  1333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._on_do_((smalltalk.Error || Error),(function(exception){
  1334. return smalltalk.withContext(function($ctx2) { $1=self;
  1335. _st($1)._basicRemoveClass_(newClass);
  1336. $2=_st($1)._basicRenameClass_to_(oldClass,aString);
  1337. $2;
  1338. return _st(exception)._signal();
  1339. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1)})}));
  1340. _st(self)._basicRemoveClass_(oldClass);
  1341. $3=newClass;
  1342. return $3;
  1343. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{aString:aString,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass}, smalltalk.ClassBuilder)})},
  1344. args: ["aString", "aClass", "aCollection", "packageName"],
  1345. source: "migrateClassNamed: aString superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass |\x0a \x0a oldClass := Smalltalk current at: aString.\x0a \x0a \x22Rename the old class for existing instances\x22\x0a\x09self basicRenameClass: oldClass to: 'Old', aString.\x0a \x0a newClass := self \x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: aString \x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName.\x0a\x0a\x09oldClass subclasses do: [ :each |\x0a \x09self migrateClass: each superclass: newClass ].\x0a\x0a [ self copyClass: oldClass to: newClass ] \x0a \x09on: Error\x0a do: [ :exception |\x0a \x09self \x0a \x09basicRemoveClass: newClass;\x0a \x09basicRenameClass: oldClass to: aString.\x0a exception signal ].\x0a \x0a self basicRemoveClass: oldClass.\x0a\x09^newClass",
  1346. messageSends: ["at:", "current", "basicRenameClass:to:", ",", "addSubclassOf:named:instanceVariableNames:package:", "do:", "migrateClass:superclass:", "subclasses", "on:do:", "basicRemoveClass:", "signal", "copyClass:to:"],
  1347. referencedClasses: ["Smalltalk", "Error"]
  1348. }),
  1349. smalltalk.ClassBuilder);
  1350. smalltalk.addMethod(
  1351. "_renameClass_to_",
  1352. smalltalk.method({
  1353. selector: "renameClass:to:",
  1354. category: 'api',
  1355. fn: function (aClass,aString){
  1356. var self=this;
  1357. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1358. _st(self)._basicRenameClass_to_(aClass,aString);
  1359. $1=_st((smalltalk.ClassRenamed || ClassRenamed))._new();
  1360. _st($1)._theClass_(aClass);
  1361. $2=_st($1)._yourself();
  1362. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($2);
  1363. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  1364. args: ["aClass", "aString"],
  1365. source: "renameClass: aClass to: aString\x0a\x09self basicRenameClass: aClass to: aString.\x0a \x0a SystemAnnouncer current\x0a \x09announce: (ClassRenamed new\x0a \x09theClass: aClass;\x0a yourself)",
  1366. messageSends: ["basicRenameClass:to:", "announce:", "theClass:", "new", "yourself", "current"],
  1367. referencedClasses: ["ClassRenamed", "SystemAnnouncer"]
  1368. }),
  1369. smalltalk.ClassBuilder);
  1370. smalltalk.addMethod(
  1371. "_setupClass_",
  1372. smalltalk.method({
  1373. selector: "setupClass:",
  1374. category: 'api',
  1375. fn: function (aClass){
  1376. var self=this;
  1377. return smalltalk.withContext(function($ctx1) { smalltalk.init(aClass);;
  1378. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass}, smalltalk.ClassBuilder)})},
  1379. args: ["aClass"],
  1380. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  1381. messageSends: [],
  1382. referencedClasses: []
  1383. }),
  1384. smalltalk.ClassBuilder);
  1385. smalltalk.addMethod(
  1386. "_superclass_subclass_",
  1387. smalltalk.method({
  1388. selector: "superclass:subclass:",
  1389. category: 'api',
  1390. fn: function (aClass,aString){
  1391. var self=this;
  1392. return smalltalk.withContext(function($ctx1) { var $1;
  1393. $1=_st(self)._superclass_subclass_instanceVariableNames_package_(aClass,aString,"",nil);
  1394. return $1;
  1395. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,aString:aString}, smalltalk.ClassBuilder)})},
  1396. args: ["aClass", "aString"],
  1397. source: "superclass: aClass subclass: aString\x0a\x09^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil",
  1398. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  1399. referencedClasses: []
  1400. }),
  1401. smalltalk.ClassBuilder);
  1402. smalltalk.addMethod(
  1403. "_superclass_subclass_instanceVariableNames_package_",
  1404. smalltalk.method({
  1405. selector: "superclass:subclass:instanceVariableNames:package:",
  1406. category: 'api',
  1407. fn: function (aClass,aString,aString2,aString3){
  1408. var self=this;
  1409. var newClass;
  1410. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$6,$5,$7,$8,$9;
  1411. $1=self;
  1412. $2=aClass;
  1413. $3=aString;
  1414. $4=_st(self)._instanceVariableNamesFor_(aString2);
  1415. $6=aString3;
  1416. if(($receiver = $6) == nil || $receiver == undefined){
  1417. $5="unclassified";
  1418. } else {
  1419. $5=$6;
  1420. };
  1421. newClass=_st($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$5);
  1422. _st(self)._setupClass_(newClass);
  1423. $7=_st((smalltalk.ClassAdded || ClassAdded))._new();
  1424. _st($7)._theClass_(newClass);
  1425. $8=_st($7)._yourself();
  1426. _st(_st((smalltalk.SystemAnnouncer || SystemAnnouncer))._current())._announce_($8);
  1427. $9=newClass;
  1428. return $9;
  1429. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,aString:aString,aString2:aString2,aString3:aString3,newClass:newClass}, smalltalk.ClassBuilder)})},
  1430. args: ["aClass", "aString", "aString2", "aString3"],
  1431. source: "superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09| newClass |\x0a\x09\x0a newClass := self addSubclassOf: aClass\x0a\x09\x09named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)\x0a\x09\x09package: (aString3 ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a \x0a SystemAnnouncer current \x0a \x09announce: (ClassAdded new\x0a \x09theClass: newClass;\x0a yourself).\x0a \x0a\x09^newClass",
  1432. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "theClass:", "new", "yourself", "current"],
  1433. referencedClasses: ["ClassAdded", "SystemAnnouncer"]
  1434. }),
  1435. smalltalk.ClassBuilder);
  1436. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  1437. smalltalk.ClassCategoryReader.comment="ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file."
  1438. smalltalk.addMethod(
  1439. "_class_category_",
  1440. smalltalk.method({
  1441. selector: "class:category:",
  1442. category: 'accessing',
  1443. fn: function (aClass,aString){
  1444. var self=this;
  1445. return smalltalk.withContext(function($ctx1) { self["@class"]=aClass;
  1446. self["@category"]=aString;
  1447. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString}, smalltalk.ClassCategoryReader)})},
  1448. args: ["aClass", "aString"],
  1449. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  1450. messageSends: [],
  1451. referencedClasses: []
  1452. }),
  1453. smalltalk.ClassCategoryReader);
  1454. smalltalk.addMethod(
  1455. "_compileMethod_",
  1456. smalltalk.method({
  1457. selector: "compileMethod:",
  1458. category: 'private',
  1459. fn: function (aString){
  1460. var self=this;
  1461. return smalltalk.withContext(function($ctx1) { _st(_st((smalltalk.Compiler || Compiler))._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  1462. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString}, smalltalk.ClassCategoryReader)})},
  1463. args: ["aString"],
  1464. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  1465. messageSends: ["install:forClass:category:", "new"],
  1466. referencedClasses: ["Compiler"]
  1467. }),
  1468. smalltalk.ClassCategoryReader);
  1469. smalltalk.addMethod(
  1470. "_initialize",
  1471. smalltalk.method({
  1472. selector: "initialize",
  1473. category: 'initialization',
  1474. fn: function (){
  1475. var self=this;
  1476. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  1477. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ClassCategoryReader)})},
  1478. args: [],
  1479. source: "initialize\x0a\x09super initialize.",
  1480. messageSends: ["initialize"],
  1481. referencedClasses: []
  1482. }),
  1483. smalltalk.ClassCategoryReader);
  1484. smalltalk.addMethod(
  1485. "_scanFrom_",
  1486. smalltalk.method({
  1487. selector: "scanFrom:",
  1488. category: 'fileIn',
  1489. fn: function (aChunkParser){
  1490. var self=this;
  1491. var chunk;
  1492. return smalltalk.withContext(function($ctx1) { _st((function(){
  1493. return smalltalk.withContext(function($ctx2) { chunk=_st(aChunkParser)._nextChunk();
  1494. chunk;
  1495. return _st(chunk)._isEmpty();
  1496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  1497. return smalltalk.withContext(function($ctx2) { return _st(self)._compileMethod_(chunk);
  1498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1499. _st(_st((smalltalk.ClassBuilder || ClassBuilder))._new())._setupClass_(self["@class"]);
  1500. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCategoryReader)})},
  1501. args: ["aChunkParser"],
  1502. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09 self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
  1503. messageSends: ["whileFalse:", "compileMethod:", "nextChunk", "isEmpty", "setupClass:", "new"],
  1504. referencedClasses: ["ClassBuilder"]
  1505. }),
  1506. smalltalk.ClassCategoryReader);
  1507. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  1508. smalltalk.ClassCommentReader.comment="ClassCommentReader represents a mechanism for retrieving class comments stored on a file.\x0aSee `ClassCategoryReader` too."
  1509. smalltalk.addMethod(
  1510. "_class_",
  1511. smalltalk.method({
  1512. selector: "class:",
  1513. category: 'accessing',
  1514. fn: function (aClass){
  1515. var self=this;
  1516. return smalltalk.withContext(function($ctx1) { self["@class"]=aClass;
  1517. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass}, smalltalk.ClassCommentReader)})},
  1518. args: ["aClass"],
  1519. source: "class: aClass\x0a\x09class := aClass",
  1520. messageSends: [],
  1521. referencedClasses: []
  1522. }),
  1523. smalltalk.ClassCommentReader);
  1524. smalltalk.addMethod(
  1525. "_initialize",
  1526. smalltalk.method({
  1527. selector: "initialize",
  1528. category: 'initialization',
  1529. fn: function (){
  1530. var self=this;
  1531. return smalltalk.withContext(function($ctx1) { smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  1532. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ClassCommentReader)})},
  1533. args: [],
  1534. source: "initialize\x0a\x09super initialize.",
  1535. messageSends: ["initialize"],
  1536. referencedClasses: []
  1537. }),
  1538. smalltalk.ClassCommentReader);
  1539. smalltalk.addMethod(
  1540. "_scanFrom_",
  1541. smalltalk.method({
  1542. selector: "scanFrom:",
  1543. category: 'fileIn',
  1544. fn: function (aChunkParser){
  1545. var self=this;
  1546. var chunk;
  1547. return smalltalk.withContext(function($ctx1) { var $1;
  1548. chunk=_st(aChunkParser)._nextChunk();
  1549. $1=_st(chunk)._isEmpty();
  1550. if(! smalltalk.assert($1)){
  1551. _st(self)._setComment_(chunk);
  1552. };
  1553. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk}, smalltalk.ClassCommentReader)})},
  1554. args: ["aChunkParser"],
  1555. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09 self setComment: chunk].",
  1556. messageSends: ["nextChunk", "ifFalse:", "setComment:", "isEmpty"],
  1557. referencedClasses: []
  1558. }),
  1559. smalltalk.ClassCommentReader);
  1560. smalltalk.addMethod(
  1561. "_setComment_",
  1562. smalltalk.method({
  1563. selector: "setComment:",
  1564. category: 'private',
  1565. fn: function (aString){
  1566. var self=this;
  1567. return smalltalk.withContext(function($ctx1) { _st(self["@class"])._comment_(aString);
  1568. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString}, smalltalk.ClassCommentReader)})},
  1569. args: ["aString"],
  1570. source: "setComment: aString\x0a class comment: aString",
  1571. messageSends: ["comment:"],
  1572. referencedClasses: []
  1573. }),
  1574. smalltalk.ClassCommentReader);
  1575. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  1576. smalltalk.addMethod(
  1577. "_getNodesFrom_",
  1578. smalltalk.method({
  1579. selector: "getNodesFrom:",
  1580. category: 'accessing',
  1581. fn: function (aCollection){
  1582. var self=this;
  1583. var children,others;
  1584. return smalltalk.withContext(function($ctx1) { var $1;
  1585. children=[];
  1586. others=[];
  1587. _st(aCollection)._do_((function(each){
  1588. return smalltalk.withContext(function($ctx2) { $1=_st(_st(each)._superclass()).__eq(_st(self)._theClass());
  1589. if(smalltalk.assert($1)){
  1590. return _st(children)._add_(each);
  1591. } else {
  1592. return _st(others)._add_(each);
  1593. };
  1594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1595. self["@nodes"]=_st(children)._collect_((function(each){
  1596. return smalltalk.withContext(function($ctx2) { return _st((smalltalk.ClassSorterNode || ClassSorterNode))._on_classes_level_(each,others,_st(_st(self)._level()).__plus((1)));
  1597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1598. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others}, smalltalk.ClassSorterNode)})},
  1599. args: ["aCollection"],
  1600. 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]",
  1601. messageSends: ["do:", "ifTrue:ifFalse:", "add:", "=", "theClass", "superclass", "collect:", "on:classes:level:", "+", "level"],
  1602. referencedClasses: ["ClassSorterNode"]
  1603. }),
  1604. smalltalk.ClassSorterNode);
  1605. smalltalk.addMethod(
  1606. "_level",
  1607. smalltalk.method({
  1608. selector: "level",
  1609. category: 'accessing',
  1610. fn: function (){
  1611. var self=this;
  1612. return smalltalk.withContext(function($ctx1) { var $1;
  1613. $1=self["@level"];
  1614. return $1;
  1615. }, function($ctx1) {$ctx1.fill(self,"level",{}, smalltalk.ClassSorterNode)})},
  1616. args: [],
  1617. source: "level\x0a\x09^level",
  1618. messageSends: [],
  1619. referencedClasses: []
  1620. }),
  1621. smalltalk.ClassSorterNode);
  1622. smalltalk.addMethod(
  1623. "_level_",
  1624. smalltalk.method({
  1625. selector: "level:",
  1626. category: 'accessing',
  1627. fn: function (anInteger){
  1628. var self=this;
  1629. return smalltalk.withContext(function($ctx1) { self["@level"]=anInteger;
  1630. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger}, smalltalk.ClassSorterNode)})},
  1631. args: ["anInteger"],
  1632. source: "level: anInteger\x0a\x09level := anInteger",
  1633. messageSends: [],
  1634. referencedClasses: []
  1635. }),
  1636. smalltalk.ClassSorterNode);
  1637. smalltalk.addMethod(
  1638. "_nodes",
  1639. smalltalk.method({
  1640. selector: "nodes",
  1641. category: 'accessing',
  1642. fn: function (){
  1643. var self=this;
  1644. return smalltalk.withContext(function($ctx1) { var $1;
  1645. $1=self["@nodes"];
  1646. return $1;
  1647. }, function($ctx1) {$ctx1.fill(self,"nodes",{}, smalltalk.ClassSorterNode)})},
  1648. args: [],
  1649. source: "nodes\x0a\x09^nodes",
  1650. messageSends: [],
  1651. referencedClasses: []
  1652. }),
  1653. smalltalk.ClassSorterNode);
  1654. smalltalk.addMethod(
  1655. "_theClass",
  1656. smalltalk.method({
  1657. selector: "theClass",
  1658. category: 'accessing',
  1659. fn: function (){
  1660. var self=this;
  1661. return smalltalk.withContext(function($ctx1) { var $1;
  1662. $1=self["@theClass"];
  1663. return $1;
  1664. }, function($ctx1) {$ctx1.fill(self,"theClass",{}, smalltalk.ClassSorterNode)})},
  1665. args: [],
  1666. source: "theClass\x0a\x09^theClass",
  1667. messageSends: [],
  1668. referencedClasses: []
  1669. }),
  1670. smalltalk.ClassSorterNode);
  1671. smalltalk.addMethod(
  1672. "_theClass_",
  1673. smalltalk.method({
  1674. selector: "theClass:",
  1675. category: 'accessing',
  1676. fn: function (aClass){
  1677. var self=this;
  1678. return smalltalk.withContext(function($ctx1) { self["@theClass"]=aClass;
  1679. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass}, smalltalk.ClassSorterNode)})},
  1680. args: ["aClass"],
  1681. source: "theClass: aClass\x0a\x09theClass := aClass",
  1682. messageSends: [],
  1683. referencedClasses: []
  1684. }),
  1685. smalltalk.ClassSorterNode);
  1686. smalltalk.addMethod(
  1687. "_traverseClassesWith_",
  1688. smalltalk.method({
  1689. selector: "traverseClassesWith:",
  1690. category: 'visiting',
  1691. fn: function (aCollection){
  1692. var self=this;
  1693. return smalltalk.withContext(function($ctx1) { _st(aCollection)._add_(_st(self)._theClass());
  1694. _st(_st(_st(self)._nodes())._sorted_((function(a,b){
  1695. return smalltalk.withContext(function($ctx2) { return _st(_st(_st(a)._theClass())._name()).__lt_eq(_st(_st(b)._theClass())._name());
  1696. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(aNode){
  1697. return smalltalk.withContext(function($ctx2) { return _st(aNode)._traverseClassesWith_(aCollection);
  1698. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1)})}));
  1699. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection}, smalltalk.ClassSorterNode)})},
  1700. args: ["aCollection"],
  1701. 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 ].",
  1702. messageSends: ["add:", "theClass", "do:", "traverseClassesWith:", "sorted:", "<=", "name", "nodes"],
  1703. referencedClasses: []
  1704. }),
  1705. smalltalk.ClassSorterNode);
  1706. smalltalk.addMethod(
  1707. "_on_classes_level_",
  1708. smalltalk.method({
  1709. selector: "on:classes:level:",
  1710. category: 'instance creation',
  1711. fn: function (aClass,aCollection,anInteger){
  1712. var self=this;
  1713. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1714. $2=_st(self)._new();
  1715. _st($2)._theClass_(aClass);
  1716. _st($2)._level_(anInteger);
  1717. _st($2)._getNodesFrom_(aCollection);
  1718. $3=_st($2)._yourself();
  1719. $1=$3;
  1720. return $1;
  1721. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger}, smalltalk.ClassSorterNode.klass)})},
  1722. args: ["aClass", "aCollection", "anInteger"],
  1723. 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",
  1724. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  1725. referencedClasses: []
  1726. }),
  1727. smalltalk.ClassSorterNode.klass);