1
0

Kernel-Classes.js 93 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403
  1. define("amber_core/Kernel-Classes", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Classes');
  3. smalltalk.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel-Classes');
  5. smalltalk.Behavior.comment="I am the superclass of all class objects.\x0a\x0aI define the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).\x0a\x0aMy instances 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\x0aI also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: ">>",
  9. category: 'accessing',
  10. fn: function (aString){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=self._methodAt_(aString);
  15. return $1;
  16. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},smalltalk.Behavior)})},
  17. args: ["aString"],
  18. source: ">> aString\x0a\x09^ self methodAt: aString",
  19. messageSends: ["methodAt:"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.Behavior);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "addCompiledMethod:",
  26. category: 'compiling',
  27. fn: function (aMethod){
  28. var self=this;
  29. var oldMethod,announcement;
  30. function $MethodAdded(){return smalltalk.MethodAdded||(typeof MethodAdded=="undefined"?nil:MethodAdded)}
  31. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  32. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  33. return smalltalk.withContext(function($ctx1) {
  34. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10;
  35. oldMethod=_st(self._methodDictionary())._at_ifAbsent_(_st(aMethod)._selector(),(function(){
  36. return smalltalk.withContext(function($ctx2) {
  37. return nil;
  38. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  39. $2=self._protocols();
  40. $3=_st(aMethod)._protocol();
  41. $ctx1.sendIdx["protocol"]=1;
  42. $1=_st($2)._includes_($3);
  43. if(! smalltalk.assert($1)){
  44. $4=self._organization();
  45. $5=_st(aMethod)._protocol();
  46. _st($4)._addElement_($5);
  47. };
  48. self._basicAddCompiledMethod_(aMethod);
  49. $6=oldMethod;
  50. if(($receiver = $6) == nil || $receiver == null){
  51. $7=_st($MethodAdded())._new();
  52. $ctx1.sendIdx["new"]=1;
  53. _st($7)._method_(aMethod);
  54. $ctx1.sendIdx["method:"]=1;
  55. $8=_st($7)._yourself();
  56. $ctx1.sendIdx["yourself"]=1;
  57. announcement=$8;
  58. } else {
  59. $9=_st($MethodModified())._new();
  60. _st($9)._oldMethod_(oldMethod);
  61. _st($9)._method_(aMethod);
  62. $10=_st($9)._yourself();
  63. announcement=$10;
  64. };
  65. _st(_st($SystemAnnouncer())._current())._announce_(announcement);
  66. return self}, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},smalltalk.Behavior)})},
  67. args: ["aMethod"],
  68. source: "addCompiledMethod: aMethod\x0a\x09| oldMethod announcement |\x0a\x09\x0a\x09oldMethod := self methodDictionary\x0a\x09\x09at: aMethod selector\x0a\x09\x09ifAbsent: [ nil ].\x0a\x09\x0a\x09(self protocols includes: aMethod protocol)\x0a\x09\x09ifFalse: [ self organization addElement: aMethod protocol ].\x0a\x0a\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  69. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"],
  70. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"]
  71. }),
  72. smalltalk.Behavior);
  73. smalltalk.addMethod(
  74. smalltalk.method({
  75. selector: "allInstanceVariableNames",
  76. category: 'accessing',
  77. fn: function (){
  78. var self=this;
  79. var result;
  80. return smalltalk.withContext(function($ctx1) {
  81. var $1,$2,$4,$3,$5;
  82. result=_st(self._instanceVariableNames())._copy();
  83. $1=self._superclass();
  84. $ctx1.sendIdx["superclass"]=1;
  85. if(($receiver = $1) == nil || $receiver == null){
  86. $1;
  87. } else {
  88. $2=result;
  89. $4=self._superclass();
  90. $3=_st($4)._allInstanceVariableNames();
  91. _st($2)._addAll_($3);
  92. };
  93. $5=result;
  94. return $5;
  95. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},smalltalk.Behavior)})},
  96. args: [],
  97. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames].\x0a\x09^result",
  98. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"],
  99. referencedClasses: []
  100. }),
  101. smalltalk.Behavior);
  102. smalltalk.addMethod(
  103. smalltalk.method({
  104. selector: "allSelectors",
  105. category: 'accessing',
  106. fn: function (){
  107. var self=this;
  108. return smalltalk.withContext(function($ctx1) {
  109. var $2,$3,$4,$5,$6,$7,$1;
  110. $2=self._allSuperclasses();
  111. $3=self._selectors();
  112. $ctx1.sendIdx["selectors"]=1;
  113. $1=_st($2)._inject_into_($3,(function(acc,each){
  114. return smalltalk.withContext(function($ctx2) {
  115. $4=acc;
  116. $5=$4;
  117. $6=_st(each)._selectors();
  118. _st($5)._addAll_($6);
  119. $7=_st($4)._yourself();
  120. return $7;
  121. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})}));
  122. return $1;
  123. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},smalltalk.Behavior)})},
  124. args: [],
  125. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  126. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"],
  127. referencedClasses: []
  128. }),
  129. smalltalk.Behavior);
  130. smalltalk.addMethod(
  131. smalltalk.method({
  132. selector: "allSubclasses",
  133. category: 'accessing',
  134. fn: function (){
  135. var self=this;
  136. var subclasses,index;
  137. return smalltalk.withContext(function($ctx1) {
  138. var $1,$2,$3;
  139. subclasses=self._subclasses();
  140. $ctx1.sendIdx["subclasses"]=1;
  141. index=(1);
  142. _st((function(){
  143. return smalltalk.withContext(function($ctx2) {
  144. return _st(index).__gt(_st(subclasses)._size());
  145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  146. return smalltalk.withContext(function($ctx2) {
  147. $1=subclasses;
  148. $2=_st(_st(subclasses)._at_(index))._subclasses();
  149. _st($1)._addAll_($2);
  150. index=_st(index).__plus((1));
  151. return index;
  152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  153. $3=subclasses;
  154. return $3;
  155. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},smalltalk.Behavior)})},
  156. args: [],
  157. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self subclasses.\x0a\x09index := 1.\x0a\x09[ index > subclasses size ]\x0a\x09\x09whileFalse: [ subclasses addAll: (subclasses at: index) subclasses.\x0a\x09\x09\x09index := index + 1 ].\x0a\x0a\x09^ subclasses",
  158. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"],
  159. referencedClasses: []
  160. }),
  161. smalltalk.Behavior);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "allSubclassesDo:",
  165. category: 'enumerating',
  166. fn: function (aBlock){
  167. var self=this;
  168. return smalltalk.withContext(function($ctx1) {
  169. _st(self._allSubclasses())._do_((function(each){
  170. return smalltalk.withContext(function($ctx2) {
  171. return _st(aBlock)._value_(each);
  172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  173. return self}, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},smalltalk.Behavior)})},
  174. args: ["aBlock"],
  175. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  176. messageSends: ["do:", "allSubclasses", "value:"],
  177. referencedClasses: []
  178. }),
  179. smalltalk.Behavior);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "allSuperclasses",
  183. category: 'accessing',
  184. fn: function (){
  185. var self=this;
  186. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  187. return smalltalk.withContext(function($ctx1) {
  188. var $1,$2,$5,$6,$4,$7,$9,$8,$10,$3;
  189. $1=self._superclass();
  190. $ctx1.sendIdx["superclass"]=1;
  191. if(($receiver = $1) == nil || $receiver == null){
  192. $2=[];
  193. return $2;
  194. } else {
  195. $1;
  196. };
  197. $5=$OrderedCollection();
  198. $6=self._superclass();
  199. $ctx1.sendIdx["superclass"]=2;
  200. $4=_st($5)._with_($6);
  201. $7=$4;
  202. $9=self._superclass();
  203. $8=_st($9)._allSuperclasses();
  204. _st($7)._addAll_($8);
  205. $10=_st($4)._yourself();
  206. $3=$10;
  207. return $3;
  208. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},smalltalk.Behavior)})},
  209. args: [],
  210. source: "allSuperclasses\x0a\x09\x0a\x09self superclass ifNil: [ ^ #() ].\x0a\x09\x0a\x09^ (OrderedCollection with: self superclass)\x0a\x09\x09addAll: self superclass allSuperclasses;\x0a\x09\x09yourself",
  211. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"],
  212. referencedClasses: ["OrderedCollection"]
  213. }),
  214. smalltalk.Behavior);
  215. smalltalk.addMethod(
  216. smalltalk.method({
  217. selector: "basicAddCompiledMethod:",
  218. category: 'private',
  219. fn: function (aMethod){
  220. var self=this;
  221. return smalltalk.withContext(function($ctx1) {
  222. smalltalk.addMethod(aMethod, self);
  223. return self}, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  224. args: ["aMethod"],
  225. source: "basicAddCompiledMethod: aMethod\x0a\x09<smalltalk.addMethod(aMethod, self)>",
  226. messageSends: [],
  227. referencedClasses: []
  228. }),
  229. smalltalk.Behavior);
  230. smalltalk.addMethod(
  231. smalltalk.method({
  232. selector: "basicNew",
  233. category: 'instance creation',
  234. fn: function (){
  235. var self=this;
  236. return smalltalk.withContext(function($ctx1) {
  237. return new self.fn();
  238. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{},smalltalk.Behavior)})},
  239. args: [],
  240. source: "basicNew\x0a\x09<return new self.fn()>",
  241. messageSends: [],
  242. referencedClasses: []
  243. }),
  244. smalltalk.Behavior);
  245. smalltalk.addMethod(
  246. smalltalk.method({
  247. selector: "basicRemoveCompiledMethod:",
  248. category: 'private',
  249. fn: function (aMethod){
  250. var self=this;
  251. return smalltalk.withContext(function($ctx1) {
  252. smalltalk.removeMethod(aMethod,self);
  253. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  254. args: ["aMethod"],
  255. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<smalltalk.removeMethod(aMethod,self)>",
  256. messageSends: [],
  257. referencedClasses: []
  258. }),
  259. smalltalk.Behavior);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "canUnderstand:",
  263. category: 'testing',
  264. fn: function (aSelector){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) {
  267. var $3,$2,$4,$1;
  268. $1=_st(_st(_st(self._methodDictionary())._keys())._includes_(_st(aSelector)._asString()))._or_((function(){
  269. return smalltalk.withContext(function($ctx2) {
  270. $3=self._superclass();
  271. $ctx2.sendIdx["superclass"]=1;
  272. $2=_st($3)._notNil();
  273. return _st($2)._and_((function(){
  274. return smalltalk.withContext(function($ctx3) {
  275. $4=self._superclass();
  276. return _st($4)._canUnderstand_(aSelector);
  277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  279. return $1;
  280. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},smalltalk.Behavior)})},
  281. args: ["aSelector"],
  282. source: "canUnderstand: aSelector\x0a\x09^(self methodDictionary keys includes: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [self superclass canUnderstand: aSelector]]",
  283. messageSends: ["or:", "includes:", "keys", "methodDictionary", "asString", "and:", "notNil", "superclass", "canUnderstand:"],
  284. referencedClasses: []
  285. }),
  286. smalltalk.Behavior);
  287. smalltalk.addMethod(
  288. smalltalk.method({
  289. selector: "comment",
  290. category: 'accessing',
  291. fn: function (){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) {
  294. var $2,$1;
  295. $2=self._basicAt_("comment");
  296. if(($receiver = $2) == nil || $receiver == null){
  297. $1="";
  298. } else {
  299. $1=$2;
  300. };
  301. return $1;
  302. }, function($ctx1) {$ctx1.fill(self,"comment",{},smalltalk.Behavior)})},
  303. args: [],
  304. source: "comment\x0a\x09^(self basicAt: 'comment') ifNil: ['']",
  305. messageSends: ["ifNil:", "basicAt:"],
  306. referencedClasses: []
  307. }),
  308. smalltalk.Behavior);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "comment:",
  312. category: 'accessing',
  313. fn: function (aString){
  314. var self=this;
  315. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  316. function $ClassCommentChanged(){return smalltalk.ClassCommentChanged||(typeof ClassCommentChanged=="undefined"?nil:ClassCommentChanged)}
  317. return smalltalk.withContext(function($ctx1) {
  318. var $1,$2;
  319. self._basicAt_put_("comment",aString);
  320. $1=_st($ClassCommentChanged())._new();
  321. _st($1)._theClass_(self);
  322. $2=_st($1)._yourself();
  323. _st(_st($SystemAnnouncer())._current())._announce_($2);
  324. return self}, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},smalltalk.Behavior)})},
  325. args: ["aString"],
  326. source: "comment: aString\x0a\x09self basicAt: 'comment' put: aString.\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassCommentChanged new\x0a\x09\x09\x09theClass: self;\x0a\x09\x09\x09yourself)",
  327. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"],
  328. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"]
  329. }),
  330. smalltalk.Behavior);
  331. smalltalk.addMethod(
  332. smalltalk.method({
  333. selector: "commentStamp",
  334. category: 'accessing',
  335. fn: function (){
  336. var self=this;
  337. function $ClassCommentReader(){return smalltalk.ClassCommentReader||(typeof ClassCommentReader=="undefined"?nil:ClassCommentReader)}
  338. return smalltalk.withContext(function($ctx1) {
  339. var $2,$3,$1;
  340. $2=_st($ClassCommentReader())._new();
  341. _st($2)._class_(self);
  342. $3=_st($2)._yourself();
  343. $1=$3;
  344. return $1;
  345. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},smalltalk.Behavior)})},
  346. args: [],
  347. source: "commentStamp\x0a\x09^ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  348. messageSends: ["class:", "new", "yourself"],
  349. referencedClasses: ["ClassCommentReader"]
  350. }),
  351. smalltalk.Behavior);
  352. smalltalk.addMethod(
  353. smalltalk.method({
  354. selector: "commentStamp:prior:",
  355. category: 'accessing',
  356. fn: function (aStamp,prior){
  357. var self=this;
  358. return smalltalk.withContext(function($ctx1) {
  359. var $1;
  360. $1=self._commentStamp();
  361. return $1;
  362. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},smalltalk.Behavior)})},
  363. args: ["aStamp", "prior"],
  364. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^self commentStamp",
  365. messageSends: ["commentStamp"],
  366. referencedClasses: []
  367. }),
  368. smalltalk.Behavior);
  369. smalltalk.addMethod(
  370. smalltalk.method({
  371. selector: "compile:",
  372. category: 'compiling',
  373. fn: function (aString){
  374. var self=this;
  375. return smalltalk.withContext(function($ctx1) {
  376. var $1;
  377. $1=self._compile_category_(aString,"");
  378. return $1;
  379. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},smalltalk.Behavior)})},
  380. args: ["aString"],
  381. source: "compile: aString\x0a\x09^ self compile: aString category: ''",
  382. messageSends: ["compile:category:"],
  383. referencedClasses: []
  384. }),
  385. smalltalk.Behavior);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "compile:category:",
  389. category: 'compiling',
  390. fn: function (aString,anotherString){
  391. var self=this;
  392. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  393. return smalltalk.withContext(function($ctx1) {
  394. var $1;
  395. $1=_st(_st($Compiler())._new())._install_forClass_category_(aString,self,anotherString);
  396. return $1;
  397. }, function($ctx1) {$ctx1.fill(self,"compile:category:",{aString:aString,anotherString:anotherString},smalltalk.Behavior)})},
  398. args: ["aString", "anotherString"],
  399. source: "compile: aString category: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09category: anotherString",
  400. messageSends: ["install:forClass:category:", "new"],
  401. referencedClasses: ["Compiler"]
  402. }),
  403. smalltalk.Behavior);
  404. smalltalk.addMethod(
  405. smalltalk.method({
  406. selector: "definition",
  407. category: 'accessing',
  408. fn: function (){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) {
  411. return "";
  412. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Behavior)})},
  413. args: [],
  414. source: "definition\x0a\x09^ ''",
  415. messageSends: [],
  416. referencedClasses: []
  417. }),
  418. smalltalk.Behavior);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "includesBehavior:",
  422. category: 'testing',
  423. fn: function (aClass){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) {
  426. var $1;
  427. $1=_st(self.__eq_eq(aClass))._or_((function(){
  428. return smalltalk.withContext(function($ctx2) {
  429. return self._inheritsFrom_(aClass);
  430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  431. return $1;
  432. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},smalltalk.Behavior)})},
  433. args: ["aClass"],
  434. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  435. messageSends: ["or:", "==", "inheritsFrom:"],
  436. referencedClasses: []
  437. }),
  438. smalltalk.Behavior);
  439. smalltalk.addMethod(
  440. smalltalk.method({
  441. selector: "includesSelector:",
  442. category: 'testing',
  443. fn: function (aString){
  444. var self=this;
  445. return smalltalk.withContext(function($ctx1) {
  446. var $1;
  447. $1=_st(self._methodDictionary())._includesKey_(aString);
  448. return $1;
  449. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},smalltalk.Behavior)})},
  450. args: ["aString"],
  451. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  452. messageSends: ["includesKey:", "methodDictionary"],
  453. referencedClasses: []
  454. }),
  455. smalltalk.Behavior);
  456. smalltalk.addMethod(
  457. smalltalk.method({
  458. selector: "inheritsFrom:",
  459. category: 'testing',
  460. fn: function (aClass){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) {
  463. var $1,$4,$5,$3,$6,$2;
  464. $1=self._superclass();
  465. $ctx1.sendIdx["superclass"]=1;
  466. if(($receiver = $1) == nil || $receiver == null){
  467. return false;
  468. } else {
  469. $1;
  470. };
  471. $4=aClass;
  472. $5=self._superclass();
  473. $ctx1.sendIdx["superclass"]=2;
  474. $3=_st($4).__eq_eq($5);
  475. $2=_st($3)._or_((function(){
  476. return smalltalk.withContext(function($ctx2) {
  477. $6=self._superclass();
  478. return _st($6)._inheritsFrom_(aClass);
  479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  480. return $2;
  481. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},smalltalk.Behavior)})},
  482. args: ["aClass"],
  483. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  484. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"],
  485. referencedClasses: []
  486. }),
  487. smalltalk.Behavior);
  488. smalltalk.addMethod(
  489. smalltalk.method({
  490. selector: "instanceVariableNames",
  491. category: 'accessing',
  492. fn: function (){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) {
  495. return self.iVarNames;
  496. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},smalltalk.Behavior)})},
  497. args: [],
  498. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  499. messageSends: [],
  500. referencedClasses: []
  501. }),
  502. smalltalk.Behavior);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "isBehavior",
  506. category: 'testing',
  507. fn: function (){
  508. var self=this;
  509. return smalltalk.withContext(function($ctx1) {
  510. return true;
  511. }, function($ctx1) {$ctx1.fill(self,"isBehavior",{},smalltalk.Behavior)})},
  512. args: [],
  513. source: "isBehavior\x0a\x09^ true",
  514. messageSends: [],
  515. referencedClasses: []
  516. }),
  517. smalltalk.Behavior);
  518. smalltalk.addMethod(
  519. smalltalk.method({
  520. selector: "javascriptConstructor",
  521. category: 'accessing',
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) {
  525. return self.fn;
  526. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},smalltalk.Behavior)})},
  527. args: [],
  528. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  529. messageSends: [],
  530. referencedClasses: []
  531. }),
  532. smalltalk.Behavior);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "javascriptConstructor:",
  536. category: 'accessing',
  537. fn: function (aJavaScriptFunction){
  538. var self=this;
  539. return smalltalk.withContext(function($ctx1) {
  540. smalltalk.setClassConstructor(self, aJavaScriptFunction);;
  541. return self}, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},smalltalk.Behavior)})},
  542. args: ["aJavaScriptFunction"],
  543. source: "javascriptConstructor: aJavaScriptFunction\x0a\x09\x22Set the JS constructor used to instantiate.\x0a\x09See the JS counter-part in boot.js `smalltalk.setClassConstructor'\x22\x0a\x09\x0a\x09<smalltalk.setClassConstructor(self, aJavaScriptFunction);>",
  544. messageSends: [],
  545. referencedClasses: []
  546. }),
  547. smalltalk.Behavior);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "lookupSelector:",
  551. category: 'accessing',
  552. fn: function (selector){
  553. var self=this;
  554. var lookupClass;
  555. return smalltalk.withContext(function($ctx1) {
  556. var $1,$2;
  557. var $early={};
  558. try {
  559. lookupClass=self;
  560. _st((function(){
  561. return smalltalk.withContext(function($ctx2) {
  562. return _st(lookupClass).__eq(nil);
  563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  564. return smalltalk.withContext(function($ctx2) {
  565. $1=_st(lookupClass)._includesSelector_(selector);
  566. if(smalltalk.assert($1)){
  567. $2=_st(lookupClass)._methodAt_(selector);
  568. throw $early=[$2];
  569. };
  570. lookupClass=_st(lookupClass)._superclass();
  571. return lookupClass;
  572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  573. return nil;
  574. }
  575. catch(e) {if(e===$early)return e[0]; throw e}
  576. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},smalltalk.Behavior)})},
  577. args: ["selector"],
  578. 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\x09\x0a\x09| lookupClass |\x0a\x09\x0a\x09lookupClass := self.\x0a\x09[ lookupClass = nil ] whileFalse: [\x0a\x09\x09(lookupClass includesSelector: selector)\x0a\x09\x09\x09\x09ifTrue: [ ^ lookupClass methodAt: selector ].\x0a\x09\x09\x09lookupClass := lookupClass superclass ].\x0a\x09^ nil",
  579. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"],
  580. referencedClasses: []
  581. }),
  582. smalltalk.Behavior);
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "methodAt:",
  586. category: 'accessing',
  587. fn: function (aString){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) {
  590. var $1;
  591. $1=_st(self._methodDictionary())._at_(aString);
  592. return $1;
  593. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},smalltalk.Behavior)})},
  594. args: ["aString"],
  595. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  596. messageSends: ["at:", "methodDictionary"],
  597. referencedClasses: []
  598. }),
  599. smalltalk.Behavior);
  600. smalltalk.addMethod(
  601. smalltalk.method({
  602. selector: "methodDictionary",
  603. category: 'accessing',
  604. fn: function (){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) {
  607. var dict = smalltalk.HashedCollection._new();
  608. var methods = self.methods;
  609. for(var i in methods) {
  610. if(methods[i].selector) {
  611. dict._at_put_(methods[i].selector, methods[i]);
  612. }
  613. };
  614. return dict;
  615. return self}, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},smalltalk.Behavior)})},
  616. args: [],
  617. 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>",
  618. messageSends: [],
  619. referencedClasses: []
  620. }),
  621. smalltalk.Behavior);
  622. smalltalk.addMethod(
  623. smalltalk.method({
  624. selector: "methods",
  625. category: 'accessing',
  626. fn: function (){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) {
  629. var $1;
  630. $1=_st(self._methodDictionary())._values();
  631. return $1;
  632. }, function($ctx1) {$ctx1.fill(self,"methods",{},smalltalk.Behavior)})},
  633. args: [],
  634. source: "methods\x0a\x09^ self methodDictionary values",
  635. messageSends: ["values", "methodDictionary"],
  636. referencedClasses: []
  637. }),
  638. smalltalk.Behavior);
  639. smalltalk.addMethod(
  640. smalltalk.method({
  641. selector: "methodsFor:",
  642. category: 'accessing',
  643. fn: function (aString){
  644. var self=this;
  645. function $ClassCategoryReader(){return smalltalk.ClassCategoryReader||(typeof ClassCategoryReader=="undefined"?nil:ClassCategoryReader)}
  646. return smalltalk.withContext(function($ctx1) {
  647. var $2,$3,$1;
  648. $2=_st($ClassCategoryReader())._new();
  649. _st($2)._class_category_(self,aString);
  650. $3=_st($2)._yourself();
  651. $1=$3;
  652. return $1;
  653. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},smalltalk.Behavior)})},
  654. args: ["aString"],
  655. source: "methodsFor: aString\x0a\x09^ClassCategoryReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  656. messageSends: ["class:category:", "new", "yourself"],
  657. referencedClasses: ["ClassCategoryReader"]
  658. }),
  659. smalltalk.Behavior);
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "methodsFor:stamp:",
  663. category: 'accessing',
  664. fn: function (aString,aStamp){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $1;
  668. $1=self._methodsFor_(aString);
  669. return $1;
  670. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},smalltalk.Behavior)})},
  671. args: ["aString", "aStamp"],
  672. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for compatibility, right now ignores stamp.\x22\x0a\x09^self methodsFor: aString",
  673. messageSends: ["methodsFor:"],
  674. referencedClasses: []
  675. }),
  676. smalltalk.Behavior);
  677. smalltalk.addMethod(
  678. smalltalk.method({
  679. selector: "methodsInProtocol:",
  680. category: 'accessing',
  681. fn: function (aString){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. var $1;
  685. $1=_st(_st(self._methodDictionary())._values())._select_((function(each){
  686. return smalltalk.withContext(function($ctx2) {
  687. return _st(_st(each)._protocol()).__eq(aString);
  688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  689. return $1;
  690. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},smalltalk.Behavior)})},
  691. args: ["aString"],
  692. source: "methodsInProtocol: aString\x0a\x09^ self methodDictionary values select: [ :each | each protocol = aString ]",
  693. messageSends: ["select:", "values", "methodDictionary", "=", "protocol"],
  694. referencedClasses: []
  695. }),
  696. smalltalk.Behavior);
  697. smalltalk.addMethod(
  698. smalltalk.method({
  699. selector: "name",
  700. category: 'accessing',
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) {
  704. return self.className || nil;
  705. return self}, function($ctx1) {$ctx1.fill(self,"name",{},smalltalk.Behavior)})},
  706. args: [],
  707. source: "name\x0a\x09<return self.className || nil>",
  708. messageSends: [],
  709. referencedClasses: []
  710. }),
  711. smalltalk.Behavior);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "new",
  715. category: 'instance creation',
  716. fn: function (){
  717. var self=this;
  718. return smalltalk.withContext(function($ctx1) {
  719. var $1;
  720. $1=_st(self._basicNew())._initialize();
  721. return $1;
  722. }, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Behavior)})},
  723. args: [],
  724. source: "new\x0a\x09^self basicNew initialize",
  725. messageSends: ["initialize", "basicNew"],
  726. referencedClasses: []
  727. }),
  728. smalltalk.Behavior);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "organization",
  732. category: 'accessing',
  733. fn: function (){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. var $1;
  737. $1=self._basicAt_("organization");
  738. return $1;
  739. }, function($ctx1) {$ctx1.fill(self,"organization",{},smalltalk.Behavior)})},
  740. args: [],
  741. source: "organization\x0a\x09^ self basicAt: 'organization'",
  742. messageSends: ["basicAt:"],
  743. referencedClasses: []
  744. }),
  745. smalltalk.Behavior);
  746. smalltalk.addMethod(
  747. smalltalk.method({
  748. selector: "ownMethods",
  749. category: 'accessing',
  750. fn: function (){
  751. var self=this;
  752. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  753. return smalltalk.withContext(function($ctx1) {
  754. var $2,$3,$1;
  755. $1=_st(_st(self._ownProtocols())._inject_into_(_st($OrderedCollection())._new(),(function(acc,each){
  756. return smalltalk.withContext(function($ctx2) {
  757. return _st(acc).__comma(self._methodsInProtocol_(each));
  758. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)})})))._sorted_((function(a,b){
  759. return smalltalk.withContext(function($ctx2) {
  760. $2=_st(a)._selector();
  761. $ctx2.sendIdx["selector"]=1;
  762. $3=_st(b)._selector();
  763. return _st($2).__lt_eq($3);
  764. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}));
  765. return $1;
  766. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},smalltalk.Behavior)})},
  767. args: [],
  768. source: "ownMethods\x0a\x09\x22Answer the methods of the receiver that are not package extensions\x22\x0a\x0a\x09^ (self ownProtocols \x0a\x09\x09inject: OrderedCollection new\x0a\x09\x09into: [ :acc :each | acc, (self methodsInProtocol: each) ])\x0a\x09\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  769. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"],
  770. referencedClasses: ["OrderedCollection"]
  771. }),
  772. smalltalk.Behavior);
  773. smalltalk.addMethod(
  774. smalltalk.method({
  775. selector: "ownProtocols",
  776. category: 'accessing',
  777. fn: function (){
  778. var self=this;
  779. return smalltalk.withContext(function($ctx1) {
  780. var $1;
  781. $1=_st(self._protocols())._reject_((function(each){
  782. return smalltalk.withContext(function($ctx2) {
  783. return _st(each)._match_("^\x5c*");
  784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  785. return $1;
  786. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},smalltalk.Behavior)})},
  787. args: [],
  788. source: "ownProtocols\x0a\x09\x22Answer the protocols of the receiver that are not package extensions\x22\x0a\x0a\x09^ self protocols reject: [ :each |\x0a\x09\x09each match: '^\x5c*' ]",
  789. messageSends: ["reject:", "protocols", "match:"],
  790. referencedClasses: []
  791. }),
  792. smalltalk.Behavior);
  793. smalltalk.addMethod(
  794. smalltalk.method({
  795. selector: "protocols",
  796. category: 'accessing',
  797. fn: function (){
  798. var self=this;
  799. return smalltalk.withContext(function($ctx1) {
  800. var $1;
  801. $1=_st(_st(self._organization())._elements())._sorted();
  802. return $1;
  803. }, function($ctx1) {$ctx1.fill(self,"protocols",{},smalltalk.Behavior)})},
  804. args: [],
  805. source: "protocols\x0a\x09^ self organization elements sorted",
  806. messageSends: ["sorted", "elements", "organization"],
  807. referencedClasses: []
  808. }),
  809. smalltalk.Behavior);
  810. smalltalk.addMethod(
  811. smalltalk.method({
  812. selector: "protocolsDo:",
  813. category: 'enumerating',
  814. fn: function (aBlock){
  815. var self=this;
  816. var methodsByCategory;
  817. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  818. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  819. return smalltalk.withContext(function($ctx1) {
  820. var $1,$2;
  821. methodsByCategory=_st($HashedCollection())._new();
  822. $ctx1.sendIdx["new"]=1;
  823. $1=_st(_st(self._methodDictionary())._values())._do_((function(m){
  824. return smalltalk.withContext(function($ctx2) {
  825. return _st(_st(methodsByCategory)._at_ifAbsentPut_(_st(m)._category(),(function(){
  826. return smalltalk.withContext(function($ctx3) {
  827. return _st($Array())._new();
  828. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})})))._add_(m);
  829. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)})}));
  830. $ctx1.sendIdx["do:"]=1;
  831. $2=_st(self._protocols())._do_((function(category){
  832. return smalltalk.withContext(function($ctx2) {
  833. return _st(aBlock)._value_value_(category,_st(methodsByCategory)._at_(category));
  834. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1,3)})}));
  835. return self}, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByCategory:methodsByCategory},smalltalk.Behavior)})},
  836. args: ["aBlock"],
  837. 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)]",
  838. messageSends: ["new", "do:", "values", "methodDictionary", "add:", "at:ifAbsentPut:", "category", "protocols", "value:value:", "at:"],
  839. referencedClasses: ["HashedCollection", "Array"]
  840. }),
  841. smalltalk.Behavior);
  842. smalltalk.addMethod(
  843. smalltalk.method({
  844. selector: "prototype",
  845. category: 'accessing',
  846. fn: function (){
  847. var self=this;
  848. return smalltalk.withContext(function($ctx1) {
  849. return self.fn.prototype;
  850. return self}, function($ctx1) {$ctx1.fill(self,"prototype",{},smalltalk.Behavior)})},
  851. args: [],
  852. source: "prototype\x0a\x09<return self.fn.prototype>",
  853. messageSends: [],
  854. referencedClasses: []
  855. }),
  856. smalltalk.Behavior);
  857. smalltalk.addMethod(
  858. smalltalk.method({
  859. selector: "recompile",
  860. category: 'compiling',
  861. fn: function (){
  862. var self=this;
  863. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  864. return smalltalk.withContext(function($ctx1) {
  865. var $1;
  866. $1=_st(_st($Compiler())._new())._recompile_(self);
  867. return $1;
  868. }, function($ctx1) {$ctx1.fill(self,"recompile",{},smalltalk.Behavior)})},
  869. args: [],
  870. source: "recompile\x0a\x09^ Compiler new recompile: self",
  871. messageSends: ["recompile:", "new"],
  872. referencedClasses: ["Compiler"]
  873. }),
  874. smalltalk.Behavior);
  875. smalltalk.addMethod(
  876. smalltalk.method({
  877. selector: "removeCompiledMethod:",
  878. category: 'compiling',
  879. fn: function (aMethod){
  880. var self=this;
  881. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  882. function $MethodRemoved(){return smalltalk.MethodRemoved||(typeof MethodRemoved=="undefined"?nil:MethodRemoved)}
  883. return smalltalk.withContext(function($ctx1) {
  884. var $1,$2,$3,$4,$5,$6;
  885. self._basicRemoveCompiledMethod_(aMethod);
  886. _st(self._methods())._detect_ifNone_((function(each){
  887. return smalltalk.withContext(function($ctx2) {
  888. $1=_st(each)._protocol();
  889. $ctx2.sendIdx["protocol"]=1;
  890. $2=_st(aMethod)._protocol();
  891. $ctx2.sendIdx["protocol"]=2;
  892. return _st($1).__eq($2);
  893. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  894. return smalltalk.withContext(function($ctx2) {
  895. $3=self._organization();
  896. $4=_st(aMethod)._protocol();
  897. return _st($3)._removeElement_($4);
  898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  899. $5=_st($MethodRemoved())._new();
  900. _st($5)._method_(aMethod);
  901. $6=_st($5)._yourself();
  902. _st(_st($SystemAnnouncer())._current())._announce_($6);
  903. return self}, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},smalltalk.Behavior)})},
  904. args: ["aMethod"],
  905. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aMethod protocol ]\x0a\x09\x09ifNone: [ self organization removeElement: aMethod protocol ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  906. messageSends: ["basicRemoveCompiledMethod:", "detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization", "announce:", "current", "method:", "new", "yourself"],
  907. referencedClasses: ["SystemAnnouncer", "MethodRemoved"]
  908. }),
  909. smalltalk.Behavior);
  910. smalltalk.addMethod(
  911. smalltalk.method({
  912. selector: "selectors",
  913. category: 'accessing',
  914. fn: function (){
  915. var self=this;
  916. return smalltalk.withContext(function($ctx1) {
  917. var $1;
  918. $1=_st(self._methodDictionary())._keys();
  919. return $1;
  920. }, function($ctx1) {$ctx1.fill(self,"selectors",{},smalltalk.Behavior)})},
  921. args: [],
  922. source: "selectors\x0a\x09^ self methodDictionary keys",
  923. messageSends: ["keys", "methodDictionary"],
  924. referencedClasses: []
  925. }),
  926. smalltalk.Behavior);
  927. smalltalk.addMethod(
  928. smalltalk.method({
  929. selector: "subclasses",
  930. category: 'accessing',
  931. fn: function (){
  932. var self=this;
  933. return smalltalk.withContext(function($ctx1) {
  934. self._subclassResponsibility();
  935. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Behavior)})},
  936. args: [],
  937. source: "subclasses\x0a\x09self subclassResponsibility",
  938. messageSends: ["subclassResponsibility"],
  939. referencedClasses: []
  940. }),
  941. smalltalk.Behavior);
  942. smalltalk.addMethod(
  943. smalltalk.method({
  944. selector: "superclass",
  945. category: 'accessing',
  946. fn: function (){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. return self.superclass || nil;
  950. return self}, function($ctx1) {$ctx1.fill(self,"superclass",{},smalltalk.Behavior)})},
  951. args: [],
  952. source: "superclass\x0a\x09<return self.superclass || nil>",
  953. messageSends: [],
  954. referencedClasses: []
  955. }),
  956. smalltalk.Behavior);
  957. smalltalk.addMethod(
  958. smalltalk.method({
  959. selector: "theMetaClass",
  960. category: 'accessing',
  961. fn: function (){
  962. var self=this;
  963. return smalltalk.withContext(function($ctx1) {
  964. var $1;
  965. $1=self._class();
  966. return $1;
  967. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Behavior)})},
  968. args: [],
  969. source: "theMetaClass\x0a\x09^ self class",
  970. messageSends: ["class"],
  971. referencedClasses: []
  972. }),
  973. smalltalk.Behavior);
  974. smalltalk.addMethod(
  975. smalltalk.method({
  976. selector: "theNonMetaClass",
  977. category: 'accessing',
  978. fn: function (){
  979. var self=this;
  980. return smalltalk.withContext(function($ctx1) {
  981. return self;
  982. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Behavior)})},
  983. args: [],
  984. source: "theNonMetaClass\x0a\x09^ self",
  985. messageSends: [],
  986. referencedClasses: []
  987. }),
  988. smalltalk.Behavior);
  989. smalltalk.addMethod(
  990. smalltalk.method({
  991. selector: "withAllSubclasses",
  992. category: 'accessing',
  993. fn: function (){
  994. var self=this;
  995. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  996. return smalltalk.withContext(function($ctx1) {
  997. var $2,$3,$1;
  998. $2=_st($Array())._with_(self);
  999. _st($2)._addAll_(self._allSubclasses());
  1000. $3=_st($2)._yourself();
  1001. $1=$3;
  1002. return $1;
  1003. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},smalltalk.Behavior)})},
  1004. args: [],
  1005. source: "withAllSubclasses\x0a\x09^(Array with: self) addAll: self allSubclasses; yourself",
  1006. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"],
  1007. referencedClasses: ["Array"]
  1008. }),
  1009. smalltalk.Behavior);
  1010. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel-Classes');
  1011. smalltalk.Class.comment="I am __the__ class object.\x0a\x0aMy instances are the classes of the system.\x0aClass creation is done throught a `ClassBuilder` instance.";
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "asJavascript",
  1015. category: 'converting',
  1016. fn: function (){
  1017. var self=this;
  1018. return smalltalk.withContext(function($ctx1) {
  1019. var $1;
  1020. $1="smalltalk.".__comma(self._name());
  1021. return $1;
  1022. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Class)})},
  1023. args: [],
  1024. source: "asJavascript\x0a\x09^ 'smalltalk.', self name",
  1025. messageSends: [",", "name"],
  1026. referencedClasses: []
  1027. }),
  1028. smalltalk.Class);
  1029. smalltalk.addMethod(
  1030. smalltalk.method({
  1031. selector: "category",
  1032. category: 'accessing',
  1033. fn: function (){
  1034. var self=this;
  1035. return smalltalk.withContext(function($ctx1) {
  1036. var $2,$3,$1;
  1037. $2=self._package();
  1038. $ctx1.sendIdx["package"]=1;
  1039. if(($receiver = $2) == nil || $receiver == null){
  1040. $1="Unclassified";
  1041. } else {
  1042. $3=self._package();
  1043. $1=_st($3)._name();
  1044. };
  1045. return $1;
  1046. }, function($ctx1) {$ctx1.fill(self,"category",{},smalltalk.Class)})},
  1047. args: [],
  1048. source: "category\x0a\x09^self package ifNil: ['Unclassified'] ifNotNil: [self package name]",
  1049. messageSends: ["ifNil:ifNotNil:", "package", "name"],
  1050. referencedClasses: []
  1051. }),
  1052. smalltalk.Class);
  1053. smalltalk.addMethod(
  1054. smalltalk.method({
  1055. selector: "definition",
  1056. category: 'accessing',
  1057. fn: function (){
  1058. var self=this;
  1059. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1060. return smalltalk.withContext(function($ctx1) {
  1061. var $2,$3,$5,$6,$4,$7,$8,$9,$12,$11,$13,$10,$14,$1;
  1062. $1=_st($String())._streamContents_((function(stream){
  1063. return smalltalk.withContext(function($ctx2) {
  1064. $2=stream;
  1065. _st($2)._nextPutAll_(_st(self._superclass())._asString());
  1066. $ctx2.sendIdx["nextPutAll:"]=1;
  1067. _st($2)._nextPutAll_(" subclass: #");
  1068. $ctx2.sendIdx["nextPutAll:"]=2;
  1069. _st($2)._nextPutAll_(self._name());
  1070. $ctx2.sendIdx["nextPutAll:"]=3;
  1071. $3=$2;
  1072. $5=_st($String())._lf();
  1073. $ctx2.sendIdx["lf"]=1;
  1074. $6=_st($String())._tab();
  1075. $ctx2.sendIdx["tab"]=1;
  1076. $4=_st($5).__comma($6);
  1077. $ctx2.sendIdx[","]=1;
  1078. _st($3)._nextPutAll_($4);
  1079. $ctx2.sendIdx["nextPutAll:"]=4;
  1080. $7=_st($2)._nextPutAll_("instanceVariableNames: '");
  1081. $ctx2.sendIdx["nextPutAll:"]=5;
  1082. $7;
  1083. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  1084. return smalltalk.withContext(function($ctx3) {
  1085. return _st(stream)._nextPutAll_(each);
  1086. $ctx3.sendIdx["nextPutAll:"]=6;
  1087. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1088. return smalltalk.withContext(function($ctx3) {
  1089. return _st(stream)._nextPutAll_(" ");
  1090. $ctx3.sendIdx["nextPutAll:"]=7;
  1091. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1092. $8=stream;
  1093. $9=$8;
  1094. $12=_st($String())._lf();
  1095. $11="'".__comma($12);
  1096. $13=_st($String())._tab();
  1097. $10=_st($11).__comma($13);
  1098. $ctx2.sendIdx[","]=2;
  1099. _st($9)._nextPutAll_($10);
  1100. $ctx2.sendIdx["nextPutAll:"]=8;
  1101. _st($8)._nextPutAll_("package: '");
  1102. $ctx2.sendIdx["nextPutAll:"]=9;
  1103. _st($8)._nextPutAll_(self._category());
  1104. $ctx2.sendIdx["nextPutAll:"]=10;
  1105. $14=_st($8)._nextPutAll_("'");
  1106. return $14;
  1107. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1108. return $1;
  1109. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Class)})},
  1110. args: [],
  1111. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self superclass asString;\x0a\x09\x09\x09nextPutAll: ' subclass: #';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self category;\x0a\x09\x09\x09nextPutAll: '''' ]",
  1112. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"],
  1113. referencedClasses: ["String"]
  1114. }),
  1115. smalltalk.Class);
  1116. smalltalk.addMethod(
  1117. smalltalk.method({
  1118. selector: "isClass",
  1119. category: 'testing',
  1120. fn: function (){
  1121. var self=this;
  1122. return smalltalk.withContext(function($ctx1) {
  1123. return true;
  1124. }, function($ctx1) {$ctx1.fill(self,"isClass",{},smalltalk.Class)})},
  1125. args: [],
  1126. source: "isClass\x0a\x09^true",
  1127. messageSends: [],
  1128. referencedClasses: []
  1129. }),
  1130. smalltalk.Class);
  1131. smalltalk.addMethod(
  1132. smalltalk.method({
  1133. selector: "package",
  1134. category: 'accessing',
  1135. fn: function (){
  1136. var self=this;
  1137. return smalltalk.withContext(function($ctx1) {
  1138. var $1;
  1139. $1=self._basicAt_("pkg");
  1140. return $1;
  1141. }, function($ctx1) {$ctx1.fill(self,"package",{},smalltalk.Class)})},
  1142. args: [],
  1143. source: "package\x0a\x09^ self basicAt: 'pkg'",
  1144. messageSends: ["basicAt:"],
  1145. referencedClasses: []
  1146. }),
  1147. smalltalk.Class);
  1148. smalltalk.addMethod(
  1149. smalltalk.method({
  1150. selector: "package:",
  1151. category: 'accessing',
  1152. fn: function (aPackage){
  1153. var self=this;
  1154. var oldPackage;
  1155. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1156. function $ClassMoved(){return smalltalk.ClassMoved||(typeof ClassMoved=="undefined"?nil:ClassMoved)}
  1157. return smalltalk.withContext(function($ctx1) {
  1158. var $2,$1,$3,$4,$5,$6;
  1159. $2=self._package();
  1160. $ctx1.sendIdx["package"]=1;
  1161. $1=_st($2).__eq(aPackage);
  1162. if(smalltalk.assert($1)){
  1163. return self;
  1164. };
  1165. oldPackage=self._package();
  1166. self._basicAt_put_("pkg",aPackage);
  1167. $3=_st(oldPackage)._organization();
  1168. $ctx1.sendIdx["organization"]=1;
  1169. _st($3)._removeElement_(self);
  1170. $4=_st(aPackage)._organization();
  1171. _st($4)._addElement_(self);
  1172. $5=_st($ClassMoved())._new();
  1173. _st($5)._theClass_(self);
  1174. _st($5)._oldPackage_(oldPackage);
  1175. $6=_st($5)._yourself();
  1176. _st(_st($SystemAnnouncer())._current())._announce_($6);
  1177. return self}, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},smalltalk.Class)})},
  1178. args: ["aPackage"],
  1179. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self basicAt: 'pkg' put: aPackage.\x0a\x09oldPackage organization removeElement: self.\x0a\x09aPackage organization addElement: self.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  1180. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"],
  1181. referencedClasses: ["SystemAnnouncer", "ClassMoved"]
  1182. }),
  1183. smalltalk.Class);
  1184. smalltalk.addMethod(
  1185. smalltalk.method({
  1186. selector: "printOn:",
  1187. category: 'printing',
  1188. fn: function (aStream){
  1189. var self=this;
  1190. return smalltalk.withContext(function($ctx1) {
  1191. _st(aStream)._nextPutAll_(self._name());
  1192. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Class)})},
  1193. args: ["aStream"],
  1194. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  1195. messageSends: ["nextPutAll:", "name"],
  1196. referencedClasses: []
  1197. }),
  1198. smalltalk.Class);
  1199. smalltalk.addMethod(
  1200. smalltalk.method({
  1201. selector: "rename:",
  1202. category: 'accessing',
  1203. fn: function (aString){
  1204. var self=this;
  1205. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1206. return smalltalk.withContext(function($ctx1) {
  1207. _st(_st($ClassBuilder())._new())._renameClass_to_(self,aString);
  1208. return self}, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},smalltalk.Class)})},
  1209. args: ["aString"],
  1210. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  1211. messageSends: ["renameClass:to:", "new"],
  1212. referencedClasses: ["ClassBuilder"]
  1213. }),
  1214. smalltalk.Class);
  1215. smalltalk.addMethod(
  1216. smalltalk.method({
  1217. selector: "subclass:instanceVariableNames:",
  1218. category: 'class creation',
  1219. fn: function (aString,anotherString){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. var $1;
  1223. $1=self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  1224. return $1;
  1225. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},smalltalk.Class)})},
  1226. args: ["aString", "anotherString"],
  1227. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for compatibility.\x22\x0a\x09^self subclass: aString instanceVariableNames: anotherString package: nil",
  1228. messageSends: ["subclass:instanceVariableNames:package:"],
  1229. referencedClasses: []
  1230. }),
  1231. smalltalk.Class);
  1232. smalltalk.addMethod(
  1233. smalltalk.method({
  1234. selector: "subclass:instanceVariableNames:category:",
  1235. category: 'class creation',
  1236. fn: function (aString,aString2,aString3){
  1237. var self=this;
  1238. return smalltalk.withContext(function($ctx1) {
  1239. var $1;
  1240. self._deprecatedAPI();
  1241. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  1242. return $1;
  1243. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  1244. args: ["aString", "aString2", "aString3"],
  1245. 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",
  1246. messageSends: ["deprecatedAPI", "subclass:instanceVariableNames:package:"],
  1247. referencedClasses: []
  1248. }),
  1249. smalltalk.Class);
  1250. smalltalk.addMethod(
  1251. smalltalk.method({
  1252. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  1253. category: 'class creation',
  1254. fn: function (aString,aString2,classVars,pools,aString3){
  1255. var self=this;
  1256. return smalltalk.withContext(function($ctx1) {
  1257. var $1;
  1258. $1=self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  1259. return $1;
  1260. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},smalltalk.Class)})},
  1261. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  1262. 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",
  1263. messageSends: ["subclass:instanceVariableNames:package:"],
  1264. referencedClasses: []
  1265. }),
  1266. smalltalk.Class);
  1267. smalltalk.addMethod(
  1268. smalltalk.method({
  1269. selector: "subclass:instanceVariableNames:package:",
  1270. category: 'class creation',
  1271. fn: function (aString,aString2,aString3){
  1272. var self=this;
  1273. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1274. return smalltalk.withContext(function($ctx1) {
  1275. var $1;
  1276. $1=_st(_st($ClassBuilder())._new())._superclass_subclass_instanceVariableNames_package_(self,_st(aString)._asString(),aString2,aString3);
  1277. return $1;
  1278. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},smalltalk.Class)})},
  1279. args: ["aString", "aString2", "aString3"],
  1280. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  1281. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"],
  1282. referencedClasses: ["ClassBuilder"]
  1283. }),
  1284. smalltalk.Class);
  1285. smalltalk.addMethod(
  1286. smalltalk.method({
  1287. selector: "subclasses",
  1288. category: 'accessing',
  1289. fn: function (){
  1290. var self=this;
  1291. return smalltalk.withContext(function($ctx1) {
  1292. return self.subclasses._copy();
  1293. return self}, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Class)})},
  1294. args: [],
  1295. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  1296. messageSends: [],
  1297. referencedClasses: []
  1298. }),
  1299. smalltalk.Class);
  1300. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel-Classes');
  1301. smalltalk.Metaclass.comment="I am the root of the class hierarchy.\x0a\x0aMy instances are metaclasses, one for each real class, and have a single instance, which they hold onto: the class that they are the metaclass of.";
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "asJavascript",
  1305. category: 'converting',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. var $2,$1;
  1310. $2="smalltalk.".__comma(_st(self._instanceClass())._name());
  1311. $1=_st($2).__comma(".klass");
  1312. $ctx1.sendIdx[","]=1;
  1313. return $1;
  1314. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},smalltalk.Metaclass)})},
  1315. args: [],
  1316. source: "asJavascript\x0a\x09^ 'smalltalk.', self instanceClass name, '.klass'",
  1317. messageSends: [",", "name", "instanceClass"],
  1318. referencedClasses: []
  1319. }),
  1320. smalltalk.Metaclass);
  1321. smalltalk.addMethod(
  1322. smalltalk.method({
  1323. selector: "definition",
  1324. category: 'accessing',
  1325. fn: function (){
  1326. var self=this;
  1327. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1328. return smalltalk.withContext(function($ctx1) {
  1329. var $2,$3,$1;
  1330. $1=_st($String())._streamContents_((function(stream){
  1331. return smalltalk.withContext(function($ctx2) {
  1332. $2=stream;
  1333. _st($2)._nextPutAll_(self._asString());
  1334. $ctx2.sendIdx["nextPutAll:"]=1;
  1335. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  1336. $ctx2.sendIdx["nextPutAll:"]=2;
  1337. $3;
  1338. _st(self._instanceVariableNames())._do_separatedBy_((function(each){
  1339. return smalltalk.withContext(function($ctx3) {
  1340. return _st(stream)._nextPutAll_(each);
  1341. $ctx3.sendIdx["nextPutAll:"]=3;
  1342. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  1343. return smalltalk.withContext(function($ctx3) {
  1344. return _st(stream)._nextPutAll_(" ");
  1345. $ctx3.sendIdx["nextPutAll:"]=4;
  1346. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  1347. return _st(stream)._nextPutAll_("'");
  1348. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  1349. return $1;
  1350. }, function($ctx1) {$ctx1.fill(self,"definition",{},smalltalk.Metaclass)})},
  1351. args: [],
  1352. source: "definition\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: self asString;\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09self instanceVariableNames\x0a\x09\x09\x09do: [ :each | stream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ stream nextPutAll: ' ' ].\x0a\x09\x09stream nextPutAll: '''' ]",
  1353. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"],
  1354. referencedClasses: ["String"]
  1355. }),
  1356. smalltalk.Metaclass);
  1357. smalltalk.addMethod(
  1358. smalltalk.method({
  1359. selector: "instanceClass",
  1360. category: 'accessing',
  1361. fn: function (){
  1362. var self=this;
  1363. return smalltalk.withContext(function($ctx1) {
  1364. return self.instanceClass;
  1365. return self}, function($ctx1) {$ctx1.fill(self,"instanceClass",{},smalltalk.Metaclass)})},
  1366. args: [],
  1367. source: "instanceClass\x0a\x09<return self.instanceClass>",
  1368. messageSends: [],
  1369. referencedClasses: []
  1370. }),
  1371. smalltalk.Metaclass);
  1372. smalltalk.addMethod(
  1373. smalltalk.method({
  1374. selector: "instanceVariableNames:",
  1375. category: 'accessing',
  1376. fn: function (aCollection){
  1377. var self=this;
  1378. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1379. return smalltalk.withContext(function($ctx1) {
  1380. _st(_st($ClassBuilder())._new())._class_instanceVariableNames_(self,aCollection);
  1381. return self}, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},smalltalk.Metaclass)})},
  1382. args: ["aCollection"],
  1383. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  1384. messageSends: ["class:instanceVariableNames:", "new"],
  1385. referencedClasses: ["ClassBuilder"]
  1386. }),
  1387. smalltalk.Metaclass);
  1388. smalltalk.addMethod(
  1389. smalltalk.method({
  1390. selector: "isMetaclass",
  1391. category: 'testing',
  1392. fn: function (){
  1393. var self=this;
  1394. return smalltalk.withContext(function($ctx1) {
  1395. return true;
  1396. }, function($ctx1) {$ctx1.fill(self,"isMetaclass",{},smalltalk.Metaclass)})},
  1397. args: [],
  1398. source: "isMetaclass\x0a\x09^true",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. smalltalk.Metaclass);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "printOn:",
  1406. category: 'printing',
  1407. fn: function (aStream){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1,$2;
  1411. $1=aStream;
  1412. _st($1)._nextPutAll_(_st(self._instanceClass())._name());
  1413. $ctx1.sendIdx["nextPutAll:"]=1;
  1414. $2=_st($1)._nextPutAll_(" class");
  1415. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},smalltalk.Metaclass)})},
  1416. args: ["aStream"],
  1417. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  1418. messageSends: ["nextPutAll:", "name", "instanceClass"],
  1419. referencedClasses: []
  1420. }),
  1421. smalltalk.Metaclass);
  1422. smalltalk.addMethod(
  1423. smalltalk.method({
  1424. selector: "subclasses",
  1425. category: 'accessing',
  1426. fn: function (){
  1427. var self=this;
  1428. return smalltalk.withContext(function($ctx1) {
  1429. var $1;
  1430. $1=_st(_st(_st(self._instanceClass())._subclasses())._select_((function(each){
  1431. return smalltalk.withContext(function($ctx2) {
  1432. return _st(_st(each)._isMetaclass())._not();
  1433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._collect_((function(each){
  1434. return smalltalk.withContext(function($ctx2) {
  1435. return _st(each)._theMetaClass();
  1436. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1437. return $1;
  1438. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},smalltalk.Metaclass)})},
  1439. args: [],
  1440. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  1441. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"],
  1442. referencedClasses: []
  1443. }),
  1444. smalltalk.Metaclass);
  1445. smalltalk.addMethod(
  1446. smalltalk.method({
  1447. selector: "theMetaClass",
  1448. category: 'accessing',
  1449. fn: function (){
  1450. var self=this;
  1451. return smalltalk.withContext(function($ctx1) {
  1452. return self;
  1453. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},smalltalk.Metaclass)})},
  1454. args: [],
  1455. source: "theMetaClass\x0a\x09^ self",
  1456. messageSends: [],
  1457. referencedClasses: []
  1458. }),
  1459. smalltalk.Metaclass);
  1460. smalltalk.addMethod(
  1461. smalltalk.method({
  1462. selector: "theNonMetaClass",
  1463. category: 'accessing',
  1464. fn: function (){
  1465. var self=this;
  1466. return smalltalk.withContext(function($ctx1) {
  1467. var $1;
  1468. $1=self._instanceClass();
  1469. return $1;
  1470. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},smalltalk.Metaclass)})},
  1471. args: [],
  1472. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  1473. messageSends: ["instanceClass"],
  1474. referencedClasses: []
  1475. }),
  1476. smalltalk.Metaclass);
  1477. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel-Classes');
  1478. smalltalk.ClassBuilder.comment="I am responsible for compiling new classes or modifying existing classes in the system.\x0a\x0aRather than using me directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.";
  1479. smalltalk.addMethod(
  1480. smalltalk.method({
  1481. selector: "addSubclassOf:named:instanceVariableNames:package:",
  1482. category: 'class definition',
  1483. fn: function (aClass,className,aCollection,packageName){
  1484. var self=this;
  1485. var theClass,thePackage;
  1486. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1487. return smalltalk.withContext(function($ctx1) {
  1488. var $1,$2,$3,$4;
  1489. theClass=_st(_st($Smalltalk())._current())._at_(className);
  1490. thePackage=self._createPackageNamed_(packageName);
  1491. $1=theClass;
  1492. if(($receiver = $1) == nil || $receiver == null){
  1493. $1;
  1494. } else {
  1495. _st(theClass)._package_(thePackage);
  1496. $2=_st(_st(theClass)._superclass()).__eq_eq(aClass);
  1497. if(! smalltalk.assert($2)){
  1498. $3=self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  1499. return $3;
  1500. };
  1501. };
  1502. $4=self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  1503. return $4;
  1504. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},smalltalk.ClassBuilder)})},
  1505. args: ["aClass", "className", "aCollection", "packageName"],
  1506. source: "addSubclassOf: aClass named: className instanceVariableNames: aCollection package: packageName\x0a\x09| theClass thePackage |\x0a\x09\x0a\x09theClass := Smalltalk current at: className.\x0a\x09thePackage := self createPackageNamed: packageName.\x0a\x09\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass package: thePackage.\x0a\x09\x09theClass superclass == aClass ifFalse: [\x0a\x09\x09\x09^ self\x0a\x09\x09\x09\x09migrateClassNamed: className\x0a\x09\x09\x09\x09superclass: aClass\x0a\x09\x09\x09\x09instanceVariableNames: aCollection\x0a\x09\x09\x09\x09package: packageName ] ].\x0a\x09\x09\x0a\x09^ self\x0a\x09\x09basicAddSubclassOf: aClass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aCollection\x0a\x09\x09package: packageName",
  1507. messageSends: ["at:", "current", "createPackageNamed:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"],
  1508. referencedClasses: ["Smalltalk"]
  1509. }),
  1510. smalltalk.ClassBuilder);
  1511. smalltalk.addMethod(
  1512. smalltalk.method({
  1513. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  1514. category: 'private',
  1515. fn: function (aClass,aString,aCollection,packageName){
  1516. var self=this;
  1517. return smalltalk.withContext(function($ctx1) {
  1518. smalltalk.addClass(aString, aClass, aCollection, packageName);
  1519. return smalltalk[aString]
  1520. ;
  1521. return self}, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},smalltalk.ClassBuilder)})},
  1522. args: ["aClass", "aString", "aCollection", "packageName"],
  1523. 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>",
  1524. messageSends: [],
  1525. referencedClasses: []
  1526. }),
  1527. smalltalk.ClassBuilder);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "basicClass:instanceVariableNames:",
  1531. category: 'private',
  1532. fn: function (aClass,aString){
  1533. var self=this;
  1534. return smalltalk.withContext(function($ctx1) {
  1535. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  1536. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  1537. args: ["aClass", "aString"],
  1538. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  1539. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"],
  1540. referencedClasses: []
  1541. }),
  1542. smalltalk.ClassBuilder);
  1543. smalltalk.addMethod(
  1544. smalltalk.method({
  1545. selector: "basicClass:instanceVariables:",
  1546. category: 'private',
  1547. fn: function (aClass,aCollection){
  1548. var self=this;
  1549. return smalltalk.withContext(function($ctx1) {
  1550. var $1;
  1551. $1=_st(aClass)._isMetaclass();
  1552. if(! smalltalk.assert($1)){
  1553. self._error_(_st(_st(aClass)._name()).__comma(" is not a metaclass"));
  1554. };
  1555. _st(aClass)._basicAt_put_("iVarNames",aCollection);
  1556. return self}, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},smalltalk.ClassBuilder)})},
  1557. args: ["aClass", "aCollection"],
  1558. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  1559. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"],
  1560. referencedClasses: []
  1561. }),
  1562. smalltalk.ClassBuilder);
  1563. smalltalk.addMethod(
  1564. smalltalk.method({
  1565. selector: "basicRemoveClass:",
  1566. category: 'private',
  1567. fn: function (aClass){
  1568. var self=this;
  1569. return smalltalk.withContext(function($ctx1) {
  1570. smalltalk.removeClass(aClass);
  1571. return self}, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  1572. args: ["aClass"],
  1573. source: "basicRemoveClass: aClass\x0a\x09<smalltalk.removeClass(aClass)>",
  1574. messageSends: [],
  1575. referencedClasses: []
  1576. }),
  1577. smalltalk.ClassBuilder);
  1578. smalltalk.addMethod(
  1579. smalltalk.method({
  1580. selector: "basicRenameClass:to:",
  1581. category: 'private',
  1582. fn: function (aClass,aString){
  1583. var self=this;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. smalltalk[aString] = aClass;
  1586. delete smalltalk[aClass.className];
  1587. aClass.className = aString;
  1588. ;
  1589. return self}, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  1590. args: ["aClass", "aString"],
  1591. 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>",
  1592. messageSends: [],
  1593. referencedClasses: []
  1594. }),
  1595. smalltalk.ClassBuilder);
  1596. smalltalk.addMethod(
  1597. smalltalk.method({
  1598. selector: "basicSwapClassNames:with:",
  1599. category: 'private',
  1600. fn: function (aClass,anotherClass){
  1601. var self=this;
  1602. return smalltalk.withContext(function($ctx1) {
  1603. var tmp = aClass.className;
  1604. aClass.className = anotherClass.className;
  1605. anotherClass.className = tmp;
  1606. ;
  1607. return self}, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  1608. args: ["aClass", "anotherClass"],
  1609. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  1610. messageSends: [],
  1611. referencedClasses: []
  1612. }),
  1613. smalltalk.ClassBuilder);
  1614. smalltalk.addMethod(
  1615. smalltalk.method({
  1616. selector: "class:instanceVariableNames:",
  1617. category: 'class definition',
  1618. fn: function (aClass,ivarNames){
  1619. var self=this;
  1620. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1621. function $ClassDefinitionChanged(){return smalltalk.ClassDefinitionChanged||(typeof ClassDefinitionChanged=="undefined"?nil:ClassDefinitionChanged)}
  1622. return smalltalk.withContext(function($ctx1) {
  1623. var $1,$2;
  1624. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  1625. self._setupClass_(aClass);
  1626. $1=_st($ClassDefinitionChanged())._new();
  1627. _st($1)._theClass_(aClass);
  1628. $2=_st($1)._yourself();
  1629. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1630. return self}, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},smalltalk.ClassBuilder)})},
  1631. args: ["aClass", "ivarNames"],
  1632. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  1633. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  1634. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"]
  1635. }),
  1636. smalltalk.ClassBuilder);
  1637. smalltalk.addMethod(
  1638. smalltalk.method({
  1639. selector: "copyClass:named:",
  1640. category: 'copying',
  1641. fn: function (aClass,className){
  1642. var self=this;
  1643. var newClass;
  1644. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1645. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  1646. return smalltalk.withContext(function($ctx1) {
  1647. var $1,$2,$3;
  1648. newClass=self._addSubclassOf_named_instanceVariableNames_package_(_st(aClass)._superclass(),className,_st(aClass)._instanceVariableNames(),_st(_st(aClass)._package())._name());
  1649. self._copyClass_to_(aClass,newClass);
  1650. $1=_st($ClassAdded())._new();
  1651. _st($1)._theClass_(newClass);
  1652. $2=_st($1)._yourself();
  1653. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1654. $3=newClass;
  1655. return $3;
  1656. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},smalltalk.ClassBuilder)})},
  1657. args: ["aClass", "className"],
  1658. source: "copyClass: aClass named: className\x0a\x09| newClass |\x0a\x0a\x09newClass := self\x0a\x09\x09addSubclassOf: aClass superclass\x0a\x09\x09named: className\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name.\x0a\x0a\x09self copyClass: aClass to: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  1659. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"],
  1660. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  1661. }),
  1662. smalltalk.ClassBuilder);
  1663. smalltalk.addMethod(
  1664. smalltalk.method({
  1665. selector: "copyClass:to:",
  1666. category: 'copying',
  1667. fn: function (aClass,anotherClass){
  1668. var self=this;
  1669. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1670. return smalltalk.withContext(function($ctx1) {
  1671. var $3,$2,$4,$5,$6,$7,$1,$8,$10,$9,$14,$13,$12,$15,$16,$17,$18,$11;
  1672. _st(anotherClass)._comment_(_st(aClass)._comment());
  1673. $3=_st(aClass)._methodDictionary();
  1674. $ctx1.sendIdx["methodDictionary"]=1;
  1675. $2=_st($3)._values();
  1676. $ctx1.sendIdx["values"]=1;
  1677. $1=_st($2)._do_((function(each){
  1678. return smalltalk.withContext(function($ctx2) {
  1679. $4=_st($Compiler())._new();
  1680. $ctx2.sendIdx["new"]=1;
  1681. $5=_st(each)._source();
  1682. $ctx2.sendIdx["source"]=1;
  1683. $6=anotherClass;
  1684. $7=_st(each)._category();
  1685. $ctx2.sendIdx["category"]=1;
  1686. return _st($4)._install_forClass_category_($5,$6,$7);
  1687. $ctx2.sendIdx["install:forClass:category:"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1689. $ctx1.sendIdx["do:"]=1;
  1690. $8=_st(anotherClass)._class();
  1691. $ctx1.sendIdx["class"]=1;
  1692. $10=_st(aClass)._class();
  1693. $ctx1.sendIdx["class"]=2;
  1694. $9=_st($10)._instanceVariableNames();
  1695. self._basicClass_instanceVariables_($8,$9);
  1696. $14=_st(aClass)._class();
  1697. $ctx1.sendIdx["class"]=3;
  1698. $13=_st($14)._methodDictionary();
  1699. $12=_st($13)._values();
  1700. $11=_st($12)._do_((function(each){
  1701. return smalltalk.withContext(function($ctx2) {
  1702. $15=_st($Compiler())._new();
  1703. $16=_st(each)._source();
  1704. $17=_st(anotherClass)._class();
  1705. $18=_st(each)._category();
  1706. return _st($15)._install_forClass_category_($16,$17,$18);
  1707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1708. self._setupClass_(anotherClass);
  1709. return self}, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  1710. args: ["aClass", "anotherClass"],
  1711. 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",
  1712. messageSends: ["comment:", "comment", "do:", "values", "methodDictionary", "install:forClass:category:", "new", "source", "category", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"],
  1713. referencedClasses: ["Compiler"]
  1714. }),
  1715. smalltalk.ClassBuilder);
  1716. smalltalk.addMethod(
  1717. smalltalk.method({
  1718. selector: "createPackageNamed:",
  1719. category: 'private',
  1720. fn: function (aString){
  1721. var self=this;
  1722. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  1723. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1724. return smalltalk.withContext(function($ctx1) {
  1725. var $1;
  1726. $1=_st($Package())._named_ifAbsent_(aString,(function(){
  1727. return smalltalk.withContext(function($ctx2) {
  1728. return _st(_st($Smalltalk())._current())._createPackage_(aString);
  1729. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1730. return $1;
  1731. }, function($ctx1) {$ctx1.fill(self,"createPackageNamed:",{aString:aString},smalltalk.ClassBuilder)})},
  1732. args: ["aString"],
  1733. source: "createPackageNamed: aString\x0a\x09^ Package named: aString ifAbsent: [\x0a\x09\x09Smalltalk current createPackage: aString ]",
  1734. messageSends: ["named:ifAbsent:", "createPackage:", "current"],
  1735. referencedClasses: ["Package", "Smalltalk"]
  1736. }),
  1737. smalltalk.ClassBuilder);
  1738. smalltalk.addMethod(
  1739. smalltalk.method({
  1740. selector: "installMethod:forClass:category:",
  1741. category: 'method definition',
  1742. fn: function (aCompiledMethod,aBehavior,aString){
  1743. var self=this;
  1744. return smalltalk.withContext(function($ctx1) {
  1745. var $1;
  1746. _st(aCompiledMethod)._category_(aString);
  1747. _st(aBehavior)._addCompiledMethod_(aCompiledMethod);
  1748. self._setupClass_(aBehavior);
  1749. $1=aCompiledMethod;
  1750. return $1;
  1751. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:category:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},smalltalk.ClassBuilder)})},
  1752. args: ["aCompiledMethod", "aBehavior", "aString"],
  1753. source: "installMethod: aCompiledMethod forClass: aBehavior category: aString\x0a\x09aCompiledMethod category: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09self setupClass: aBehavior.\x0a\x09^aCompiledMethod",
  1754. messageSends: ["category:", "addCompiledMethod:", "setupClass:"],
  1755. referencedClasses: []
  1756. }),
  1757. smalltalk.ClassBuilder);
  1758. smalltalk.addMethod(
  1759. smalltalk.method({
  1760. selector: "instanceVariableNamesFor:",
  1761. category: 'accessing',
  1762. fn: function (aString){
  1763. var self=this;
  1764. return smalltalk.withContext(function($ctx1) {
  1765. var $1;
  1766. $1=_st(_st(aString)._tokenize_(" "))._reject_((function(each){
  1767. return smalltalk.withContext(function($ctx2) {
  1768. return _st(each)._isEmpty();
  1769. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1770. return $1;
  1771. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},smalltalk.ClassBuilder)})},
  1772. args: ["aString"],
  1773. source: "instanceVariableNamesFor: aString\x0a\x09^(aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  1774. messageSends: ["reject:", "tokenize:", "isEmpty"],
  1775. referencedClasses: []
  1776. }),
  1777. smalltalk.ClassBuilder);
  1778. smalltalk.addMethod(
  1779. smalltalk.method({
  1780. selector: "migrateClass:superclass:",
  1781. category: 'class migration',
  1782. fn: function (aClass,anotherClass){
  1783. var self=this;
  1784. return smalltalk.withContext(function($ctx1) {
  1785. var $2,$3,$4,$5,$1;
  1786. $2=_st(aClass)._name();
  1787. $ctx1.sendIdx["name"]=1;
  1788. $3=anotherClass;
  1789. $4=_st(aClass)._instanceVariableNames();
  1790. $5=_st(_st(aClass)._package())._name();
  1791. $1=self._migrateClassNamed_superclass_instanceVariableNames_package_($2,$3,$4,$5);
  1792. return $1;
  1793. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},smalltalk.ClassBuilder)})},
  1794. args: ["aClass", "anotherClass"],
  1795. source: "migrateClass: aClass superclass: anotherClass\x0a\x09^ self\x0a\x09\x09migrateClassNamed: aClass name\x0a\x09\x09superclass: anotherClass\x0a\x09\x09instanceVariableNames: aClass instanceVariableNames\x0a\x09\x09package: aClass package name",
  1796. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"],
  1797. referencedClasses: []
  1798. }),
  1799. smalltalk.ClassBuilder);
  1800. smalltalk.addMethod(
  1801. smalltalk.method({
  1802. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  1803. category: 'class migration',
  1804. fn: function (className,aClass,aCollection,packageName){
  1805. var self=this;
  1806. var oldClass,newClass,tmp;
  1807. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1808. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1809. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1810. function $ClassMigrated(){return smalltalk.ClassMigrated||(typeof ClassMigrated=="undefined"?nil:ClassMigrated)}
  1811. return smalltalk.withContext(function($ctx1) {
  1812. var $1,$2,$3,$4,$5,$6,$8,$7,$9,$10,$11,$12,$13;
  1813. tmp="new*".__comma(className);
  1814. $ctx1.sendIdx[","]=1;
  1815. $1=_st($Smalltalk())._current();
  1816. $ctx1.sendIdx["current"]=1;
  1817. oldClass=_st($1)._at_(className);
  1818. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  1819. $2=self._basicSwapClassNames_with_(oldClass,newClass);
  1820. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  1821. _st((function(){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return self._copyClass_to_(oldClass,newClass);
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(exception){
  1825. return smalltalk.withContext(function($ctx2) {
  1826. self._basicSwapClassNames_with_(oldClass,newClass);
  1827. $3=self._basicRemoveClass_(newClass);
  1828. $ctx2.sendIdx["basicRemoveClass:"]=1;
  1829. $3;
  1830. return _st(exception)._signal();
  1831. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)})}));
  1832. self._rawRenameClass_to_(oldClass,tmp);
  1833. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  1834. $4=self._rawRenameClass_to_(newClass,className);
  1835. $5=_st(oldClass)._subclasses();
  1836. $6=(function(each){
  1837. return smalltalk.withContext(function($ctx2) {
  1838. return self._migrateClass_superclass_(each,newClass);
  1839. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})});
  1840. $8="Recompiling ".__comma(_st(newClass)._name());
  1841. $7=_st($8).__comma("...");
  1842. $ctx1.sendIdx[","]=2;
  1843. _st($5)._do_displayingProgress_($6,$7);
  1844. $9=self._basicRemoveClass_(oldClass);
  1845. $10=_st($SystemAnnouncer())._current();
  1846. $11=_st($ClassMigrated())._new();
  1847. _st($11)._theClass_(newClass);
  1848. _st($11)._oldClass_(oldClass);
  1849. $12=_st($11)._yourself();
  1850. _st($10)._announce_($12);
  1851. $13=newClass;
  1852. return $13;
  1853. }, function($ctx1) {$ctx1.fill(self,"migrateClassNamed:superclass:instanceVariableNames:package:",{className:className,aClass:aClass,aCollection:aCollection,packageName:packageName,oldClass:oldClass,newClass:newClass,tmp:tmp},smalltalk.ClassBuilder)})},
  1854. args: ["className", "aClass", "aCollection", "packageName"],
  1855. source: "migrateClassNamed: className superclass: aClass instanceVariableNames: aCollection package: packageName\x0a\x09| oldClass newClass tmp |\x0a\x09\x0a\x09tmp := 'new*', className.\x0a\x09oldClass := Smalltalk current at: className.\x0a\x09\x0a\x09newClass := 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\x09\x09\x09\x09basicSwapClassNames: oldClass with: newClass;\x0a\x09\x09\x09\x09basicRemoveClass: newClass.\x0a\x09\x09\x09exception signal ].\x0a\x0a\x09self\x0a\x09\x09rawRenameClass: oldClass to: tmp;\x0a\x09\x09rawRenameClass: newClass to: className.\x0a\x0a\x09oldClass subclasses \x0a\x09\x09do: [ :each | self migrateClass: each superclass: newClass ]\x0a\x09\x09displayingProgress: 'Recompiling ', newClass name, '...'.\x0a\x0a\x09self basicRemoveClass: oldClass.\x0a\x09\x0a\x09SystemAnnouncer current announce: (ClassMigrated new\x0a\x09\x09theClass: newClass;\x0a\x09\x09oldClass: oldClass;\x0a\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  1856. messageSends: [",", "at:", "current", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "signal", "rawRenameClass:to:", "do:displayingProgress:", "subclasses", "migrateClass:superclass:", "name", "announce:", "theClass:", "new", "oldClass:", "yourself"],
  1857. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"]
  1858. }),
  1859. smalltalk.ClassBuilder);
  1860. smalltalk.addMethod(
  1861. smalltalk.method({
  1862. selector: "rawRenameClass:to:",
  1863. category: 'private',
  1864. fn: function (aClass,aString){
  1865. var self=this;
  1866. return smalltalk.withContext(function($ctx1) {
  1867. smalltalk[aString] = aClass;
  1868. ;
  1869. return self}, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},smalltalk.ClassBuilder)})},
  1870. args: ["aClass", "aString"],
  1871. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09smalltalk[aString] = aClass;\x0a\x09>",
  1872. messageSends: [],
  1873. referencedClasses: []
  1874. }),
  1875. smalltalk.ClassBuilder);
  1876. smalltalk.addMethod(
  1877. smalltalk.method({
  1878. selector: "renameClass:to:",
  1879. category: 'class migration',
  1880. fn: function (aClass,className){
  1881. var self=this;
  1882. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1883. function $ClassRenamed(){return smalltalk.ClassRenamed||(typeof ClassRenamed=="undefined"?nil:ClassRenamed)}
  1884. return smalltalk.withContext(function($ctx1) {
  1885. var $1,$2;
  1886. self._basicRenameClass_to_(aClass,className);
  1887. _st(aClass)._recompile();
  1888. $1=_st($ClassRenamed())._new();
  1889. _st($1)._theClass_(aClass);
  1890. $2=_st($1)._yourself();
  1891. _st(_st($SystemAnnouncer())._current())._announce_($2);
  1892. return self}, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  1893. args: ["aClass", "className"],
  1894. source: "renameClass: aClass to: className\x0a\x09self basicRenameClass: aClass to: className.\x0a\x09\x0a\x09\x22Recompile the class to fix potential issues with super sends\x22\x0a\x09aClass recompile.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRenamed new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  1895. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"],
  1896. referencedClasses: ["SystemAnnouncer", "ClassRenamed"]
  1897. }),
  1898. smalltalk.ClassBuilder);
  1899. smalltalk.addMethod(
  1900. smalltalk.method({
  1901. selector: "setupClass:",
  1902. category: 'public',
  1903. fn: function (aClass){
  1904. var self=this;
  1905. return smalltalk.withContext(function($ctx1) {
  1906. smalltalk.init(aClass);;
  1907. return self}, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},smalltalk.ClassBuilder)})},
  1908. args: ["aClass"],
  1909. source: "setupClass: aClass\x0a\x09<smalltalk.init(aClass);>",
  1910. messageSends: [],
  1911. referencedClasses: []
  1912. }),
  1913. smalltalk.ClassBuilder);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "superclass:subclass:",
  1917. category: 'class definition',
  1918. fn: function (aClass,className){
  1919. var self=this;
  1920. return smalltalk.withContext(function($ctx1) {
  1921. var $1;
  1922. $1=self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  1923. return $1;
  1924. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},smalltalk.ClassBuilder)})},
  1925. args: ["aClass", "className"],
  1926. source: "superclass: aClass subclass: className\x0a\x09^self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  1927. messageSends: ["superclass:subclass:instanceVariableNames:package:"],
  1928. referencedClasses: []
  1929. }),
  1930. smalltalk.ClassBuilder);
  1931. smalltalk.addMethod(
  1932. smalltalk.method({
  1933. selector: "superclass:subclass:instanceVariableNames:package:",
  1934. category: 'class definition',
  1935. fn: function (aClass,className,ivarNames,packageName){
  1936. var self=this;
  1937. var newClass;
  1938. function $SystemAnnouncer(){return smalltalk.SystemAnnouncer||(typeof SystemAnnouncer=="undefined"?nil:SystemAnnouncer)}
  1939. function $ClassAdded(){return smalltalk.ClassAdded||(typeof ClassAdded=="undefined"?nil:ClassAdded)}
  1940. return smalltalk.withContext(function($ctx1) {
  1941. var $1,$2,$3,$5,$4,$6,$7,$8;
  1942. $1=aClass;
  1943. $2=className;
  1944. $3=self._instanceVariableNamesFor_(ivarNames);
  1945. $5=packageName;
  1946. if(($receiver = $5) == nil || $receiver == null){
  1947. $4="unclassified";
  1948. } else {
  1949. $4=$5;
  1950. };
  1951. newClass=self._addSubclassOf_named_instanceVariableNames_package_($1,$2,$3,$4);
  1952. self._setupClass_(newClass);
  1953. $6=_st($ClassAdded())._new();
  1954. _st($6)._theClass_(newClass);
  1955. $7=_st($6)._yourself();
  1956. _st(_st($SystemAnnouncer())._current())._announce_($7);
  1957. $8=newClass;
  1958. return $8;
  1959. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},smalltalk.ClassBuilder)})},
  1960. args: ["aClass", "className", "ivarNames", "packageName"],
  1961. source: "superclass: aClass subclass: className instanceVariableNames: ivarNames package: packageName\x0a\x09| newClass |\x0a\x09\x0a\x09newClass := self addSubclassOf: aClass\x0a\x09\x09named: className instanceVariableNames: (self instanceVariableNamesFor: ivarNames)\x0a\x09\x09package: (packageName ifNil: ['unclassified']).\x0a\x09self setupClass: newClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassAdded new\x0a\x09\x09\x09theClass: newClass;\x0a\x09\x09\x09yourself).\x0a\x09\x0a\x09^newClass",
  1962. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"],
  1963. referencedClasses: ["SystemAnnouncer", "ClassAdded"]
  1964. }),
  1965. smalltalk.ClassBuilder);
  1966. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category'], 'Kernel-Classes');
  1967. smalltalk.ClassCategoryReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  1968. smalltalk.addMethod(
  1969. smalltalk.method({
  1970. selector: "class:category:",
  1971. category: 'accessing',
  1972. fn: function (aClass,aString){
  1973. var self=this;
  1974. return smalltalk.withContext(function($ctx1) {
  1975. self["@class"]=aClass;
  1976. self["@category"]=aString;
  1977. return self}, function($ctx1) {$ctx1.fill(self,"class:category:",{aClass:aClass,aString:aString},smalltalk.ClassCategoryReader)})},
  1978. args: ["aClass", "aString"],
  1979. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  1980. messageSends: [],
  1981. referencedClasses: []
  1982. }),
  1983. smalltalk.ClassCategoryReader);
  1984. smalltalk.addMethod(
  1985. smalltalk.method({
  1986. selector: "compileMethod:",
  1987. category: 'private',
  1988. fn: function (aString){
  1989. var self=this;
  1990. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  1991. return smalltalk.withContext(function($ctx1) {
  1992. _st(_st($Compiler())._new())._install_forClass_category_(aString,self["@class"],self["@category"]);
  1993. return self}, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},smalltalk.ClassCategoryReader)})},
  1994. args: ["aString"],
  1995. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class category: category",
  1996. messageSends: ["install:forClass:category:", "new"],
  1997. referencedClasses: ["Compiler"]
  1998. }),
  1999. smalltalk.ClassCategoryReader);
  2000. smalltalk.addMethod(
  2001. smalltalk.method({
  2002. selector: "initialize",
  2003. category: 'initialization',
  2004. fn: function (){
  2005. var self=this;
  2006. return smalltalk.withContext(function($ctx1) {
  2007. smalltalk.ClassCategoryReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  2008. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCategoryReader)})},
  2009. args: [],
  2010. source: "initialize\x0a\x09super initialize.",
  2011. messageSends: ["initialize"],
  2012. referencedClasses: []
  2013. }),
  2014. smalltalk.ClassCategoryReader);
  2015. smalltalk.addMethod(
  2016. smalltalk.method({
  2017. selector: "scanFrom:",
  2018. category: 'fileIn',
  2019. fn: function (aChunkParser){
  2020. var self=this;
  2021. var chunk;
  2022. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2023. return smalltalk.withContext(function($ctx1) {
  2024. _st((function(){
  2025. return smalltalk.withContext(function($ctx2) {
  2026. chunk=_st(aChunkParser)._nextChunk();
  2027. chunk;
  2028. return _st(chunk)._isEmpty();
  2029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  2030. return smalltalk.withContext(function($ctx2) {
  2031. return self._compileMethod_(chunk);
  2032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2033. _st(_st($ClassBuilder())._new())._setupClass_(self["@class"]);
  2034. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCategoryReader)})},
  2035. args: ["aChunkParser"],
  2036. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty] whileFalse: [\x0a\x09\x09self compileMethod: chunk].\x0a\x09ClassBuilder new setupClass: class",
  2037. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"],
  2038. referencedClasses: ["ClassBuilder"]
  2039. }),
  2040. smalltalk.ClassCategoryReader);
  2041. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class'], 'Kernel-Classes');
  2042. smalltalk.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  2043. smalltalk.addMethod(
  2044. smalltalk.method({
  2045. selector: "class:",
  2046. category: 'accessing',
  2047. fn: function (aClass){
  2048. var self=this;
  2049. return smalltalk.withContext(function($ctx1) {
  2050. self["@class"]=aClass;
  2051. return self}, function($ctx1) {$ctx1.fill(self,"class:",{aClass:aClass},smalltalk.ClassCommentReader)})},
  2052. args: ["aClass"],
  2053. source: "class: aClass\x0a\x09class := aClass",
  2054. messageSends: [],
  2055. referencedClasses: []
  2056. }),
  2057. smalltalk.ClassCommentReader);
  2058. smalltalk.addMethod(
  2059. smalltalk.method({
  2060. selector: "initialize",
  2061. category: 'initialization',
  2062. fn: function (){
  2063. var self=this;
  2064. return smalltalk.withContext(function($ctx1) {
  2065. smalltalk.ClassCommentReader.superclass.fn.prototype._initialize.apply(_st(self), []);
  2066. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ClassCommentReader)})},
  2067. args: [],
  2068. source: "initialize\x0a\x09super initialize.",
  2069. messageSends: ["initialize"],
  2070. referencedClasses: []
  2071. }),
  2072. smalltalk.ClassCommentReader);
  2073. smalltalk.addMethod(
  2074. smalltalk.method({
  2075. selector: "scanFrom:",
  2076. category: 'fileIn',
  2077. fn: function (aChunkParser){
  2078. var self=this;
  2079. var chunk;
  2080. return smalltalk.withContext(function($ctx1) {
  2081. var $1;
  2082. chunk=_st(aChunkParser)._nextChunk();
  2083. $1=_st(chunk)._isEmpty();
  2084. if(! smalltalk.assert($1)){
  2085. self._setComment_(chunk);
  2086. };
  2087. return self}, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},smalltalk.ClassCommentReader)})},
  2088. args: ["aChunkParser"],
  2089. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk].",
  2090. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"],
  2091. referencedClasses: []
  2092. }),
  2093. smalltalk.ClassCommentReader);
  2094. smalltalk.addMethod(
  2095. smalltalk.method({
  2096. selector: "setComment:",
  2097. category: 'private',
  2098. fn: function (aString){
  2099. var self=this;
  2100. return smalltalk.withContext(function($ctx1) {
  2101. _st(self["@class"])._comment_(aString);
  2102. return self}, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},smalltalk.ClassCommentReader)})},
  2103. args: ["aString"],
  2104. source: "setComment: aString\x0a\x09class comment: aString",
  2105. messageSends: ["comment:"],
  2106. referencedClasses: []
  2107. }),
  2108. smalltalk.ClassCommentReader);
  2109. smalltalk.addClass('ClassSorterNode', smalltalk.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  2110. smalltalk.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  2111. smalltalk.addMethod(
  2112. smalltalk.method({
  2113. selector: "getNodesFrom:",
  2114. category: 'accessing',
  2115. fn: function (aCollection){
  2116. var self=this;
  2117. var children,others;
  2118. function $ClassSorterNode(){return smalltalk.ClassSorterNode||(typeof ClassSorterNode=="undefined"?nil:ClassSorterNode)}
  2119. return smalltalk.withContext(function($ctx1) {
  2120. var $1;
  2121. children=[];
  2122. others=[];
  2123. _st(aCollection)._do_((function(each){
  2124. return smalltalk.withContext(function($ctx2) {
  2125. $1=_st(_st(each)._superclass()).__eq(self._theClass());
  2126. if(smalltalk.assert($1)){
  2127. return _st(children)._add_(each);
  2128. $ctx2.sendIdx["add:"]=1;
  2129. } else {
  2130. return _st(others)._add_(each);
  2131. };
  2132. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2133. self["@nodes"]=_st(children)._collect_((function(each){
  2134. return smalltalk.withContext(function($ctx2) {
  2135. return _st($ClassSorterNode())._on_classes_level_(each,others,_st(self._level()).__plus((1)));
  2136. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2137. return self}, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},smalltalk.ClassSorterNode)})},
  2138. args: ["aCollection"],
  2139. 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]",
  2140. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"],
  2141. referencedClasses: ["ClassSorterNode"]
  2142. }),
  2143. smalltalk.ClassSorterNode);
  2144. smalltalk.addMethod(
  2145. smalltalk.method({
  2146. selector: "level",
  2147. category: 'accessing',
  2148. fn: function (){
  2149. var self=this;
  2150. return smalltalk.withContext(function($ctx1) {
  2151. var $1;
  2152. $1=self["@level"];
  2153. return $1;
  2154. }, function($ctx1) {$ctx1.fill(self,"level",{},smalltalk.ClassSorterNode)})},
  2155. args: [],
  2156. source: "level\x0a\x09^level",
  2157. messageSends: [],
  2158. referencedClasses: []
  2159. }),
  2160. smalltalk.ClassSorterNode);
  2161. smalltalk.addMethod(
  2162. smalltalk.method({
  2163. selector: "level:",
  2164. category: 'accessing',
  2165. fn: function (anInteger){
  2166. var self=this;
  2167. return smalltalk.withContext(function($ctx1) {
  2168. self["@level"]=anInteger;
  2169. return self}, function($ctx1) {$ctx1.fill(self,"level:",{anInteger:anInteger},smalltalk.ClassSorterNode)})},
  2170. args: ["anInteger"],
  2171. source: "level: anInteger\x0a\x09level := anInteger",
  2172. messageSends: [],
  2173. referencedClasses: []
  2174. }),
  2175. smalltalk.ClassSorterNode);
  2176. smalltalk.addMethod(
  2177. smalltalk.method({
  2178. selector: "nodes",
  2179. category: 'accessing',
  2180. fn: function (){
  2181. var self=this;
  2182. return smalltalk.withContext(function($ctx1) {
  2183. var $1;
  2184. $1=self["@nodes"];
  2185. return $1;
  2186. }, function($ctx1) {$ctx1.fill(self,"nodes",{},smalltalk.ClassSorterNode)})},
  2187. args: [],
  2188. source: "nodes\x0a\x09^nodes",
  2189. messageSends: [],
  2190. referencedClasses: []
  2191. }),
  2192. smalltalk.ClassSorterNode);
  2193. smalltalk.addMethod(
  2194. smalltalk.method({
  2195. selector: "theClass",
  2196. category: 'accessing',
  2197. fn: function (){
  2198. var self=this;
  2199. return smalltalk.withContext(function($ctx1) {
  2200. var $1;
  2201. $1=self["@theClass"];
  2202. return $1;
  2203. }, function($ctx1) {$ctx1.fill(self,"theClass",{},smalltalk.ClassSorterNode)})},
  2204. args: [],
  2205. source: "theClass\x0a\x09^theClass",
  2206. messageSends: [],
  2207. referencedClasses: []
  2208. }),
  2209. smalltalk.ClassSorterNode);
  2210. smalltalk.addMethod(
  2211. smalltalk.method({
  2212. selector: "theClass:",
  2213. category: 'accessing',
  2214. fn: function (aClass){
  2215. var self=this;
  2216. return smalltalk.withContext(function($ctx1) {
  2217. self["@theClass"]=aClass;
  2218. return self}, function($ctx1) {$ctx1.fill(self,"theClass:",{aClass:aClass},smalltalk.ClassSorterNode)})},
  2219. args: ["aClass"],
  2220. source: "theClass: aClass\x0a\x09theClass := aClass",
  2221. messageSends: [],
  2222. referencedClasses: []
  2223. }),
  2224. smalltalk.ClassSorterNode);
  2225. smalltalk.addMethod(
  2226. smalltalk.method({
  2227. selector: "traverseClassesWith:",
  2228. category: 'visiting',
  2229. fn: function (aCollection){
  2230. var self=this;
  2231. return smalltalk.withContext(function($ctx1) {
  2232. var $1,$2,$4,$3,$6,$5;
  2233. $1=aCollection;
  2234. $2=self._theClass();
  2235. $ctx1.sendIdx["theClass"]=1;
  2236. _st($1)._add_($2);
  2237. _st(_st(self._nodes())._sorted_((function(a,b){
  2238. return smalltalk.withContext(function($ctx2) {
  2239. $4=_st(a)._theClass();
  2240. $ctx2.sendIdx["theClass"]=2;
  2241. $3=_st($4)._name();
  2242. $ctx2.sendIdx["name"]=1;
  2243. $6=_st(b)._theClass();
  2244. $5=_st($6)._name();
  2245. return _st($3).__lt_eq($5);
  2246. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})})))._do_((function(aNode){
  2247. return smalltalk.withContext(function($ctx2) {
  2248. return _st(aNode)._traverseClassesWith_(aCollection);
  2249. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)})}));
  2250. return self}, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},smalltalk.ClassSorterNode)})},
  2251. args: ["aCollection"],
  2252. 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 ].",
  2253. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"],
  2254. referencedClasses: []
  2255. }),
  2256. smalltalk.ClassSorterNode);
  2257. smalltalk.addMethod(
  2258. smalltalk.method({
  2259. selector: "on:classes:level:",
  2260. category: 'instance creation',
  2261. fn: function (aClass,aCollection,anInteger){
  2262. var self=this;
  2263. return smalltalk.withContext(function($ctx1) {
  2264. var $2,$3,$1;
  2265. $2=self._new();
  2266. _st($2)._theClass_(aClass);
  2267. _st($2)._level_(anInteger);
  2268. _st($2)._getNodesFrom_(aCollection);
  2269. $3=_st($2)._yourself();
  2270. $1=$3;
  2271. return $1;
  2272. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},smalltalk.ClassSorterNode.klass)})},
  2273. args: ["aClass", "aCollection", "anInteger"],
  2274. 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",
  2275. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"],
  2276. referencedClasses: []
  2277. }),
  2278. smalltalk.ClassSorterNode.klass);
  2279. });