1
0

Kernel-Classes.js 78 KB

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