Kernel-Classes.js 93 KB

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