Kernel-Classes.js 93 KB

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