kernel.js 116 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917
  1. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel');
  2. smalltalk.addMethod(
  3. '__eq',
  4. smalltalk.method({
  5. selector: '=',
  6. category: 'comparing',
  7. fn: function (anObject){
  8. var self=this;
  9. return (function(){return self == anObject})();
  10. return self;},
  11. source: unescape('%3D%20anObject%0A%09%5E%7B%27return%20self%20%3D%3D%20anObject%27%7D%0A')}),
  12. smalltalk.Object);
  13. smalltalk.addMethod(
  14. '_~_eq',
  15. smalltalk.method({
  16. selector: '~=',
  17. category: 'comparing',
  18. fn: function (anObject){
  19. var self=this;
  20. return self.__eq(anObject).__eq_eq(false);
  21. return self;},
  22. source: unescape('%7E%3D%20anObject%0A%09%5E%28self%20%3D%20anObject%29%20%3D%3D%20false%0A')}),
  23. smalltalk.Object);
  24. smalltalk.addMethod(
  25. '_initialize',
  26. smalltalk.method({
  27. selector: 'initialize',
  28. category: 'initialization',
  29. fn: function (){
  30. var self=this;
  31. return self;},
  32. source: unescape('initialize%0A')}),
  33. smalltalk.Object);
  34. smalltalk.addMethod(
  35. '_yourself',
  36. smalltalk.method({
  37. selector: 'yourself',
  38. category: 'accessing',
  39. fn: function (){
  40. var self=this;
  41. return self;
  42. return self;},
  43. source: unescape('yourself%0A%09%5Eself%0A')}),
  44. smalltalk.Object);
  45. smalltalk.addMethod(
  46. '_class',
  47. smalltalk.method({
  48. selector: 'class',
  49. category: 'accessing',
  50. fn: function (){
  51. var self=this;
  52. return (function(){return self.klass})();
  53. return self;},
  54. source: unescape('class%0A%09%5E%7B%27return%20self.klass%27%7D%0A')}),
  55. smalltalk.Object);
  56. smalltalk.addMethod(
  57. '_size',
  58. smalltalk.method({
  59. selector: 'size',
  60. category: 'accessing',
  61. fn: function (){
  62. var self=this;
  63. self._error_("Object not indexable");
  64. return self;},
  65. source: unescape('size%0A%09self%20error%3A%20%27Object%20not%20indexable%27%0A')}),
  66. smalltalk.Object);
  67. smalltalk.addMethod(
  68. '_copy',
  69. smalltalk.method({
  70. selector: 'copy',
  71. category: 'copying',
  72. fn: function (){
  73. var self=this;
  74. return self._shallowCopy()._postCopy();
  75. return self;},
  76. source: unescape('copy%0A%09%5Eself%20shallowCopy%20postCopy%0A')}),
  77. smalltalk.Object);
  78. smalltalk.addMethod(
  79. '_shallowCopy',
  80. smalltalk.method({
  81. selector: 'shallowCopy',
  82. category: 'copying',
  83. fn: function (){
  84. var self=this;
  85. return (function(){
  86. var copy = self.klass._new();
  87. for(var i in self) {
  88. if(/^@.+/.test(i)) {
  89. copy[i] = self[i];
  90. }
  91. }
  92. return copy;
  93. })();
  94. return self;},
  95. source: unescape('shallowCopy%0A%09%5E%7B%27%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D%0A')}),
  96. smalltalk.Object);
  97. smalltalk.addMethod(
  98. '_deepCopy',
  99. smalltalk.method({
  100. selector: 'deepCopy',
  101. category: 'copying',
  102. fn: function (){
  103. var self=this;
  104. (function(){
  105. var copy = self.klass._new();
  106. for(var i in self) {
  107. if(/^@.+/.test(i)) {
  108. copy[i] = self[i]._deepCopy();
  109. }
  110. }
  111. return copy;
  112. })();
  113. return self;},
  114. source: unescape('deepCopy%0A%09%7B%27%09%20%20%20%20%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D._deepCopy%28%29%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D.%0A')}),
  115. smalltalk.Object);
  116. smalltalk.addMethod(
  117. '_postCopy',
  118. smalltalk.method({
  119. selector: 'postCopy',
  120. category: 'copying',
  121. fn: function (){
  122. var self=this;
  123. return self;},
  124. source: unescape('postCopy%0A')}),
  125. smalltalk.Object);
  126. smalltalk.addMethod(
  127. '__minus_gt',
  128. smalltalk.method({
  129. selector: '->',
  130. category: 'converting',
  131. fn: function (anObject){
  132. var self=this;
  133. return smalltalk.Association._key_value_(self,anObject);
  134. return self;},
  135. source: unescape('-%3E%20anObject%0A%09%5EAssociation%20key%3A%20self%20value%3A%20anObject%0A')}),
  136. smalltalk.Object);
  137. smalltalk.addMethod(
  138. '_asString',
  139. smalltalk.method({
  140. selector: 'asString',
  141. category: 'converting',
  142. fn: function (){
  143. var self=this;
  144. return self._printString();
  145. return self;},
  146. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  147. smalltalk.Object);
  148. smalltalk.addMethod(
  149. '_asJavascript',
  150. smalltalk.method({
  151. selector: 'asJavascript',
  152. category: 'converting',
  153. fn: function (){
  154. var self=this;
  155. return self._asString();
  156. return self;},
  157. source: unescape('asJavascript%0A%09%5Eself%20asString%0A')}),
  158. smalltalk.Object);
  159. smalltalk.addMethod(
  160. '_perform_',
  161. smalltalk.method({
  162. selector: 'perform:',
  163. category: 'message handling',
  164. fn: function (aSymbol){
  165. var self=this;
  166. return self._perform_withArguments_(aSymbol,[]);
  167. return self;},
  168. source: unescape('perform%3A%20aSymbol%0A%09%5Eself%20perform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  169. smalltalk.Object);
  170. smalltalk.addMethod(
  171. '_perform_withArguments_',
  172. smalltalk.method({
  173. selector: 'perform:withArguments:',
  174. category: 'error handling',
  175. fn: function (aSymbol, aCollection){
  176. var self=this;
  177. return self._basicPerform_withArguments_(aSymbol._asSelector(),aCollection);
  178. return self;},
  179. source: unescape('perform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%5Eself%20basicPerform%3A%20aSymbol%20asSelector%20withArguments%3A%20aCollection%0A')}),
  180. smalltalk.Object);
  181. smalltalk.addMethod(
  182. '_instVarAt_',
  183. smalltalk.method({
  184. selector: 'instVarAt:',
  185. category: 'accessing',
  186. fn: function (aString){
  187. var self=this;
  188. return (function(){
  189. var value = self['@'+aString];
  190. if(typeof(value) == 'undefined') {
  191. return nil;
  192. } else {
  193. return value;
  194. }
  195. })();
  196. return self;},
  197. source: unescape('instVarAt%3A%20aString%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5B%27%27@%27%27+aString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  198. smalltalk.Object);
  199. smalltalk.addMethod(
  200. '_instVarAt_put_',
  201. smalltalk.method({
  202. selector: 'instVarAt:put:',
  203. category: 'accessing',
  204. fn: function (aString, anObject){
  205. var self=this;
  206. return (function(){self['@' + aString] = anObject})();
  207. return self;},
  208. source: unescape('instVarAt%3A%20aString%20put%3A%20anObject%0A%09%5E%7B%27self%5B%27%27@%27%27%20+%20aString%5D%20%3D%20anObject%27%7D%0A')}),
  209. smalltalk.Object);
  210. smalltalk.addMethod(
  211. '_basicAt_',
  212. smalltalk.method({
  213. selector: 'basicAt:',
  214. category: 'accessing',
  215. fn: function (aString){
  216. var self=this;
  217. return (function(){
  218. var value = self[aString];
  219. if(typeof(value) == 'undefined') {
  220. return nil;
  221. } else {
  222. return value;
  223. }
  224. })();
  225. return self;},
  226. source: unescape('basicAt%3A%20aString%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BaString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  227. smalltalk.Object);
  228. smalltalk.addMethod(
  229. '_basicAt_put_',
  230. smalltalk.method({
  231. selector: 'basicAt:put:',
  232. category: 'accessing',
  233. fn: function (aString, anObject){
  234. var self=this;
  235. return (function(){return self[aString] = anObject})();
  236. return self;},
  237. source: unescape('basicAt%3A%20aString%20put%3A%20anObject%0A%09%5E%7B%27return%20self%5BaString%5D%20%3D%20anObject%27%7D%0A')}),
  238. smalltalk.Object);
  239. smalltalk.addMethod(
  240. '_error_',
  241. smalltalk.method({
  242. selector: 'error:',
  243. category: 'error handling',
  244. fn: function (aString){
  245. var self=this;
  246. smalltalk.Error._signal_(aString);
  247. return self;},
  248. source: unescape('error%3A%20aString%0A%09Error%20signal%3A%20aString%0A')}),
  249. smalltalk.Object);
  250. smalltalk.addMethod(
  251. '_subclassResponsibility',
  252. smalltalk.method({
  253. selector: 'subclassResponsibility',
  254. category: 'error handling',
  255. fn: function (){
  256. var self=this;
  257. self._error_("This method is a responsibility of a subclass");
  258. return self;},
  259. source: unescape('subclassResponsibility%0A%09self%20error%3A%20%27This%20method%20is%20a%20responsibility%20of%20a%20subclass%27%0A')}),
  260. smalltalk.Object);
  261. smalltalk.addMethod(
  262. '_shouldNotImplement',
  263. smalltalk.method({
  264. selector: 'shouldNotImplement',
  265. category: 'error handling',
  266. fn: function (){
  267. var self=this;
  268. self._error_("This method should not be implemented in ".__comma(self._class()._name()));
  269. return self;},
  270. source: unescape('shouldNotImplement%0A%09self%20error%3A%20%27This%20method%20should%20not%20be%20implemented%20in%20%27%2C%20self%20class%20name%0A')}),
  271. smalltalk.Object);
  272. smalltalk.addMethod(
  273. '_try_catch_',
  274. smalltalk.method({
  275. selector: 'try:catch:',
  276. category: 'error handling',
  277. fn: function (aBlock, anotherBlock){
  278. var self=this;
  279. (function(){try{aBlock()} catch(e) {anotherBlock(e)}})();
  280. return self;},
  281. source: unescape('try%3A%20aBlock%20catch%3A%20anotherBlock%0A%09%7B%27try%7BaBlock%28%29%7D%20catch%28e%29%20%7BanotherBlock%28e%29%7D%27%7D%0A')}),
  282. smalltalk.Object);
  283. smalltalk.addMethod(
  284. '_printString',
  285. smalltalk.method({
  286. selector: 'printString',
  287. category: 'printing',
  288. fn: function (){
  289. var self=this;
  290. return "a ".__comma(self._class()._name());
  291. return self;},
  292. source: unescape('printString%0A%09%5E%27a%20%27%2C%20self%20class%20name%0A')}),
  293. smalltalk.Object);
  294. smalltalk.addMethod(
  295. '_printNl',
  296. smalltalk.method({
  297. selector: 'printNl',
  298. category: 'printing',
  299. fn: function (){
  300. var self=this;
  301. (function(){console.log(self)})();
  302. return self;},
  303. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  304. smalltalk.Object);
  305. smalltalk.addMethod(
  306. '_isKindOf_',
  307. smalltalk.method({
  308. selector: 'isKindOf:',
  309. category: 'testing',
  310. fn: function (aClass){
  311. var self=this;
  312. return self._isMemberOf_(aClass)._ifTrue_ifFalse_((function(){return true;}),(function(){return self._class()._inheritsFrom_(aClass);}));
  313. return self;},
  314. source: unescape('isKindOf%3A%20aClass%0A%09%5E%28self%20isMemberOf%3A%20aClass%29%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bself%20class%20inheritsFrom%3A%20aClass%5D%0A')}),
  315. smalltalk.Object);
  316. smalltalk.addMethod(
  317. '_isMemberOf_',
  318. smalltalk.method({
  319. selector: 'isMemberOf:',
  320. category: 'testing',
  321. fn: function (aClass){
  322. var self=this;
  323. return self._class().__eq(aClass);
  324. return self;},
  325. source: unescape('isMemberOf%3A%20aClass%0A%09%5Eself%20class%20%3D%20aClass%0A')}),
  326. smalltalk.Object);
  327. smalltalk.addMethod(
  328. '_ifNil_',
  329. smalltalk.method({
  330. selector: 'ifNil:',
  331. category: 'testing',
  332. fn: function (aBlock){
  333. var self=this;
  334. return self;
  335. return self;},
  336. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%0A')}),
  337. smalltalk.Object);
  338. smalltalk.addMethod(
  339. '_ifNil_ifNotNil_',
  340. smalltalk.method({
  341. selector: 'ifNil:ifNotNil:',
  342. category: 'testing',
  343. fn: function (aBlock, anotherBlock){
  344. var self=this;
  345. return anotherBlock._value();
  346. return self;},
  347. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  348. smalltalk.Object);
  349. smalltalk.addMethod(
  350. '_ifNotNil_',
  351. smalltalk.method({
  352. selector: 'ifNotNil:',
  353. category: 'testing',
  354. fn: function (aBlock){
  355. var self=this;
  356. return aBlock._value();
  357. return self;},
  358. source: unescape('ifNotNil%3A%20aBlock%0A%09%5EaBlock%20value%0A')}),
  359. smalltalk.Object);
  360. smalltalk.addMethod(
  361. '_ifNotNil_ifNil_',
  362. smalltalk.method({
  363. selector: 'ifNotNil:ifNil:',
  364. category: 'testing',
  365. fn: function (aBlock, anotherBlock){
  366. var self=this;
  367. return aBlock._value();
  368. return self;},
  369. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  370. smalltalk.Object);
  371. smalltalk.addMethod(
  372. '_isNil',
  373. smalltalk.method({
  374. selector: 'isNil',
  375. category: 'testing',
  376. fn: function (){
  377. var self=this;
  378. return false;
  379. return self;},
  380. source: unescape('isNil%0A%09%5Efalse%0A')}),
  381. smalltalk.Object);
  382. smalltalk.addMethod(
  383. '_notNil',
  384. smalltalk.method({
  385. selector: 'notNil',
  386. category: 'testing',
  387. fn: function (){
  388. var self=this;
  389. return self._isNil()._not();
  390. return self;},
  391. source: unescape('notNil%0A%09%5Eself%20isNil%20not%0A')}),
  392. smalltalk.Object);
  393. smalltalk.addMethod(
  394. '_isClass',
  395. smalltalk.method({
  396. selector: 'isClass',
  397. category: 'testing',
  398. fn: function (){
  399. var self=this;
  400. return false;
  401. return self;},
  402. source: unescape('isClass%0A%09%5Efalse%0A')}),
  403. smalltalk.Object);
  404. smalltalk.addMethod(
  405. '_isMetaclass',
  406. smalltalk.method({
  407. selector: 'isMetaclass',
  408. category: 'testing',
  409. fn: function (){
  410. var self=this;
  411. return false;
  412. return self;},
  413. source: unescape('isMetaclass%0A%09%5Efalse%0A')}),
  414. smalltalk.Object);
  415. smalltalk.addMethod(
  416. '_isNumber',
  417. smalltalk.method({
  418. selector: 'isNumber',
  419. category: 'testing',
  420. fn: function (){
  421. var self=this;
  422. return false;
  423. return self;},
  424. source: unescape('isNumber%0A%09%5Efalse%0A')}),
  425. smalltalk.Object);
  426. smalltalk.addMethod(
  427. '_isString',
  428. smalltalk.method({
  429. selector: 'isString',
  430. category: 'testing',
  431. fn: function (){
  432. var self=this;
  433. return false;
  434. return self;},
  435. source: unescape('isString%0A%09%5Efalse%0A')}),
  436. smalltalk.Object);
  437. smalltalk.addMethod(
  438. '_isParseFailure',
  439. smalltalk.method({
  440. selector: 'isParseFailure',
  441. category: 'testing',
  442. fn: function (){
  443. var self=this;
  444. return false;
  445. return self;},
  446. source: unescape('isParseFailure%0A%09%5Efalse%0A')}),
  447. smalltalk.Object);
  448. smalltalk.addMethod(
  449. '_basicPerform_',
  450. smalltalk.method({
  451. selector: 'basicPerform:',
  452. category: 'error handling',
  453. fn: function (aSymbol){
  454. var self=this;
  455. return self._basicPerform_withArguments_(aSymbol,[]);
  456. return self;},
  457. source: unescape('basicPerform%3A%20aSymbol%20%0A%20%20%20%20%5Eself%20basicPerform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  458. smalltalk.Object);
  459. smalltalk.addMethod(
  460. '_basicPerform_withArguments_',
  461. smalltalk.method({
  462. selector: 'basicPerform:withArguments:',
  463. category: 'error handling',
  464. fn: function (aSymbol, aCollection){
  465. var self=this;
  466. return (function(){return self[aSymbol].apply(self, aCollection);})();
  467. return self;},
  468. source: unescape('basicPerform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%5E%7B%27return%20self%5BaSymbol%5D.apply%28self%2C%20aCollection%29%3B%27%7D%0A')}),
  469. smalltalk.Object);
  470. smalltalk.addMethod(
  471. '_appendToBrush_',
  472. smalltalk.method({
  473. selector: 'appendToBrush:',
  474. category: '*Canvas',
  475. fn: function (aTagBrush){
  476. var self=this;
  477. aTagBrush._append_(self._asString());
  478. return self;},
  479. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20append%3A%20self%20asString%0A')}),
  480. smalltalk.Object);
  481. smalltalk.addMethod(
  482. '_basicDelete_',
  483. smalltalk.method({
  484. selector: 'basicDelete:',
  485. category: 'accessing',
  486. fn: function (aString){
  487. var self=this;
  488. (function(){delete self[aString]})();
  489. return self;},
  490. source: unescape('basicDelete%3A%20aString%0A%20%20%20%20%7B%27delete%20self%5BaString%5D%27%7D%0A')}),
  491. smalltalk.Object);
  492. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel');
  493. smalltalk.addMethod(
  494. '_classes',
  495. smalltalk.method({
  496. selector: 'classes',
  497. category: 'accessing',
  498. fn: function (){
  499. var self=this;
  500. return (function(){return self.classes()})();
  501. return self;},
  502. source: unescape('classes%0A%09%5E%7B%27return%20self.classes%28%29%27%7D%0A')}),
  503. smalltalk.Smalltalk);
  504. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  505. smalltalk.addMethod(
  506. '_current',
  507. smalltalk.method({
  508. selector: 'current',
  509. category: 'accessing',
  510. fn: function (){
  511. var self=this;
  512. return (function(){return smalltalk})();
  513. return self;},
  514. source: unescape('current%0A%09%20%20%20%20%5E%7B%27return%20smalltalk%27%7D%0A')}),
  515. smalltalk.Smalltalk.klass);
  516. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel');
  517. smalltalk.addMethod(
  518. '_new',
  519. smalltalk.method({
  520. selector: 'new',
  521. category: 'instance creation',
  522. fn: function (){
  523. var self=this;
  524. return (function($rec){$rec._initialize();return $rec._yourself();})(self._basicNew());
  525. return self;},
  526. source: unescape('new%0A%09%5Eself%20basicNew%20%0A%09%20%20%20%20initialize%3B%0A%09%20%20%20%20yourself%0A')}),
  527. smalltalk.Behavior);
  528. smalltalk.addMethod(
  529. '_basicNew',
  530. smalltalk.method({
  531. selector: 'basicNew',
  532. category: 'instance creation',
  533. fn: function (){
  534. var self=this;
  535. return (function(){return new self.fn();})();
  536. return self;},
  537. source: unescape('basicNew%0A%09%5E%7B%27return%20new%20self.fn%28%29%3B%27%7D%0A')}),
  538. smalltalk.Behavior);
  539. smalltalk.addMethod(
  540. '_name',
  541. smalltalk.method({
  542. selector: 'name',
  543. category: 'accessing',
  544. fn: function (){
  545. var self=this;
  546. return (function(){return self.className || nil})();
  547. return self;},
  548. source: unescape('name%0A%09%5E%7B%27return%20self.className%20%7C%7C%20nil%27%7D%0A')}),
  549. smalltalk.Behavior);
  550. smalltalk.addMethod(
  551. '_superclass',
  552. smalltalk.method({
  553. selector: 'superclass',
  554. category: 'accessing',
  555. fn: function (){
  556. var self=this;
  557. return (function(){return self.superclass || nil})();
  558. return self;},
  559. source: unescape('superclass%0A%09%5E%7B%27return%20self.superclass%20%7C%7C%20nil%27%7D%0A')}),
  560. smalltalk.Behavior);
  561. smalltalk.addMethod(
  562. '_subclasses',
  563. smalltalk.method({
  564. selector: 'subclasses',
  565. category: 'accessing',
  566. fn: function (){
  567. var self=this;
  568. return (function(){return smalltalk.subclasses(self)})();
  569. return self;},
  570. source: unescape('subclasses%0A%09%5E%7B%27return%20smalltalk.subclasses%28self%29%27%7D%0A')}),
  571. smalltalk.Behavior);
  572. smalltalk.addMethod(
  573. '_allSubclasses',
  574. smalltalk.method({
  575. selector: 'allSubclasses',
  576. category: 'accessing',
  577. fn: function (){
  578. var self=this;
  579. var result=nil;
  580. result=self._subclasses();
  581. self._subclasses()._do_((function(each){return result._addAll_(each._allSubclasses());}));
  582. return result;
  583. return self;},
  584. source: unescape('allSubclasses%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20self%20subclasses.%0A%09self%20subclasses%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20result%20addAll%3A%20each%20allSubclasses%5D.%0A%09%5Eresult%0A')}),
  585. smalltalk.Behavior);
  586. smalltalk.addMethod(
  587. '_withAllSubclasses',
  588. smalltalk.method({
  589. selector: 'withAllSubclasses',
  590. category: 'accessing',
  591. fn: function (){
  592. var self=this;
  593. return (function($rec){$rec._addAll_(self._allSubclasses());return $rec._yourself();})(smalltalk.Array._with_(self));
  594. return self;},
  595. source: unescape('withAllSubclasses%0A%09%5E%28Array%20with%3A%20self%29%20addAll%3A%20self%20allSubclasses%3B%20yourself%0A')}),
  596. smalltalk.Behavior);
  597. smalltalk.addMethod(
  598. '_prototype',
  599. smalltalk.method({
  600. selector: 'prototype',
  601. category: 'accessing',
  602. fn: function (){
  603. var self=this;
  604. return (function(){return self.fn.prototype})();
  605. return self;},
  606. source: unescape('prototype%0A%09%5E%7B%27return%20self.fn.prototype%27%7D%0A')}),
  607. smalltalk.Behavior);
  608. smalltalk.addMethod(
  609. '_methodDictionary',
  610. smalltalk.method({
  611. selector: 'methodDictionary',
  612. category: 'accessing',
  613. fn: function (){
  614. var self=this;
  615. return (function(){var dict = smalltalk.Dictionary._new();
  616. var methods = self.fn.prototype.methods;
  617. for(var i in methods) {
  618. if(methods[i].selector) {
  619. dict._at_put_(methods[i].selector, methods[i]);
  620. }
  621. };
  622. return dict})();
  623. return self;},
  624. source: unescape('methodDictionary%0A%09%5E%7B%27var%20dict%20%3D%20smalltalk.Dictionary._new%28%29%3B%0A%09var%20methods%20%3D%20self.fn.prototype.methods%3B%0A%09for%28var%20i%20in%20methods%29%20%7B%0A%09%09if%28methods%5Bi%5D.selector%29%20%7B%0A%09%09%09dict._at_put_%28methods%5Bi%5D.selector%2C%20methods%5Bi%5D%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%09return%20dict%27%7D%0A')}),
  625. smalltalk.Behavior);
  626. smalltalk.addMethod(
  627. '_instVarNames',
  628. smalltalk.method({
  629. selector: 'instVarNames',
  630. category: '',
  631. fn: function () { var self = this; return function () {return self.iVarNames;}(); return self; },
  632. source: unescape('')}),
  633. smalltalk.Behavior);
  634. smalltalk.addMethod(
  635. '_methodsFor_',
  636. smalltalk.method({
  637. selector: 'methodsFor:',
  638. category: 'accessing',
  639. fn: function (aString){
  640. var self=this;
  641. return (function($rec){$rec._class_category_(self,aString);return $rec._yourself();})(smalltalk.ClassCategoryReader._new());
  642. return self;},
  643. source: unescape('methodsFor%3A%20aString%0A%09%5EClassCategoryReader%20new%0A%09%20%20%20%20class%3A%20self%20category%3A%20aString%3B%0A%09%20%20%20%20yourself%0A')}),
  644. smalltalk.Behavior);
  645. smalltalk.addMethod(
  646. '_addCompiledMethod_',
  647. smalltalk.method({
  648. selector: 'addCompiledMethod:',
  649. category: 'accessing',
  650. fn: function (aMethod){
  651. var self=this;
  652. (function(){self.fn.prototype[aMethod.selector._asSelector()] = aMethod.fn;
  653. self.fn.prototype.methods[aMethod.selector] = aMethod})();
  654. return self;},
  655. source: unescape('addCompiledMethod%3A%20aMethod%0A%09%7B%27self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%20%3D%20aMethod.fn%3B%0A%09self.fn.prototype.methods%5BaMethod.selector%5D%20%3D%20aMethod%27%7D%0A')}),
  656. smalltalk.Behavior);
  657. smalltalk.addMethod(
  658. '_instanceVariableNames',
  659. smalltalk.method({
  660. selector: 'instanceVariableNames',
  661. category: 'accessing',
  662. fn: function (){
  663. var self=this;
  664. return (function(){return self.iVarNames})();
  665. return self;},
  666. source: unescape('instanceVariableNames%0A%09%5E%7B%27return%20self.iVarNames%27%7D%0A')}),
  667. smalltalk.Behavior);
  668. smalltalk.addMethod(
  669. '_comment',
  670. smalltalk.method({
  671. selector: 'comment',
  672. category: 'accessing',
  673. fn: function (){
  674. var self=this;
  675. return self._basicAt_("comment")._ifNil_((function(){return "";}));
  676. return self;},
  677. source: unescape('comment%0A%20%20%20%20%5E%28self%20basicAt%3A%20%27comment%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  678. smalltalk.Behavior);
  679. smalltalk.addMethod(
  680. '_comment_',
  681. smalltalk.method({
  682. selector: 'comment:',
  683. category: 'accessing',
  684. fn: function (aString){
  685. var self=this;
  686. self._basicAt_put_("comment",aString);
  687. return self;},
  688. source: unescape('comment%3A%20aString%0A%20%20%20%20self%20basicAt%3A%20%27comment%27%20put%3A%20aString%0A')}),
  689. smalltalk.Behavior);
  690. smalltalk.addMethod(
  691. '_commentStamp',
  692. smalltalk.method({
  693. selector: 'commentStamp',
  694. category: 'accessing',
  695. fn: function (){
  696. var self=this;
  697. return (function($rec){$rec._class_(self);return $rec._yourself();})(smalltalk.ClassCommentReader._new());
  698. return self;},
  699. source: unescape('commentStamp%0A%20%20%20%20%5EClassCommentReader%20new%0A%09class%3A%20self%3B%0A%09yourself%0A')}),
  700. smalltalk.Behavior);
  701. smalltalk.addMethod(
  702. '_removeCompiledMethod_',
  703. smalltalk.method({
  704. selector: 'removeCompiledMethod:',
  705. category: 'accessing',
  706. fn: function (aMethod){
  707. var self=this;
  708. (function(){delete self.fn.prototype[aMethod.selector._asSelector()];
  709. delete self.fn.prototype.methods[aMethod.selector]})();
  710. return self;},
  711. source: unescape('removeCompiledMethod%3A%20aMethod%0A%09%7B%27delete%20self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%3B%0A%09delete%20self.fn.prototype.methods%5BaMethod.selector%5D%27%7D%0A')}),
  712. smalltalk.Behavior);
  713. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel');
  714. smalltalk.addMethod(
  715. '_category',
  716. smalltalk.method({
  717. selector: 'category',
  718. category: 'accessing',
  719. fn: function (){
  720. var self=this;
  721. return (function(){return self.category})();
  722. return self;},
  723. source: unescape('category%0A%09%5E%7B%27return%20self.category%27%7D%0A')}),
  724. smalltalk.Class);
  725. smalltalk.addMethod(
  726. '_category_',
  727. smalltalk.method({
  728. selector: 'category:',
  729. category: 'accessing',
  730. fn: function (aString){
  731. var self=this;
  732. (function(){self.category = aString})();
  733. return self;},
  734. source: unescape('category%3A%20aString%0A%09%7B%27self.category%20%3D%20aString%27%7D%0A')}),
  735. smalltalk.Class);
  736. smalltalk.addMethod(
  737. '_subclass_instanceVariableNames_',
  738. smalltalk.method({
  739. selector: 'subclass:instanceVariableNames:',
  740. category: 'class creation',
  741. fn: function (aString, anotherString){
  742. var self=this;
  743. return self._subclass_instanceVariableNames_category_(aString,anotherString,nil);
  744. return self;},
  745. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  746. smalltalk.Class);
  747. smalltalk.addMethod(
  748. '_subclass_instanceVariableNames_category_',
  749. smalltalk.method({
  750. selector: 'subclass:instanceVariableNames:category:',
  751. category: 'class creation',
  752. fn: function (aString, aString2, aString3){
  753. var self=this;
  754. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self,aString,aString2,aString3);
  755. return self;},
  756. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  757. smalltalk.Class);
  758. smalltalk.addMethod(
  759. '_isClass',
  760. smalltalk.method({
  761. selector: 'isClass',
  762. category: 'testing',
  763. fn: function (){
  764. var self=this;
  765. return true;
  766. return self;},
  767. source: unescape('isClass%0A%09%5Etrue%0A')}),
  768. smalltalk.Class);
  769. smalltalk.addMethod(
  770. '_printString',
  771. smalltalk.method({
  772. selector: 'printString',
  773. category: 'printing',
  774. fn: function (){
  775. var self=this;
  776. return self._name();
  777. return self;},
  778. source: unescape('printString%0A%09%5Eself%20name%0A')}),
  779. smalltalk.Class);
  780. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel');
  781. smalltalk.addMethod(
  782. '_instanceClass',
  783. smalltalk.method({
  784. selector: 'instanceClass',
  785. category: 'accessing',
  786. fn: function (){
  787. var self=this;
  788. return (function(){return self.instanceClass})();
  789. return self;},
  790. source: unescape('instanceClass%0A%09%5E%7B%27return%20self.instanceClass%27%7D%0A')}),
  791. smalltalk.Metaclass);
  792. smalltalk.addMethod(
  793. '_instanceVariableNames_',
  794. smalltalk.method({
  795. selector: 'instanceVariableNames:',
  796. category: 'accessing',
  797. fn: function (aCollection){
  798. var self=this;
  799. smalltalk.ClassBuilder._new()._class_instanceVariableNames_(self,aCollection);
  800. return self;},
  801. source: unescape('instanceVariableNames%3A%20aCollection%0A%09ClassBuilder%20new%0A%09%20%20%20%20class%3A%20self%20instanceVariableNames%3A%20aCollection%0A')}),
  802. smalltalk.Metaclass);
  803. smalltalk.addMethod(
  804. '_isMetaclass',
  805. smalltalk.method({
  806. selector: 'isMetaclass',
  807. category: 'testing',
  808. fn: function (){
  809. var self=this;
  810. return true;
  811. return self;},
  812. source: unescape('isMetaclass%0A%09%5Etrue%0A')}),
  813. smalltalk.Metaclass);
  814. smalltalk.addMethod(
  815. '_printString',
  816. smalltalk.method({
  817. selector: 'printString',
  818. category: 'printing',
  819. fn: function (){
  820. var self=this;
  821. return self._instanceClass()._name().__comma(" class");
  822. return self;},
  823. source: unescape('printString%0A%09%5Eself%20instanceClass%20name%2C%20%27%20class%27%0A')}),
  824. smalltalk.Metaclass);
  825. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel');
  826. smalltalk.addMethod(
  827. '_source',
  828. smalltalk.method({
  829. selector: 'source',
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return self._basicAt_("source")._ifNil_((function(){return "";}));
  834. return self;},
  835. source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  836. smalltalk.CompiledMethod);
  837. smalltalk.addMethod(
  838. '_source_',
  839. smalltalk.method({
  840. selector: 'source:',
  841. category: 'accessing',
  842. fn: function (aString){
  843. var self=this;
  844. self._basicAt_put_("source",aString);
  845. return self;},
  846. source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString%0A')}),
  847. smalltalk.CompiledMethod);
  848. smalltalk.addMethod(
  849. '_category',
  850. smalltalk.method({
  851. selector: 'category',
  852. category: 'accessing',
  853. fn: function (){
  854. var self=this;
  855. return self._basicAt_("category")._ifNil_((function(){return "";}));
  856. return self;},
  857. source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  858. smalltalk.CompiledMethod);
  859. smalltalk.addMethod(
  860. '_category_',
  861. smalltalk.method({
  862. selector: 'category:',
  863. category: 'accessing',
  864. fn: function (aString){
  865. var self=this;
  866. self._basicAt_put_("category",aString);
  867. return self;},
  868. source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString%0A')}),
  869. smalltalk.CompiledMethod);
  870. smalltalk.addMethod(
  871. '_selector',
  872. smalltalk.method({
  873. selector: 'selector',
  874. category: 'accessing',
  875. fn: function (){
  876. var self=this;
  877. return self._basicAt_("selector");
  878. return self;},
  879. source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27%0A')}),
  880. smalltalk.CompiledMethod);
  881. smalltalk.addMethod(
  882. '_selector_',
  883. smalltalk.method({
  884. selector: 'selector:',
  885. category: 'accessing',
  886. fn: function (aString){
  887. var self=this;
  888. self._basicAt_put_("selector",aString);
  889. return self;},
  890. source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString%0A')}),
  891. smalltalk.CompiledMethod);
  892. smalltalk.addMethod(
  893. '_fn',
  894. smalltalk.method({
  895. selector: 'fn',
  896. category: 'accessing',
  897. fn: function (){
  898. var self=this;
  899. return self._basicAt_("fn");
  900. return self;},
  901. source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27%0A')}),
  902. smalltalk.CompiledMethod);
  903. smalltalk.addMethod(
  904. '_fn_',
  905. smalltalk.method({
  906. selector: 'fn:',
  907. category: 'accessing',
  908. fn: function (aBlock){
  909. var self=this;
  910. self._basicAt_put_("fn",aBlock);
  911. return self;},
  912. source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock%0A')}),
  913. smalltalk.CompiledMethod);
  914. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel');
  915. smalltalk.addMethod(
  916. '__eq',
  917. smalltalk.method({
  918. selector: '=',
  919. category: 'comparing',
  920. fn: function (aNumber){
  921. var self=this;
  922. return (function(){return Number(self) == aNumber})();
  923. return self;},
  924. source: unescape('%3D%20aNumber%0A%09%5E%7B%27return%20Number%28self%29%20%3D%3D%20aNumber%27%7D%0A')}),
  925. smalltalk.Number);
  926. smalltalk.addMethod(
  927. '__gt',
  928. smalltalk.method({
  929. selector: '>',
  930. category: 'comparing',
  931. fn: function (aNumber){
  932. var self=this;
  933. return (function(){return self > aNumber})();
  934. return self;},
  935. source: unescape('%3E%20aNumber%0A%09%5E%7B%27return%20self%20%3E%20aNumber%27%7D%0A')}),
  936. smalltalk.Number);
  937. smalltalk.addMethod(
  938. '__lt',
  939. smalltalk.method({
  940. selector: '<',
  941. category: 'comparing',
  942. fn: function (aNumber){
  943. var self=this;
  944. return (function(){return self < aNumber})();
  945. return self;},
  946. source: unescape('%3C%20aNumber%0A%09%5E%7B%27return%20self%20%3C%20aNumber%27%7D%0A')}),
  947. smalltalk.Number);
  948. smalltalk.addMethod(
  949. '__gt_eq',
  950. smalltalk.method({
  951. selector: '>=',
  952. category: 'comparing',
  953. fn: function (aNumber){
  954. var self=this;
  955. return (function(){return self >= aNumber})();
  956. return self;},
  957. source: unescape('%3E%3D%20aNumber%0A%09%5E%7B%27return%20self%20%3E%3D%20aNumber%27%7D%0A')}),
  958. smalltalk.Number);
  959. smalltalk.addMethod(
  960. '__lt_eq',
  961. smalltalk.method({
  962. selector: '<=',
  963. category: 'comparing',
  964. fn: function (aNumber){
  965. var self=this;
  966. return (function(){return self <= aNumber})();
  967. return self;},
  968. source: unescape('%3C%3D%20aNumber%0A%09%5E%7B%27return%20self%20%3C%3D%20aNumber%27%7D%0A')}),
  969. smalltalk.Number);
  970. smalltalk.addMethod(
  971. '__plus',
  972. smalltalk.method({
  973. selector: '+',
  974. category: 'arithmetic',
  975. fn: function (aNumber){
  976. var self=this;
  977. return (function(){return self + aNumber})();
  978. return self;},
  979. source: unescape('+%20aNumber%0A%09%5E%7B%27return%20self%20+%20aNumber%27%7D%0A')}),
  980. smalltalk.Number);
  981. smalltalk.addMethod(
  982. '__minus',
  983. smalltalk.method({
  984. selector: '-',
  985. category: 'arithmetic',
  986. fn: function (aNumber){
  987. var self=this;
  988. return (function(){return self - aNumber})();
  989. return self;},
  990. source: unescape('-%20aNumber%0A%09%5E%7B%27return%20self%20-%20aNumber%27%7D%0A')}),
  991. smalltalk.Number);
  992. smalltalk.addMethod(
  993. '__star',
  994. smalltalk.method({
  995. selector: '*',
  996. category: 'arithmetic',
  997. fn: function (aNumber){
  998. var self=this;
  999. return (function(){return self * aNumber})();
  1000. return self;},
  1001. source: unescape('*%20aNumber%0A%09%5E%7B%27return%20self%20*%20aNumber%27%7D%0A')}),
  1002. smalltalk.Number);
  1003. smalltalk.addMethod(
  1004. '__slash',
  1005. smalltalk.method({
  1006. selector: '/',
  1007. category: 'arithmetic',
  1008. fn: function (aNumber){
  1009. var self=this;
  1010. return (function(){return self / aNumber})();
  1011. return self;},
  1012. source: unescape('/%20aNumber%0A%09%5E%7B%27return%20self%20/%20aNumber%27%7D%0A')}),
  1013. smalltalk.Number);
  1014. smalltalk.addMethod(
  1015. '_max_',
  1016. smalltalk.method({
  1017. selector: 'max:',
  1018. category: 'arithmetic',
  1019. fn: function (aNumber){
  1020. var self=this;
  1021. return (function(){return Math.max(self, aNumber);})();
  1022. return self;},
  1023. source: unescape('max%3A%20aNumber%0A%09%5E%7B%27return%20Math.max%28self%2C%20aNumber%29%3B%27%7D%0A')}),
  1024. smalltalk.Number);
  1025. smalltalk.addMethod(
  1026. '_min_',
  1027. smalltalk.method({
  1028. selector: 'min:',
  1029. category: 'arithmetic',
  1030. fn: function (aNumber){
  1031. var self=this;
  1032. return (function(){return Math.min(self, aNumber);})();
  1033. return self;},
  1034. source: unescape('min%3A%20aNumber%0A%09%5E%7B%27return%20Math.min%28self%2C%20aNumber%29%3B%27%7D%0A')}),
  1035. smalltalk.Number);
  1036. smalltalk.addMethod(
  1037. '_rounded',
  1038. smalltalk.method({
  1039. selector: 'rounded',
  1040. category: 'converting',
  1041. fn: function (){
  1042. var self=this;
  1043. return (function(){return Math.round(self);})();
  1044. return self;},
  1045. source: unescape('rounded%0A%09%5E%7B%27return%20Math.round%28self%29%3B%27%7D%0A')}),
  1046. smalltalk.Number);
  1047. smalltalk.addMethod(
  1048. '_truncated',
  1049. smalltalk.method({
  1050. selector: 'truncated',
  1051. category: 'converting',
  1052. fn: function (){
  1053. var self=this;
  1054. return (function(){return Math.floor(self);})();
  1055. return self;},
  1056. source: unescape('truncated%0A%09%5E%7B%27return%20Math.floor%28self%29%3B%27%7D%0A')}),
  1057. smalltalk.Number);
  1058. smalltalk.addMethod(
  1059. '_to_',
  1060. smalltalk.method({
  1061. selector: 'to:',
  1062. category: 'converting',
  1063. fn: function (aNumber){
  1064. var self=this;
  1065. var array=nil;
  1066. var first=nil;
  1067. var last=nil;
  1068. var count=nil;
  1069. first=self._truncated();
  1070. last=aNumber._truncated().__plus((1));
  1071. count=(1);
  1072. first.__lt_eq(last)._ifFalse_((function(){return self._error_("Wrong interval");}));
  1073. array=smalltalk.Array._new();
  1074. last.__minus(first)._timesRepeat_((function(){array._at_put_(count,first);count=count.__plus((1));return first=first.__plus((1));}));
  1075. return array;
  1076. return self;},
  1077. source: unescape('to%3A%20aNumber%0A%09%7C%20array%20first%20last%20count%20%7C%0A%09first%20%3A%3D%20self%20truncated.%0A%09last%20%3A%3D%20aNumber%20truncated%20+%201.%0A%09count%20%3A%3D%201.%0A%09%28first%20%3C%3D%20last%29%20ifFalse%3A%20%5Bself%20error%3A%20%27Wrong%20interval%27%5D.%0A%09array%20%3A%3D%20Array%20new.%0A%09%28last%20-%20first%29%20timesRepeat%3A%20%5B%0A%09%20%20%20%20array%20at%3A%20count%20put%3A%20first.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201.%0A%09%20%20%20%20first%20%3A%3D%20first%20+%201%5D.%0A%09%5Earray%0A')}),
  1078. smalltalk.Number);
  1079. smalltalk.addMethod(
  1080. '_timesRepeat_',
  1081. smalltalk.method({
  1082. selector: 'timesRepeat:',
  1083. category: 'enumerating',
  1084. fn: function (aBlock){
  1085. var self=this;
  1086. var integer=nil;
  1087. var count=nil;
  1088. integer=self._truncated();
  1089. count=(1);
  1090. (function(){return count.__gt(self);})._whileFalse_((function(){aBlock._value();return count=count.__plus((1));}));
  1091. return self;},
  1092. source: unescape('timesRepeat%3A%20aBlock%0A%09%7C%20integer%20count%20%7C%0A%09integer%20%3A%3D%20self%20truncated.%0A%09count%20%3A%3D%201.%0A%09%5Bcount%20%3E%20self%5D%20whileFalse%3A%20%5B%0A%09%20%20%20%20aBlock%20value.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201%5D%0A')}),
  1093. smalltalk.Number);
  1094. smalltalk.addMethod(
  1095. '_to_do_',
  1096. smalltalk.method({
  1097. selector: 'to:do:',
  1098. category: 'enumerating',
  1099. fn: function (aNumber, aBlock){
  1100. var self=this;
  1101. return self._to_(aNumber)._do_(aBlock);
  1102. return self;},
  1103. source: unescape('to%3A%20aNumber%20do%3A%20aBlock%0A%09%5E%28self%20to%3A%20aNumber%29%20do%3A%20aBlock%0A')}),
  1104. smalltalk.Number);
  1105. smalltalk.addMethod(
  1106. '_asString',
  1107. smalltalk.method({
  1108. selector: 'asString',
  1109. category: 'converting',
  1110. fn: function (){
  1111. var self=this;
  1112. return self._printString();
  1113. return self;},
  1114. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  1115. smalltalk.Number);
  1116. smalltalk.addMethod(
  1117. '_asJavascript',
  1118. smalltalk.method({
  1119. selector: 'asJavascript',
  1120. category: 'converting',
  1121. fn: function (){
  1122. var self=this;
  1123. return unescape("%28").__comma(self._printString()).__comma(unescape("%29"));
  1124. return self;},
  1125. source: unescape('asJavascript%0A%09%5E%27%28%27%2C%20self%20printString%2C%20%27%29%27%0A')}),
  1126. smalltalk.Number);
  1127. smalltalk.addMethod(
  1128. '_printString',
  1129. smalltalk.method({
  1130. selector: 'printString',
  1131. category: 'printing',
  1132. fn: function (){
  1133. var self=this;
  1134. return (function(){return String(self)})();
  1135. return self;},
  1136. source: unescape('printString%0A%09%5E%7B%27return%20String%28self%29%27%7D%0A')}),
  1137. smalltalk.Number);
  1138. smalltalk.addMethod(
  1139. '_isNumber',
  1140. smalltalk.method({
  1141. selector: 'isNumber',
  1142. category: 'testing',
  1143. fn: function (){
  1144. var self=this;
  1145. return true;
  1146. return self;},
  1147. source: unescape('isNumber%0A%09%5Etrue%0A')}),
  1148. smalltalk.Number);
  1149. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel');
  1150. smalltalk.addMethod(
  1151. '_compiledSource',
  1152. smalltalk.method({
  1153. selector: 'compiledSource',
  1154. category: 'accessing',
  1155. fn: function (){
  1156. var self=this;
  1157. return (function(){return self.toString()})();
  1158. return self;},
  1159. source: unescape('compiledSource%0A%09%5E%7B%27return%20self.toString%28%29%27%7D%0A')}),
  1160. smalltalk.BlockClosure);
  1161. smalltalk.addMethod(
  1162. '_whileTrue_',
  1163. smalltalk.method({
  1164. selector: 'whileTrue:',
  1165. category: 'controlling',
  1166. fn: function (aBlock){
  1167. var self=this;
  1168. (function(){while(self()) {aBlock()}})();
  1169. return self;},
  1170. source: unescape('whileTrue%3A%20aBlock%0A%09%7B%27while%28self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1171. smalltalk.BlockClosure);
  1172. smalltalk.addMethod(
  1173. '_whileFalse_',
  1174. smalltalk.method({
  1175. selector: 'whileFalse:',
  1176. category: 'controlling',
  1177. fn: function (aBlock){
  1178. var self=this;
  1179. (function(){while(!self()) {aBlock()}})();
  1180. return self;},
  1181. source: unescape('whileFalse%3A%20aBlock%0A%09%7B%27while%28%21self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1182. smalltalk.BlockClosure);
  1183. smalltalk.addMethod(
  1184. '_value',
  1185. smalltalk.method({
  1186. selector: 'value',
  1187. category: 'evaluating',
  1188. fn: function (){
  1189. var self=this;
  1190. return (function(){return self();})();
  1191. return self;},
  1192. source: unescape('value%0A%09%5E%7B%27return%20self%28%29%3B%27%7D%0A')}),
  1193. smalltalk.BlockClosure);
  1194. smalltalk.addMethod(
  1195. '_value_',
  1196. smalltalk.method({
  1197. selector: 'value:',
  1198. category: 'evaluating',
  1199. fn: function (anArg){
  1200. var self=this;
  1201. return (function(){return self(anArg);})();
  1202. return self;},
  1203. source: unescape('value%3A%20anArg%0A%09%5E%7B%27return%20self%28anArg%29%3B%27%7D%0A')}),
  1204. smalltalk.BlockClosure);
  1205. smalltalk.addMethod(
  1206. '_value_value_',
  1207. smalltalk.method({
  1208. selector: 'value:value:',
  1209. category: 'evaluating',
  1210. fn: function (firstArg, secondArg){
  1211. var self=this;
  1212. return (function(){return self(firstArg, secondArg);})();
  1213. return self;},
  1214. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%29%3B%27%7D%0A')}),
  1215. smalltalk.BlockClosure);
  1216. smalltalk.addMethod(
  1217. '_value_value_value_',
  1218. smalltalk.method({
  1219. selector: 'value:value:value:',
  1220. category: 'evaluating',
  1221. fn: function (firstArg, secondArg, thirdArg){
  1222. var self=this;
  1223. return (function(){return self(firstArg, secondArg, thirdArg);})();
  1224. return self;},
  1225. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%27%7D%0A')}),
  1226. smalltalk.BlockClosure);
  1227. smalltalk.addMethod(
  1228. '_valueWithPossibleArguments_',
  1229. smalltalk.method({
  1230. selector: 'valueWithPossibleArguments:',
  1231. category: 'evaluating',
  1232. fn: function (aCollection){
  1233. var self=this;
  1234. return (function(){return self.apply(null, aCollection);})();
  1235. return self;},
  1236. source: unescape('valueWithPossibleArguments%3A%20aCollection%0A%09%5E%7B%27return%20self.apply%28null%2C%20aCollection%29%3B%27%7D%0A')}),
  1237. smalltalk.BlockClosure);
  1238. smalltalk.addMethod(
  1239. '_on_do_',
  1240. smalltalk.method({
  1241. selector: 'on:do:',
  1242. category: 'error handling',
  1243. fn: function (anErrorClass, aBlock){
  1244. var self=this;
  1245. self._try_catch_(self,(function(error){return error._isKindOf_(anErrorClass)._ifTrue_ifFalse_((function(){return aBlock._value();}),(function(){return error._signal();}));}));
  1246. return self;},
  1247. source: unescape('on%3A%20anErrorClass%20do%3A%20aBlock%0A%09self%20try%3A%20self%20catch%3A%20%5B%3Aerror%20%7C%0A%09%20%20%20%20%28error%20isKindOf%3A%20anErrorClass%29%20%0A%09%20%20%20%20%20ifTrue%3A%20%5BaBlock%20value%5D%0A%09%20%20%20%20%20ifFalse%3A%20%5Berror%20signal%5D%5D%0A')}),
  1248. smalltalk.BlockClosure);
  1249. smalltalk.addMethod(
  1250. '_appendToJQuery_',
  1251. smalltalk.method({
  1252. selector: 'appendToJQuery:',
  1253. category: '*JQuery',
  1254. fn: function (aJQuery){
  1255. var self=this;
  1256. var canvas=nil;
  1257. canvas=smalltalk.HTMLCanvas._new();
  1258. self._value_(canvas);
  1259. aJQuery._append_(canvas);
  1260. return self;},
  1261. source: unescape('appendToJQuery%3A%20aJQuery%0A%09%7C%20canvas%20%7C%0A%09canvas%20%3A%3D%20HTMLCanvas%20new.%0A%09self%20value%3A%20canvas.%0A%09aJQuery%20append%3A%20canvas%0A')}),
  1262. smalltalk.BlockClosure);
  1263. smalltalk.addMethod(
  1264. '_appendToBrush_',
  1265. smalltalk.method({
  1266. selector: 'appendToBrush:',
  1267. category: '*Canvas',
  1268. fn: function (aTagBrush){
  1269. var self=this;
  1270. aTagBrush._appendBlock_(self);
  1271. return self;},
  1272. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendBlock%3A%20self%0A')}),
  1273. smalltalk.BlockClosure);
  1274. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel');
  1275. smalltalk.addMethod(
  1276. '__eq',
  1277. smalltalk.method({
  1278. selector: '=',
  1279. category: 'comparing',
  1280. fn: function (aBoolean){
  1281. var self=this;
  1282. return (function(){return Boolean(self == true) == aBoolean})();
  1283. return self;},
  1284. source: unescape('%3D%20aBoolean%0A%20%20%20%20%09%5E%7B%27return%20Boolean%28self%20%3D%3D%20true%29%20%3D%3D%20aBoolean%27%7D%0A')}),
  1285. smalltalk.Boolean);
  1286. smalltalk.addMethod(
  1287. '_shallowCopy',
  1288. smalltalk.method({
  1289. selector: 'shallowCopy',
  1290. category: 'copying',
  1291. fn: function (){
  1292. var self=this;
  1293. return self;
  1294. return self;},
  1295. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  1296. smalltalk.Boolean);
  1297. smalltalk.addMethod(
  1298. '_deepCopy',
  1299. smalltalk.method({
  1300. selector: 'deepCopy',
  1301. category: 'copying',
  1302. fn: function (){
  1303. var self=this;
  1304. return self;
  1305. return self;},
  1306. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  1307. smalltalk.Boolean);
  1308. smalltalk.addMethod(
  1309. '_ifTrue_',
  1310. smalltalk.method({
  1311. selector: 'ifTrue:',
  1312. category: 'controlling',
  1313. fn: function (aBlock){
  1314. var self=this;
  1315. return self._ifTrue_ifFalse_(aBlock,(function(){return nil;}));
  1316. return self;},
  1317. source: unescape('ifTrue%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20aBlock%20ifFalse%3A%20%5B%5D%0A')}),
  1318. smalltalk.Boolean);
  1319. smalltalk.addMethod(
  1320. '_ifFalse_',
  1321. smalltalk.method({
  1322. selector: 'ifFalse:',
  1323. category: 'controlling',
  1324. fn: function (aBlock){
  1325. var self=this;
  1326. return self._ifTrue_ifFalse_((function(){return nil;}),aBlock);
  1327. return self;},
  1328. source: unescape('ifFalse%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20%5B%5D%20ifFalse%3A%20aBlock%0A')}),
  1329. smalltalk.Boolean);
  1330. smalltalk.addMethod(
  1331. '_ifFalse_ifTrue_',
  1332. smalltalk.method({
  1333. selector: 'ifFalse:ifTrue:',
  1334. category: 'controlling',
  1335. fn: function (aBlock, anotherBlock){
  1336. var self=this;
  1337. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  1338. return self;},
  1339. source: unescape('ifFalse%3A%20aBlock%20ifTrue%3A%20anotherBlock%0A%09%5Eself%20ifTrue%3A%20anotherBlock%20ifFalse%3A%20aBlock%0A')}),
  1340. smalltalk.Boolean);
  1341. smalltalk.addMethod(
  1342. '_ifTrue_ifFalse_',
  1343. smalltalk.method({
  1344. selector: 'ifTrue:ifFalse:',
  1345. category: 'controlling',
  1346. fn: function (aBlock, anotherBlock){
  1347. var self=this;
  1348. return (function(){
  1349. if(self == true) {
  1350. return aBlock();
  1351. } else {
  1352. return anotherBlock();
  1353. }
  1354. })();
  1355. return self;},
  1356. source: unescape('ifTrue%3A%20aBlock%20ifFalse%3A%20anotherBlock%0A%09%5E%7B%27%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  1357. smalltalk.Boolean);
  1358. smalltalk.addMethod(
  1359. '_and_',
  1360. smalltalk.method({
  1361. selector: 'and:',
  1362. category: 'controlling',
  1363. fn: function (aBlock){
  1364. var self=this;
  1365. return self.__eq(true)._ifTrue_ifFalse_(aBlock,(function(){return false;}));
  1366. return self;},
  1367. source: unescape('and%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20aBlock%0A%09%20%20%20%20ifFalse%3A%20%5Bfalse%5D%0A')}),
  1368. smalltalk.Boolean);
  1369. smalltalk.addMethod(
  1370. '_or_',
  1371. smalltalk.method({
  1372. selector: 'or:',
  1373. category: 'controlling',
  1374. fn: function (aBlock){
  1375. var self=this;
  1376. return self.__eq(true)._ifTrue_ifFalse_((function(){return true;}),aBlock);
  1377. return self;},
  1378. source: unescape('or%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20aBlock%0A')}),
  1379. smalltalk.Boolean);
  1380. smalltalk.addMethod(
  1381. '_not',
  1382. smalltalk.method({
  1383. selector: 'not',
  1384. category: 'controlling',
  1385. fn: function (){
  1386. var self=this;
  1387. return self.__eq(false);
  1388. return self;},
  1389. source: unescape('not%0A%09%5Eself%20%3D%20false%0A')}),
  1390. smalltalk.Boolean);
  1391. smalltalk.addMethod(
  1392. '_printString',
  1393. smalltalk.method({
  1394. selector: 'printString',
  1395. category: 'printing',
  1396. fn: function (){
  1397. var self=this;
  1398. return (function(){return self.toString()})();
  1399. return self;},
  1400. source: unescape('printString%0A%09%5E%7B%27return%20self.toString%28%29%27%7D%0A')}),
  1401. smalltalk.Boolean);
  1402. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel');
  1403. smalltalk.addMethod(
  1404. '_subclass_instanceVariableNames_',
  1405. smalltalk.method({
  1406. selector: 'subclass:instanceVariableNames:',
  1407. category: 'class creation',
  1408. fn: function (aString, anotherString){
  1409. var self=this;
  1410. return self._subclass_instanceVariableNames_category_(aString,anotherString,nil);
  1411. return self;},
  1412. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  1413. smalltalk.UndefinedObject);
  1414. smalltalk.addMethod(
  1415. '_subclass_instanceVariableNames_category_',
  1416. smalltalk.method({
  1417. selector: 'subclass:instanceVariableNames:category:',
  1418. category: 'class creation',
  1419. fn: function (aString, aString2, aString3){
  1420. var self=this;
  1421. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self,aString,aString2,aString3);
  1422. return self;},
  1423. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  1424. smalltalk.UndefinedObject);
  1425. smalltalk.addMethod(
  1426. '_shallowCopy',
  1427. smalltalk.method({
  1428. selector: 'shallowCopy',
  1429. category: 'copying',
  1430. fn: function (){
  1431. var self=this;
  1432. return self;
  1433. return self;},
  1434. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  1435. smalltalk.UndefinedObject);
  1436. smalltalk.addMethod(
  1437. '_deepCopy',
  1438. smalltalk.method({
  1439. selector: 'deepCopy',
  1440. category: 'copying',
  1441. fn: function (){
  1442. var self=this;
  1443. return self;
  1444. return self;},
  1445. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  1446. smalltalk.UndefinedObject);
  1447. smalltalk.addMethod(
  1448. '_ifNil_',
  1449. smalltalk.method({
  1450. selector: 'ifNil:',
  1451. category: 'testing',
  1452. fn: function (aBlock){
  1453. var self=this;
  1454. return self._ifNil_ifNotNil_(aBlock,(function(){return nil;}));
  1455. return self;},
  1456. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%20ifNil%3A%20aBlock%20ifNotNil%3A%20%5B%5D%0A')}),
  1457. smalltalk.UndefinedObject);
  1458. smalltalk.addMethod(
  1459. '_ifNotNil_',
  1460. smalltalk.method({
  1461. selector: 'ifNotNil:',
  1462. category: 'testing',
  1463. fn: function (aBlock){
  1464. var self=this;
  1465. return self;
  1466. return self;},
  1467. source: unescape('ifNotNil%3A%20aBlock%0A%09%5Eself%0A')}),
  1468. smalltalk.UndefinedObject);
  1469. smalltalk.addMethod(
  1470. '_ifNil_ifNotNil_',
  1471. smalltalk.method({
  1472. selector: 'ifNil:ifNotNil:',
  1473. category: 'testing',
  1474. fn: function (aBlock, anotherBlock){
  1475. var self=this;
  1476. return aBlock._value();
  1477. return self;},
  1478. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  1479. smalltalk.UndefinedObject);
  1480. smalltalk.addMethod(
  1481. '_ifNotNil_ifNil_',
  1482. smalltalk.method({
  1483. selector: 'ifNotNil:ifNil:',
  1484. category: 'testing',
  1485. fn: function (aBlock, anotherBlock){
  1486. var self=this;
  1487. return anotherBlock._value();
  1488. return self;},
  1489. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  1490. smalltalk.UndefinedObject);
  1491. smalltalk.addMethod(
  1492. '_isNil',
  1493. smalltalk.method({
  1494. selector: 'isNil',
  1495. category: 'testing',
  1496. fn: function (){
  1497. var self=this;
  1498. return true;
  1499. return self;},
  1500. source: unescape('isNil%0A%09%5Etrue%0A')}),
  1501. smalltalk.UndefinedObject);
  1502. smalltalk.addMethod(
  1503. '_notNil',
  1504. smalltalk.method({
  1505. selector: 'notNil',
  1506. category: 'testing',
  1507. fn: function (){
  1508. var self=this;
  1509. return false;
  1510. return self;},
  1511. source: unescape('notNil%0A%09%5Efalse%0A')}),
  1512. smalltalk.UndefinedObject);
  1513. smalltalk.addMethod(
  1514. '_printString',
  1515. smalltalk.method({
  1516. selector: 'printString',
  1517. category: 'printing',
  1518. fn: function (){
  1519. var self=this;
  1520. return "nil";
  1521. return self;},
  1522. source: unescape('printString%0A%20%20%20%20%5E%27nil%27%0A')}),
  1523. smalltalk.UndefinedObject);
  1524. smalltalk.addMethod(
  1525. '_new',
  1526. smalltalk.method({
  1527. selector: 'new',
  1528. category: 'instance creation',
  1529. fn: function (){
  1530. var self=this;
  1531. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  1532. return self;},
  1533. source: unescape('new%0A%09%20%20%20%20self%20error%3A%20%27You%20cannot%20create%20new%20instances%20of%20UndefinedObject.%20Use%20nil%27%0A')}),
  1534. smalltalk.UndefinedObject.klass);
  1535. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel');
  1536. smalltalk.addMethod(
  1537. '_size',
  1538. smalltalk.method({
  1539. selector: 'size',
  1540. category: 'accessing',
  1541. fn: function (){
  1542. var self=this;
  1543. self._subclassResponsibility();
  1544. return self;},
  1545. source: unescape('size%0A%09self%20subclassResponsibility%0A')}),
  1546. smalltalk.Collection);
  1547. smalltalk.addMethod(
  1548. '_at_',
  1549. smalltalk.method({
  1550. selector: 'at:',
  1551. category: 'accessing',
  1552. fn: function (anIndex){
  1553. var self=this;
  1554. return self._at_ifAbsent_(anIndex,(function(){return self._errorNotFound();}));
  1555. return self;},
  1556. source: unescape('at%3A%20anIndex%0A%09%5Eself%20at%3A%20anIndex%20ifAbsent%3A%20%5B%0A%09%20%20%20%20self%20errorNotFound%5D%0A')}),
  1557. smalltalk.Collection);
  1558. smalltalk.addMethod(
  1559. '_at_put_',
  1560. smalltalk.method({
  1561. selector: 'at:put:',
  1562. category: 'accessing',
  1563. fn: function (anIndex, anObject){
  1564. var self=this;
  1565. self._subclassResponsibility();
  1566. return self;},
  1567. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  1568. smalltalk.Collection);
  1569. smalltalk.addMethod(
  1570. '_at_ifAbsent_',
  1571. smalltalk.method({
  1572. selector: 'at:ifAbsent:',
  1573. category: 'accessing',
  1574. fn: function (anIndex, aBlock){
  1575. var self=this;
  1576. self._subclassResponsibility();
  1577. return self;},
  1578. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09self%20subclassResponsibility%0A')}),
  1579. smalltalk.Collection);
  1580. smalltalk.addMethod(
  1581. '_first',
  1582. smalltalk.method({
  1583. selector: 'first',
  1584. category: 'accessing',
  1585. fn: function (){
  1586. var self=this;
  1587. return self._at_((1));
  1588. return self;},
  1589. source: unescape('first%0A%09%5Eself%20at%3A%201%0A')}),
  1590. smalltalk.Collection);
  1591. smalltalk.addMethod(
  1592. '_second',
  1593. smalltalk.method({
  1594. selector: 'second',
  1595. category: 'accessing',
  1596. fn: function (){
  1597. var self=this;
  1598. return self._at_((2));
  1599. return self;},
  1600. source: unescape('second%0A%09%5Eself%20at%3A%202%0A')}),
  1601. smalltalk.Collection);
  1602. smalltalk.addMethod(
  1603. '_third',
  1604. smalltalk.method({
  1605. selector: 'third',
  1606. category: 'accessing',
  1607. fn: function (){
  1608. var self=this;
  1609. return self._at_((3));
  1610. return self;},
  1611. source: unescape('third%0A%09%5Eself%20at%3A%203%0A')}),
  1612. smalltalk.Collection);
  1613. smalltalk.addMethod(
  1614. '_fourth',
  1615. smalltalk.method({
  1616. selector: 'fourth',
  1617. category: 'accessing',
  1618. fn: function (){
  1619. var self=this;
  1620. return self._at_((4));
  1621. return self;},
  1622. source: unescape('fourth%0A%09%5Eself%20at%3A%204%0A')}),
  1623. smalltalk.Collection);
  1624. smalltalk.addMethod(
  1625. '_last',
  1626. smalltalk.method({
  1627. selector: 'last',
  1628. category: 'accessing',
  1629. fn: function (){
  1630. var self=this;
  1631. return self._at_(self._size());
  1632. return self;},
  1633. source: unescape('last%0A%09%5Eself%20at%3A%20self%20size%0A')}),
  1634. smalltalk.Collection);
  1635. smalltalk.addMethod(
  1636. '_readStream',
  1637. smalltalk.method({
  1638. selector: 'readStream',
  1639. category: 'accessing',
  1640. fn: function (){
  1641. var self=this;
  1642. return self._stream();
  1643. return self;},
  1644. source: unescape('readStream%0A%09%5Eself%20stream%0A')}),
  1645. smalltalk.Collection);
  1646. smalltalk.addMethod(
  1647. '_writeStream',
  1648. smalltalk.method({
  1649. selector: 'writeStream',
  1650. category: 'accessing',
  1651. fn: function (){
  1652. var self=this;
  1653. return self._stream();
  1654. return self;},
  1655. source: unescape('writeStream%0A%09%5Eself%20stream%0A')}),
  1656. smalltalk.Collection);
  1657. smalltalk.addMethod(
  1658. '_stream',
  1659. smalltalk.method({
  1660. selector: 'stream',
  1661. category: 'accessing',
  1662. fn: function (){
  1663. var self=this;
  1664. return self._streamClass()._on_(self);
  1665. return self;},
  1666. source: unescape('stream%0A%09%5Eself%20streamClass%20on%3A%20self%0A')}),
  1667. smalltalk.Collection);
  1668. smalltalk.addMethod(
  1669. '_streamClass',
  1670. smalltalk.method({
  1671. selector: 'streamClass',
  1672. category: 'accessing',
  1673. fn: function (){
  1674. var self=this;
  1675. return self._class()._streamClass();
  1676. return self;},
  1677. source: unescape('streamClass%0A%09%5Eself%20class%20streamClass%0A')}),
  1678. smalltalk.Collection);
  1679. smalltalk.addMethod(
  1680. '_add_',
  1681. smalltalk.method({
  1682. selector: 'add:',
  1683. category: 'adding/removing',
  1684. fn: function (anObject){
  1685. var self=this;
  1686. self._subclassResponsibility();
  1687. return self;},
  1688. source: unescape('add%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  1689. smalltalk.Collection);
  1690. smalltalk.addMethod(
  1691. '_addAll_',
  1692. smalltalk.method({
  1693. selector: 'addAll:',
  1694. category: 'adding/removing',
  1695. fn: function (aCollection){
  1696. var self=this;
  1697. aCollection._do_((function(each){return self._add_(each);}));
  1698. return aCollection;
  1699. return self;},
  1700. source: unescape('addAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20add%3A%20each%5D.%0A%09%5EaCollection%0A')}),
  1701. smalltalk.Collection);
  1702. smalltalk.addMethod(
  1703. '__comma',
  1704. smalltalk.method({
  1705. selector: ',',
  1706. category: 'copying',
  1707. fn: function (aCollection){
  1708. var self=this;
  1709. return (function($rec){$rec._addAll_(aCollection);return $rec._yourself();})(self._copy());
  1710. return self;},
  1711. source: unescape('%2C%20aCollection%0A%09%5Eself%20copy%20%0A%09%20%20%20%20addAll%3A%20aCollection%3B%20%0A%09%20%20%20%20yourself%0A')}),
  1712. smalltalk.Collection);
  1713. smalltalk.addMethod(
  1714. '_copyFrom_to_',
  1715. smalltalk.method({
  1716. selector: 'copyFrom:to:',
  1717. category: 'copying',
  1718. fn: function (anIndex, anotherIndex){
  1719. var self=this;
  1720. self._subclassResponsibility();
  1721. return self;},
  1722. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20subclassResponsibility%0A')}),
  1723. smalltalk.Collection);
  1724. smalltalk.addMethod(
  1725. '_copyWith_',
  1726. smalltalk.method({
  1727. selector: 'copyWith:',
  1728. category: 'copying',
  1729. fn: function (anObject){
  1730. var self=this;
  1731. return (function($rec){$rec._add_(anObject);return $rec._yourself();})(self._copy());
  1732. return self;},
  1733. source: unescape('copyWith%3A%20anObject%0A%09%5Eself%20copy%20add%3A%20anObject%3B%20yourself%0A')}),
  1734. smalltalk.Collection);
  1735. smalltalk.addMethod(
  1736. '_copyWithAll_',
  1737. smalltalk.method({
  1738. selector: 'copyWithAll:',
  1739. category: 'copying',
  1740. fn: function (aCollection){
  1741. var self=this;
  1742. return (function($rec){$rec._addAll_(aCollection);return $rec._yourself();})(self._copy());
  1743. return self;},
  1744. source: unescape('copyWithAll%3A%20aCollection%0A%09%5Eself%20copy%20addAll%3A%20aCollection%3B%20yourself%0A')}),
  1745. smalltalk.Collection);
  1746. smalltalk.addMethod(
  1747. '_asArray',
  1748. smalltalk.method({
  1749. selector: 'asArray',
  1750. category: 'converting',
  1751. fn: function (){
  1752. var self=this;
  1753. var array=nil;
  1754. var index=nil;
  1755. array=smalltalk.Array._new();
  1756. index=(0);
  1757. self._do_((function(each){index=index.__plus((1));return array._at_put_(index,each);}));
  1758. return array;
  1759. return self;},
  1760. source: unescape('asArray%0A%09%7C%20array%20index%20%7C%0A%09array%20%3A%3D%20Array%20new.%0A%09index%20%3A%3D%200.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20index%20%3A%3D%20index%20+%201.%0A%09%20%20%20%20array%20at%3A%20index%20put%3A%20each%5D.%0A%09%5Earray%0A')}),
  1761. smalltalk.Collection);
  1762. smalltalk.addMethod(
  1763. '_do_',
  1764. smalltalk.method({
  1765. selector: 'do:',
  1766. category: 'enumerating',
  1767. fn: function (aBlock){
  1768. var self=this;
  1769. (function(){for(var i=0;i<self.length;i++){aBlock(self[i]);}})();
  1770. return self;},
  1771. source: unescape('do%3A%20aBlock%0A%09%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%7BaBlock%28self%5Bi%5D%29%3B%7D%27%7D%0A')}),
  1772. smalltalk.Collection);
  1773. smalltalk.addMethod(
  1774. '_collect_',
  1775. smalltalk.method({
  1776. selector: 'collect:',
  1777. category: 'enumerating',
  1778. fn: function (aBlock){
  1779. var self=this;
  1780. var stream=nil;
  1781. stream=self._class()._new()._writeStream();
  1782. self._do_((function(each){return stream._nextPut_(aBlock._value_(each));}));
  1783. return stream._contents();
  1784. return self;},
  1785. source: unescape('collect%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20stream%20nextPut%3A%20%28aBlock%20value%3A%20each%29%5D.%0A%09%5Estream%20contents%0A')}),
  1786. smalltalk.Collection);
  1787. smalltalk.addMethod(
  1788. '_detect_',
  1789. smalltalk.method({
  1790. selector: 'detect:',
  1791. category: 'enumerating',
  1792. fn: function (aBlock){
  1793. var self=this;
  1794. return self._detect_ifNone_(aBlock,(function(){return self._errorNotFound();}));
  1795. return self;},
  1796. source: unescape('detect%3A%20aBlock%0A%09%5Eself%20detect%3A%20aBlock%20ifNone%3A%20%5Bself%20errorNotFound%5D%0A')}),
  1797. smalltalk.Collection);
  1798. smalltalk.addMethod(
  1799. '_detect_ifNone_',
  1800. smalltalk.method({
  1801. selector: 'detect:ifNone:',
  1802. category: 'enumerating',
  1803. fn: function (aBlock, anotherBlock){
  1804. var self=this;
  1805. return (function(){
  1806. for(var i = 0; i < self.length; i++)
  1807. if(aBlock(self[i]))
  1808. return self[i];
  1809. return anotherBlock();
  1810. })();
  1811. return self;},
  1812. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5E%7B%27%0A%09for%28var%20i%20%3D%200%3B%20i%20%3C%20self.length%3B%20i++%29%0A%09%09if%28aBlock%28self%5Bi%5D%29%29%0A%09%09%09return%20self%5Bi%5D%3B%0A%09return%20anotherBlock%28%29%3B%0A%09%27%7D%0A')}),
  1813. smalltalk.Collection);
  1814. smalltalk.addMethod(
  1815. '_do_separatedBy_',
  1816. smalltalk.method({
  1817. selector: 'do:separatedBy:',
  1818. category: 'enumerating',
  1819. fn: function (aBlock, anotherBlock){
  1820. var self=this;
  1821. var first=nil;
  1822. first=true;
  1823. self._do_((function(each){first._ifTrue_ifFalse_((function(){return first=false;}),(function(){return anotherBlock._value();}));return aBlock._value_(each);}));
  1824. return self;},
  1825. source: unescape('do%3A%20aBlock%20separatedBy%3A%20anotherBlock%0A%20%20%20%20%09%7C%20first%20%7C%0A%20%20%20%20%09first%20%3A%3D%20true.%0A%20%20%20%20%09self%20do%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20first%0A%20%20%20%20%09%09ifTrue%3A%20%5Bfirst%20%3A%3D%20false%5D%0A%20%20%20%20%09%09ifFalse%3A%20%5BanotherBlock%20value%5D.%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%5D%0A')}),
  1826. smalltalk.Collection);
  1827. smalltalk.addMethod(
  1828. '_inject_into_',
  1829. smalltalk.method({
  1830. selector: 'inject:into:',
  1831. category: 'enumerating',
  1832. fn: function (anObject, aBlock){
  1833. var self=this;
  1834. var result=nil;
  1835. result=anObject;
  1836. self._do_((function(each){return result=aBlock._value_value_(result,each);}));
  1837. return result;
  1838. return self;},
  1839. source: unescape('inject%3A%20anObject%20into%3A%20aBlock%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20anObject.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20%0A%09%20%20%20%20result%20%3A%3D%20aBlock%20value%3A%20result%20value%3A%20each%5D.%0A%09%5Eresult%0A')}),
  1840. smalltalk.Collection);
  1841. smalltalk.addMethod(
  1842. '_reject_',
  1843. smalltalk.method({
  1844. selector: 'reject:',
  1845. category: 'enumerating',
  1846. fn: function (aBlock){
  1847. var self=this;
  1848. return self._select_((function(each){return aBlock._value_(each).__eq(false);}));
  1849. return self;},
  1850. source: unescape('reject%3A%20aBlock%0A%09%5Eself%20select%3A%20%5B%3Aeach%20%7C%20%28aBlock%20value%3A%20each%29%20%3D%20false%5D%0A')}),
  1851. smalltalk.Collection);
  1852. smalltalk.addMethod(
  1853. '_select_',
  1854. smalltalk.method({
  1855. selector: 'select:',
  1856. category: 'enumerating',
  1857. fn: function (aBlock){
  1858. var self=this;
  1859. var stream=nil;
  1860. stream=self._class()._new()._writeStream();
  1861. self._do_((function(each){return aBlock._value_(each)._ifTrue_((function(){return stream._nextPut_(each);}));}));
  1862. return stream._contents();
  1863. return self;},
  1864. source: unescape('select%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20%28aBlock%20value%3A%20each%29%20ifTrue%3A%20%5B%0A%09%09stream%20nextPut%3A%20each%5D%5D.%0A%09%5Estream%20contents%0A')}),
  1865. smalltalk.Collection);
  1866. smalltalk.addMethod(
  1867. '_errorNotFound',
  1868. smalltalk.method({
  1869. selector: 'errorNotFound',
  1870. category: 'error handling',
  1871. fn: function (){
  1872. var self=this;
  1873. self._error_("Object is not in the collection");
  1874. return self;},
  1875. source: unescape('errorNotFound%0A%09self%20error%3A%20%27Object%20is%20not%20in%20the%20collection%27%0A')}),
  1876. smalltalk.Collection);
  1877. smalltalk.addMethod(
  1878. '_includes_',
  1879. smalltalk.method({
  1880. selector: 'includes:',
  1881. category: 'testing',
  1882. fn: function (anObject){
  1883. var self=this;
  1884. return (function(){
  1885. var i = self.length;
  1886. while (i--) {
  1887. if (self[i].__eq(anObject)) {
  1888. return true;
  1889. }
  1890. }
  1891. return false;
  1892. })();
  1893. return self;},
  1894. source: unescape('includes%3A%20anObject%0A%09%5E%7B%27%0A%09%09var%20i%20%3D%20self.length%3B%0A%09%09while%20%28i--%29%20%7B%0A%09%09%09if%20%28self%5Bi%5D.__eq%28anObject%29%29%20%7B%0A%09%09%09%09return%20true%3B%0A%09%09%09%7D%09%0A%09%09%7D%0A%09%09return%20false%3B%0A%0A%09%27%7D%0A')}),
  1895. smalltalk.Collection);
  1896. smalltalk.addMethod(
  1897. '_notEmpty',
  1898. smalltalk.method({
  1899. selector: 'notEmpty',
  1900. category: 'testing',
  1901. fn: function (){
  1902. var self=this;
  1903. return self._isEmpty()._not();
  1904. return self;},
  1905. source: unescape('notEmpty%0A%09%5Eself%20isEmpty%20not%0A')}),
  1906. smalltalk.Collection);
  1907. smalltalk.addMethod(
  1908. '_isEmpty',
  1909. smalltalk.method({
  1910. selector: 'isEmpty',
  1911. category: 'testing',
  1912. fn: function (){
  1913. var self=this;
  1914. return self._size().__eq((0));
  1915. return self;},
  1916. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  1917. smalltalk.Collection);
  1918. smalltalk.addMethod(
  1919. '_remove_',
  1920. smalltalk.method({
  1921. selector: 'remove:',
  1922. category: 'adding/removing',
  1923. fn: function (anObject){
  1924. var self=this;
  1925. self._subclassResponsibility();
  1926. return self;},
  1927. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20subclassResponsibility%0A')}),
  1928. smalltalk.Collection);
  1929. smalltalk.addMethod(
  1930. '_streamClass',
  1931. smalltalk.method({
  1932. selector: 'streamClass',
  1933. category: 'accessing',
  1934. fn: function (){
  1935. var self=this;
  1936. return smalltalk.Stream;
  1937. return self;},
  1938. source: unescape('streamClass%0A%09%20%20%20%20%5EStream%0A')}),
  1939. smalltalk.Collection.klass);
  1940. smalltalk.addMethod(
  1941. '_with_',
  1942. smalltalk.method({
  1943. selector: 'with:',
  1944. category: 'instance creation',
  1945. fn: function (anObject){
  1946. var self=this;
  1947. return (function($rec){$rec._add_(anObject);return $rec._yourself();})(self._new());
  1948. return self;},
  1949. source: unescape('with%3A%20anObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09yourself%0A')}),
  1950. smalltalk.Collection.klass);
  1951. smalltalk.addMethod(
  1952. '_with_with_',
  1953. smalltalk.method({
  1954. selector: 'with:with:',
  1955. category: 'instance creation',
  1956. fn: function (anObject, anotherObject){
  1957. var self=this;
  1958. return (function($rec){$rec._add_(anObject);$rec._add_(anotherObject);return $rec._yourself();})(self._new());
  1959. return self;},
  1960. source: unescape('with%3A%20anObject%20with%3A%20anotherObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09add%3A%20anotherObject%3B%0A%09%09yourself%0A')}),
  1961. smalltalk.Collection.klass);
  1962. smalltalk.addMethod(
  1963. '_with_with_with_',
  1964. smalltalk.method({
  1965. selector: 'with:with:with:',
  1966. category: 'instance creation',
  1967. fn: function (firstObject, secondObject, thirdObject){
  1968. var self=this;
  1969. return (function($rec){$rec._add_(firstObject);$rec._add_(secondObject);$rec._add_(thirdObject);return $rec._yourself();})(self._new());
  1970. return self;},
  1971. source: unescape('with%3A%20firstObject%20with%3A%20secondObject%20with%3A%20thirdObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20firstObject%3B%0A%09%09add%3A%20secondObject%3B%0A%09%09add%3A%20thirdObject%3B%0A%09%09yourself%0A')}),
  1972. smalltalk.Collection.klass);
  1973. smalltalk.addMethod(
  1974. '_withAll_',
  1975. smalltalk.method({
  1976. selector: 'withAll:',
  1977. category: 'instance creation',
  1978. fn: function (aCollection){
  1979. var self=this;
  1980. return (function($rec){$rec._addAll_(aCollection);return $rec._yourself();})(self._new());
  1981. return self;},
  1982. source: unescape('withAll%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%0A%09%09addAll%3A%20aCollection%3B%0A%09%09yourself%0A')}),
  1983. smalltalk.Collection.klass);
  1984. smalltalk.addClass('String', smalltalk.Collection, [], 'Kernel');
  1985. smalltalk.addMethod(
  1986. '__eq',
  1987. smalltalk.method({
  1988. selector: '=',
  1989. category: 'comparing',
  1990. fn: function (aString){
  1991. var self=this;
  1992. return (function(){return String(self) == aString})();
  1993. return self;},
  1994. source: unescape('%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3D%3D%20aString%27%7D%0A')}),
  1995. smalltalk.String);
  1996. smalltalk.addMethod(
  1997. '_size',
  1998. smalltalk.method({
  1999. selector: 'size',
  2000. category: 'accessing',
  2001. fn: function (){
  2002. var self=this;
  2003. return (function(){return self.length})();
  2004. return self;},
  2005. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2006. smalltalk.String);
  2007. smalltalk.addMethod(
  2008. '_at_',
  2009. smalltalk.method({
  2010. selector: 'at:',
  2011. category: 'accessing',
  2012. fn: function (anIndex){
  2013. var self=this;
  2014. return (function(){return self[anIndex - 1] || nil;})();
  2015. return self;},
  2016. source: unescape('at%3A%20anIndex%0A%20%20%20%20%09%5E%7B%27return%20self%5BanIndex%20-%201%5D%20%7C%7C%20nil%3B%27%7D%0A')}),
  2017. smalltalk.String);
  2018. smalltalk.addMethod(
  2019. '_at_put_',
  2020. smalltalk.method({
  2021. selector: 'at:put:',
  2022. category: 'accessing',
  2023. fn: function (anIndex, anObject){
  2024. var self=this;
  2025. self._errorReadOnly();
  2026. return self;},
  2027. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2028. smalltalk.String);
  2029. smalltalk.addMethod(
  2030. '_at_ifAbsent_',
  2031. smalltalk.method({
  2032. selector: 'at:ifAbsent:',
  2033. category: 'accessing',
  2034. fn: function (anIndex, aBlock){
  2035. var self=this;
  2036. self._at_(anIndex)._ifNil_((function(){return aBlock;}));
  2037. return self;},
  2038. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%20%20%20%20%09%28self%20at%3A%20anIndex%29%20ifNil%3A%20%5BaBlock%5D%0A')}),
  2039. smalltalk.String);
  2040. smalltalk.addMethod(
  2041. '_escaped',
  2042. smalltalk.method({
  2043. selector: 'escaped',
  2044. category: 'accessing',
  2045. fn: function (){
  2046. var self=this;
  2047. return (function(){return escape(self)})();
  2048. return self;},
  2049. source: unescape('escaped%0A%09%5E%7B%27return%20escape%28self%29%27%7D%0A')}),
  2050. smalltalk.String);
  2051. smalltalk.addMethod(
  2052. '_unescaped',
  2053. smalltalk.method({
  2054. selector: 'unescaped',
  2055. category: 'accessing',
  2056. fn: function (){
  2057. var self=this;
  2058. return (function(){return unescape(self)})();
  2059. return self;},
  2060. source: unescape('unescaped%0A%09%5E%7B%27return%20unescape%28self%29%27%7D%0A')}),
  2061. smalltalk.String);
  2062. smalltalk.addMethod(
  2063. '_add_',
  2064. smalltalk.method({
  2065. selector: 'add:',
  2066. category: 'adding',
  2067. fn: function (anObject){
  2068. var self=this;
  2069. self._errorReadOnly();
  2070. return self;},
  2071. source: unescape('add%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2072. smalltalk.String);
  2073. smalltalk.addMethod(
  2074. '__comma',
  2075. smalltalk.method({
  2076. selector: ',',
  2077. category: 'copying',
  2078. fn: function (aString){
  2079. var self=this;
  2080. return (function(){return self + aString})();
  2081. return self;},
  2082. source: unescape('%2C%20aString%0A%20%20%20%20%09%5E%7B%27return%20self%20+%20aString%27%7D%0A')}),
  2083. smalltalk.String);
  2084. smalltalk.addMethod(
  2085. '_copyFrom_to_',
  2086. smalltalk.method({
  2087. selector: 'copyFrom:to:',
  2088. category: 'copying',
  2089. fn: function (anIndex, anotherIndex){
  2090. var self=this;
  2091. return (function(){return self.substring(anIndex - 1, anotherIndex);})();
  2092. return self;},
  2093. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%20%20%20%20%09%5E%7B%27return%20self.substring%28anIndex%20-%201%2C%20anotherIndex%29%3B%27%7D%0A')}),
  2094. smalltalk.String);
  2095. smalltalk.addMethod(
  2096. '_shallowCopy',
  2097. smalltalk.method({
  2098. selector: 'shallowCopy',
  2099. category: 'copying',
  2100. fn: function (){
  2101. var self=this;
  2102. return self._class()._fromString_(self);
  2103. return self;},
  2104. source: unescape('shallowCopy%0A%20%20%20%20%09%5Eself%20class%20fromString%3A%20self%0A')}),
  2105. smalltalk.String);
  2106. smalltalk.addMethod(
  2107. '_deepCopy',
  2108. smalltalk.method({
  2109. selector: 'deepCopy',
  2110. category: 'copying',
  2111. fn: function (){
  2112. var self=this;
  2113. return self._shallowCopy();
  2114. return self;},
  2115. source: unescape('deepCopy%0A%20%20%20%20%09%5Eself%20shallowCopy%0A')}),
  2116. smalltalk.String);
  2117. smalltalk.addMethod(
  2118. '_asSelector',
  2119. smalltalk.method({
  2120. selector: 'asSelector',
  2121. category: 'converting',
  2122. fn: function (){
  2123. var self=this;
  2124. var selector=nil;
  2125. selector="_".__comma(self);
  2126. selector=selector._replace_with_(":","_");
  2127. selector=selector._replace_with_(unescape("%5B+%5D"),"_plus");
  2128. selector=selector._replace_with_(unescape("-"),"_minus");
  2129. selector=selector._replace_with_(unescape("%5B*%5D"),"_star");
  2130. selector=selector._replace_with_(unescape("%5B/%5D"),"_slash");
  2131. selector=selector._replace_with_(unescape("%3E"),"_gt");
  2132. selector=selector._replace_with_(unescape("%3C"),"_lt");
  2133. selector=selector._replace_with_(unescape("%3D"),"_eq");
  2134. selector=selector._replace_with_(unescape("%2C"),"_comma");
  2135. selector=selector._replace_with_(unescape("%5B@%5D"),"_at");
  2136. return selector;
  2137. return self;},
  2138. source: unescape('asSelector%0A%09%7C%20selector%20%7C%0A%09selector%20%3A%3D%20%27_%27%2C%20self.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3A%27%20with%3A%20%27_%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B+%5D%27%20with%3A%20%27_plus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27-%27%20with%3A%20%27_minus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B*%5D%27%20with%3A%20%27_star%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B/%5D%27%20with%3A%20%27_slash%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3E%27%20with%3A%20%27_gt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3C%27%20with%3A%20%27_lt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3D%27%20with%3A%20%27_eq%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%2C%27%20with%3A%20%27_comma%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B@%5D%27%20with%3A%20%27_at%27.%0A%09%5Eselector%0A')}),
  2139. smalltalk.String);
  2140. smalltalk.addMethod(
  2141. '_asJavascript',
  2142. smalltalk.method({
  2143. selector: 'asJavascript',
  2144. category: 'converting',
  2145. fn: function (){
  2146. var self=this;
  2147. return (function(){
  2148. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2149. return "unescape(\"" + escape(self) + "\")";
  2150. else
  2151. return "\"" + self + "\"";
  2152. })();
  2153. return self;},
  2154. source: unescape('asJavascript%0A%09%5E%7B%27%0A%09if%28self.search%28/%5E%5Ba-zA-Z0-9_%3A.%24%20%5D*%24/%29%20%3D%3D%20-1%29%0A%09%09return%20%22unescape%28%5C%22%22%20+%20escape%28self%29%20+%20%22%5C%22%29%22%3B%0A%09else%0A%09%09return%20%22%5C%22%22%20+%20self%20+%20%22%5C%22%22%3B%0A%09%27%7D%0A')}),
  2155. smalltalk.String);
  2156. smalltalk.addMethod(
  2157. '_replace_with_',
  2158. smalltalk.method({
  2159. selector: 'replace:with:',
  2160. category: 'regular expressions',
  2161. fn: function (aString, anotherString){
  2162. var self=this;
  2163. return self._replaceRegexp_with_(smalltalk.RegularExpression._fromString_flag_(aString,"g"),anotherString);
  2164. return self;},
  2165. source: unescape('replace%3A%20aString%20with%3A%20anotherString%0A%20%20%20%20%09%5Eself%20replaceRegexp%3A%20%28RegularExpression%20fromString%3A%20aString%20flag%3A%20%27g%27%29%20with%3A%20anotherString%0A')}),
  2166. smalltalk.String);
  2167. smalltalk.addMethod(
  2168. '_replaceRegexp_with_',
  2169. smalltalk.method({
  2170. selector: 'replaceRegexp:with:',
  2171. category: 'regular expressions',
  2172. fn: function (aRegexp, aString){
  2173. var self=this;
  2174. return (function(){return self.replace(aRegexp, aString);})();
  2175. return self;},
  2176. source: unescape('replaceRegexp%3A%20aRegexp%20with%3A%20aString%0A%20%20%20%20%09%5E%7B%27return%20self.replace%28aRegexp%2C%20aString%29%3B%27%7D%0A')}),
  2177. smalltalk.String);
  2178. smalltalk.addMethod(
  2179. '_tokenize_',
  2180. smalltalk.method({
  2181. selector: 'tokenize:',
  2182. category: 'converting',
  2183. fn: function (aString){
  2184. var self=this;
  2185. return (function(){return self.split(aString)})();
  2186. return self;},
  2187. source: unescape('tokenize%3A%20aString%0A%09%5E%7B%27return%20self.split%28aString%29%27%7D%0A')}),
  2188. smalltalk.String);
  2189. smalltalk.addMethod(
  2190. '_match_',
  2191. smalltalk.method({
  2192. selector: 'match:',
  2193. category: 'regular expressions',
  2194. fn: function (aRegexp){
  2195. var self=this;
  2196. return (function(){return self.search(aRegexp) != -1})();
  2197. return self;},
  2198. source: unescape('match%3A%20aRegexp%0A%20%20%20%20%09%5E%7B%27return%20self.search%28aRegexp%29%20%21%3D%20-1%27%7D%0A')}),
  2199. smalltalk.String);
  2200. smalltalk.addMethod(
  2201. '_asString',
  2202. smalltalk.method({
  2203. selector: 'asString',
  2204. category: 'converting',
  2205. fn: function (){
  2206. var self=this;
  2207. return self;
  2208. return self;},
  2209. source: unescape('asString%0A%20%20%20%20%09%5Eself%0A')}),
  2210. smalltalk.String);
  2211. smalltalk.addMethod(
  2212. '_asNumber',
  2213. smalltalk.method({
  2214. selector: 'asNumber',
  2215. category: 'converting',
  2216. fn: function (){
  2217. var self=this;
  2218. return (function(){return Number(self);})();
  2219. return self;},
  2220. source: unescape('asNumber%0A%09%5E%7B%27return%20Number%28self%29%3B%27%7D%0A')}),
  2221. smalltalk.String);
  2222. smalltalk.addMethod(
  2223. '_asParser',
  2224. smalltalk.method({
  2225. selector: 'asParser',
  2226. category: 'converting',
  2227. fn: function (){
  2228. var self=this;
  2229. return smalltalk.PPStringParser._new()._string_(self);
  2230. return self;},
  2231. source: unescape('asParser%0A%20%20%20%20%09%5EPPStringParser%20new%20string%3A%20self%0A')}),
  2232. smalltalk.String);
  2233. smalltalk.addMethod(
  2234. '_asChoiceParser',
  2235. smalltalk.method({
  2236. selector: 'asChoiceParser',
  2237. category: 'converting',
  2238. fn: function (){
  2239. var self=this;
  2240. return smalltalk.PPChoiceParser._withAll_(self._asArray()._collect_((function(each){return each._asParser();})));
  2241. return self;},
  2242. source: unescape('asChoiceParser%0A%20%20%20%20%09%5EPPChoiceParser%20withAll%3A%20%28self%20asArray%20collect%3A%20%5B%3Aeach%20%7C%20each%20asParser%5D%29%0A')}),
  2243. smalltalk.String);
  2244. smalltalk.addMethod(
  2245. '_asCharacterParser',
  2246. smalltalk.method({
  2247. selector: 'asCharacterParser',
  2248. category: 'converting',
  2249. fn: function (){
  2250. var self=this;
  2251. return smalltalk.PPCharacterParser._new()._string_(self);
  2252. return self;},
  2253. source: unescape('asCharacterParser%0A%20%20%20%20%09%5EPPCharacterParser%20new%20string%3A%20self%0A')}),
  2254. smalltalk.String);
  2255. smalltalk.addMethod(
  2256. '_errorReadOnly',
  2257. smalltalk.method({
  2258. selector: 'errorReadOnly',
  2259. category: 'error handling',
  2260. fn: function (){
  2261. var self=this;
  2262. self._error_(unescape("Object%20is%20read-only"));
  2263. return self;},
  2264. source: unescape('errorReadOnly%0A%20%20%20%20%09self%20error%3A%20%27Object%20is%20read-only%27%0A')}),
  2265. smalltalk.String);
  2266. smalltalk.addMethod(
  2267. '_printString',
  2268. smalltalk.method({
  2269. selector: 'printString',
  2270. category: 'printing',
  2271. fn: function (){
  2272. var self=this;
  2273. return unescape("%27").__comma(self).__comma(unescape("%27"));
  2274. return self;},
  2275. source: unescape('printString%0A%20%20%20%20%09%5E%27%27%27%27%2C%20self%2C%20%27%27%27%27%0A')}),
  2276. smalltalk.String);
  2277. smalltalk.addMethod(
  2278. '_printNl',
  2279. smalltalk.method({
  2280. selector: 'printNl',
  2281. category: 'printing',
  2282. fn: function (){
  2283. var self=this;
  2284. (function(){console.log(self)})();
  2285. return self;},
  2286. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  2287. smalltalk.String);
  2288. smalltalk.addMethod(
  2289. '_isString',
  2290. smalltalk.method({
  2291. selector: 'isString',
  2292. category: 'testing',
  2293. fn: function (){
  2294. var self=this;
  2295. return true;
  2296. return self;},
  2297. source: unescape('isString%0A%20%20%20%20%09%5Etrue%0A')}),
  2298. smalltalk.String);
  2299. smalltalk.addMethod(
  2300. '_asJQuery',
  2301. smalltalk.method({
  2302. selector: 'asJQuery',
  2303. category: '*JQuery',
  2304. fn: function (){
  2305. var self=this;
  2306. return smalltalk.JQuery._fromString_(self);
  2307. return self;},
  2308. source: unescape('asJQuery%0A%20%20%20%20%5EJQuery%20fromString%3A%20self%0A')}),
  2309. smalltalk.String);
  2310. smalltalk.addMethod(
  2311. '_appendToJQuery_',
  2312. smalltalk.method({
  2313. selector: 'appendToJQuery:',
  2314. category: '*JQuery',
  2315. fn: function (aJQuery){
  2316. var self=this;
  2317. (function(){aJQuery._appendElement_(String(self))})();
  2318. return self;},
  2319. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20%7B%27aJQuery._appendElement_%28String%28self%29%29%27%7D%0A')}),
  2320. smalltalk.String);
  2321. smalltalk.addMethod(
  2322. '_appendToBrush_',
  2323. smalltalk.method({
  2324. selector: 'appendToBrush:',
  2325. category: '*Canvas',
  2326. fn: function (aTagBrush){
  2327. var self=this;
  2328. aTagBrush._appendString_(self);
  2329. return self;},
  2330. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendString%3A%20self%0A')}),
  2331. smalltalk.String);
  2332. smalltalk.addMethod(
  2333. '__gt',
  2334. smalltalk.method({
  2335. selector: '>',
  2336. category: 'comparing',
  2337. fn: function (aString){
  2338. var self=this;
  2339. return (function(){return String(self) > aString})();
  2340. return self;},
  2341. source: unescape('%3E%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%20aString%27%7D%0A')}),
  2342. smalltalk.String);
  2343. smalltalk.addMethod(
  2344. '__lt',
  2345. smalltalk.method({
  2346. selector: '<',
  2347. category: 'comparing',
  2348. fn: function (aString){
  2349. var self=this;
  2350. return (function(){return String(self) < aString})();
  2351. return self;},
  2352. source: unescape('%3C%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%20aString%27%7D%0A')}),
  2353. smalltalk.String);
  2354. smalltalk.addMethod(
  2355. '__gt_eq',
  2356. smalltalk.method({
  2357. selector: '>=',
  2358. category: 'comparing',
  2359. fn: function (aString){
  2360. var self=this;
  2361. return (function(){return String(self) >= aString})();
  2362. return self;},
  2363. source: unescape('%3E%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%3D%20aString%27%7D%0A')}),
  2364. smalltalk.String);
  2365. smalltalk.addMethod(
  2366. '__lt_eq',
  2367. smalltalk.method({
  2368. selector: '<=',
  2369. category: 'comparing',
  2370. fn: function (aString){
  2371. var self=this;
  2372. return (function(){return String(self) <= aString})();
  2373. return self;},
  2374. source: unescape('%3C%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%3D%20aString%27%7D%0A')}),
  2375. smalltalk.String);
  2376. smalltalk.addMethod(
  2377. '_remove_',
  2378. smalltalk.method({
  2379. selector: 'remove:',
  2380. category: 'adding',
  2381. fn: function (anObject){
  2382. var self=this;
  2383. self._errorReadOnly();
  2384. return self;},
  2385. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20errorReadOnly%0A')}),
  2386. smalltalk.String);
  2387. smalltalk.addMethod(
  2388. '_streamClass',
  2389. smalltalk.method({
  2390. selector: 'streamClass',
  2391. category: 'accessing',
  2392. fn: function (){
  2393. var self=this;
  2394. return smalltalk.StringStream;
  2395. return self;},
  2396. source: unescape('streamClass%0A%09%20%20%20%20%5EStringStream%0A')}),
  2397. smalltalk.String.klass);
  2398. smalltalk.addMethod(
  2399. '_fromString_',
  2400. smalltalk.method({
  2401. selector: 'fromString:',
  2402. category: 'instance creation',
  2403. fn: function (aString){
  2404. var self=this;
  2405. return (function(){return new self.fn(aString);})();
  2406. return self;},
  2407. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5E%7B%27return%20new%20self.fn%28aString%29%3B%27%7D%0A')}),
  2408. smalltalk.String.klass);
  2409. smalltalk.addMethod(
  2410. '_cr',
  2411. smalltalk.method({
  2412. selector: 'cr',
  2413. category: 'accessing',
  2414. fn: function (){
  2415. var self=this;
  2416. return (function(){{return '\n'};})();
  2417. return self;},
  2418. source: unescape('cr%0A%09%20%20%20%20%5E%7B%27%7Breturn%20%27%27%5Cn%27%27%7D%3B%27%7D%0A')}),
  2419. smalltalk.String.klass);
  2420. smalltalk.addMethod(
  2421. '_lf',
  2422. smalltalk.method({
  2423. selector: 'lf',
  2424. category: 'accessing',
  2425. fn: function (){
  2426. var self=this;
  2427. return (function(){return '\r';})();
  2428. return self;},
  2429. source: unescape('lf%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Cr%27%27%3B%27%7D%0A')}),
  2430. smalltalk.String.klass);
  2431. smalltalk.addMethod(
  2432. '_space',
  2433. smalltalk.method({
  2434. selector: 'space',
  2435. category: 'accessing',
  2436. fn: function (){
  2437. var self=this;
  2438. return (function(){return ' ';})();
  2439. return self;},
  2440. source: unescape('space%0A%09%20%20%20%20%5E%7B%27return%20%27%27%20%27%27%3B%27%7D%0A')}),
  2441. smalltalk.String.klass);
  2442. smalltalk.addMethod(
  2443. '_tab',
  2444. smalltalk.method({
  2445. selector: 'tab',
  2446. category: 'accessing',
  2447. fn: function (){
  2448. var self=this;
  2449. return (function(){return '\t';})();
  2450. return self;},
  2451. source: unescape('tab%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Ct%27%27%3B%27%7D%0A')}),
  2452. smalltalk.String.klass);
  2453. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel');
  2454. smalltalk.addMethod(
  2455. '_compile_',
  2456. smalltalk.method({
  2457. selector: 'compile:',
  2458. category: 'evaluating',
  2459. fn: function (aString){
  2460. var self=this;
  2461. return (function(){return self.compile(aString);})();
  2462. return self;},
  2463. source: unescape('compile%3A%20aString%0A%09%5E%7B%27return%20self.compile%28aString%29%3B%27%7D%0A')}),
  2464. smalltalk.RegularExpression);
  2465. smalltalk.addMethod(
  2466. '_exec_',
  2467. smalltalk.method({
  2468. selector: 'exec:',
  2469. category: 'evaluating',
  2470. fn: function (aString){
  2471. var self=this;
  2472. return (function(){return self.exec(aString);})();
  2473. return self;},
  2474. source: unescape('exec%3A%20aString%0A%09%5E%7B%27return%20self.exec%28aString%29%3B%27%7D%0A')}),
  2475. smalltalk.RegularExpression);
  2476. smalltalk.addMethod(
  2477. '_test_',
  2478. smalltalk.method({
  2479. selector: 'test:',
  2480. category: 'evaluating',
  2481. fn: function (aString){
  2482. var self=this;
  2483. return (function(){return self.test(aString);})();
  2484. return self;},
  2485. source: unescape('test%3A%20aString%0A%09%5E%7B%27return%20self.test%28aString%29%3B%27%7D%0A')}),
  2486. smalltalk.RegularExpression);
  2487. smalltalk.addMethod(
  2488. '_fromString_flag_',
  2489. smalltalk.method({
  2490. selector: 'fromString:flag:',
  2491. category: 'instance creation',
  2492. fn: function (aString, anotherString){
  2493. var self=this;
  2494. return (function(){return new RegExp(aString, anotherString);})();
  2495. return self;},
  2496. source: unescape('fromString%3A%20aString%20flag%3A%20anotherString%0A%09%20%20%20%20%5E%7B%27return%20new%20RegExp%28aString%2C%20anotherString%29%3B%27%7D%0A')}),
  2497. smalltalk.RegularExpression.klass);
  2498. smalltalk.addMethod(
  2499. '_fromString_',
  2500. smalltalk.method({
  2501. selector: 'fromString:',
  2502. category: 'instance creation',
  2503. fn: function (aString){
  2504. var self=this;
  2505. return self._fromString_flag_(aString,"");
  2506. return self;},
  2507. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5Eself%20fromString%3A%20aString%20flag%3A%20%27%27%0A')}),
  2508. smalltalk.RegularExpression.klass);
  2509. smalltalk.addClass('Array', smalltalk.Collection, [], 'Kernel');
  2510. smalltalk.addMethod(
  2511. '_size',
  2512. smalltalk.method({
  2513. selector: 'size',
  2514. category: 'accessing',
  2515. fn: function (){
  2516. var self=this;
  2517. return (function(){return self.length})();
  2518. return self;},
  2519. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2520. smalltalk.Array);
  2521. smalltalk.addMethod(
  2522. '_at_put_',
  2523. smalltalk.method({
  2524. selector: 'at:put:',
  2525. category: 'accessing',
  2526. fn: function (anIndex, anObject){
  2527. var self=this;
  2528. return (function(){return self[anIndex - 1] = anObject})();
  2529. return self;},
  2530. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09%5E%7B%27return%20self%5BanIndex%20-%201%5D%20%3D%20anObject%27%7D%0A')}),
  2531. smalltalk.Array);
  2532. smalltalk.addMethod(
  2533. '_at_ifAbsent_',
  2534. smalltalk.method({
  2535. selector: 'at:ifAbsent:',
  2536. category: 'accessing',
  2537. fn: function (anIndex, aBlock){
  2538. var self=this;
  2539. return (function(){
  2540. var value = self[anIndex - 1];
  2541. if(value === undefined) {
  2542. return aBlock();
  2543. } else {
  2544. return value;
  2545. }
  2546. })();
  2547. return self;},
  2548. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09%5E%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BanIndex%20-%201%5D%3B%0A%09%20%20%20%20if%28value%20%3D%3D%3D%20undefined%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  2549. smalltalk.Array);
  2550. smalltalk.addMethod(
  2551. '_add_',
  2552. smalltalk.method({
  2553. selector: 'add:',
  2554. category: 'adding',
  2555. fn: function (anObject){
  2556. var self=this;
  2557. return (function(){self.push(anObject); return anObject;})();
  2558. return self;},
  2559. source: unescape('add%3A%20anObject%0A%09%5E%7B%27self.push%28anObject%29%3B%20return%20anObject%3B%27%7D%0A')}),
  2560. smalltalk.Array);
  2561. smalltalk.addMethod(
  2562. '_addLast_',
  2563. smalltalk.method({
  2564. selector: 'addLast:',
  2565. category: 'adding',
  2566. fn: function (anObject){
  2567. var self=this;
  2568. return self._add_(anObject);
  2569. return self;},
  2570. source: unescape('addLast%3A%20anObject%0A%09%5Eself%20add%3A%20anObject%0A')}),
  2571. smalltalk.Array);
  2572. smalltalk.addMethod(
  2573. '_shallowCopy',
  2574. smalltalk.method({
  2575. selector: 'shallowCopy',
  2576. category: 'copying',
  2577. fn: function (){
  2578. var self=this;
  2579. var newCollection=nil;
  2580. newCollection=self._class()._new();
  2581. self._do_((function(each){return newCollection._add_(each);}));
  2582. return newCollection;
  2583. return self;},
  2584. source: unescape('shallowCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%5D.%0A%09%5EnewCollection%0A')}),
  2585. smalltalk.Array);
  2586. smalltalk.addMethod(
  2587. '_deepCopy',
  2588. smalltalk.method({
  2589. selector: 'deepCopy',
  2590. category: 'copying',
  2591. fn: function (){
  2592. var self=this;
  2593. var newCollection=nil;
  2594. newCollection=self._class()._new();
  2595. self._do_((function(each){return newCollection._add_(each._deepCopy());}));
  2596. return newCollection;
  2597. return self;},
  2598. source: unescape('deepCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%20deepCopy%5D.%0A%09%5EnewCollection%0A')}),
  2599. smalltalk.Array);
  2600. smalltalk.addMethod(
  2601. '_copyFrom_to_',
  2602. smalltalk.method({
  2603. selector: 'copyFrom:to:',
  2604. category: 'copying',
  2605. fn: function (anIndex, anotherIndex){
  2606. var self=this;
  2607. var array=nil;
  2608. array=self._class()._new();
  2609. anIndex._to_do_(anotherIndex,(function(each){return array._add_(self._at_(each));}));
  2610. return array;
  2611. return self;},
  2612. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09%7C%20array%20%7C%0A%09array%20%3A%3D%20self%20class%20new.%0A%09anIndex%20to%3A%20anotherIndex%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20array%20add%3A%20%28self%20at%3A%20each%29%5D.%0A%09%5Earray%0A')}),
  2613. smalltalk.Array);
  2614. smalltalk.addMethod(
  2615. '_join_',
  2616. smalltalk.method({
  2617. selector: 'join:',
  2618. category: 'enumerating',
  2619. fn: function (aString){
  2620. var self=this;
  2621. return (function(){return self.join(aString);})();
  2622. return self;},
  2623. source: unescape('join%3A%20aString%0A%09%5E%7B%27return%20self.join%28aString%29%3B%27%7D%0A')}),
  2624. smalltalk.Array);
  2625. smalltalk.addMethod(
  2626. '_asJavascript',
  2627. smalltalk.method({
  2628. selector: 'asJavascript',
  2629. category: 'converting',
  2630. fn: function (){
  2631. var self=this;
  2632. return unescape("%5B").__comma(self._collect_((function(each){return each._asJavascript();}))._join_(unescape("%2C%20"))).__comma(unescape("%5D"));
  2633. return self;},
  2634. source: unescape('asJavascript%0A%09%5E%27%5B%27%2C%20%28%28self%20collect%3A%20%5B%3Aeach%20%7C%20each%20asJavascript%5D%29%20join%3A%20%27%2C%20%27%29%2C%20%20%27%5D%27%0A')}),
  2635. smalltalk.Array);
  2636. smalltalk.addMethod(
  2637. '_sort',
  2638. smalltalk.method({
  2639. selector: 'sort',
  2640. category: 'enumerating',
  2641. fn: function (){
  2642. var self=this;
  2643. return self._copy()._basicPerform_("sort");
  2644. return self;},
  2645. source: unescape('sort%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%0A')}),
  2646. smalltalk.Array);
  2647. smalltalk.addMethod(
  2648. '_sort_',
  2649. smalltalk.method({
  2650. selector: 'sort:',
  2651. category: 'enumerating',
  2652. fn: function (aBlock){
  2653. var self=this;
  2654. return self._copy()._basicPerform_withArguments_("sort",smalltalk.Array._with_(aBlock));
  2655. return self;},
  2656. source: unescape('sort%3A%20aBlock%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%20withArguments%3A%20%28Array%20with%3A%20aBlock%29%0A')}),
  2657. smalltalk.Array);
  2658. smalltalk.addMethod(
  2659. '_remove_',
  2660. smalltalk.method({
  2661. selector: 'remove:',
  2662. category: 'adding',
  2663. fn: function (anObject){
  2664. var self=this;
  2665. (function(){for(var i=0;i<self.length;i++) {
  2666. if(self[i] == anObject) {
  2667. self.splice(i,1);
  2668. break;
  2669. }
  2670. }})();
  2671. return self;},
  2672. source: unescape('remove%3A%20anObject%0A%20%20%20%20%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%20%7B%0A%09if%28self%5Bi%5D%20%3D%3D%20anObject%29%20%7B%0A%09%09self.splice%28i%2C1%29%3B%0A%09%09break%3B%0A%09%7D%0A%20%20%20%20%7D%27%7D%0A')}),
  2673. smalltalk.Array);
  2674. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel');
  2675. smalltalk.addMethod(
  2676. '_messageText',
  2677. smalltalk.method({
  2678. selector: 'messageText',
  2679. category: 'accessing',
  2680. fn: function (){
  2681. var self=this;
  2682. return self['@messageText'];
  2683. return self;},
  2684. source: unescape('messageText%0A%09%5EmessageText%0A')}),
  2685. smalltalk.Error);
  2686. smalltalk.addMethod(
  2687. '_messageText_',
  2688. smalltalk.method({
  2689. selector: 'messageText:',
  2690. category: 'accessing',
  2691. fn: function (aString){
  2692. var self=this;
  2693. self['@messageText']=aString;
  2694. return self;},
  2695. source: unescape('messageText%3A%20aString%0A%09messageText%20%3A%3D%20aString%0A')}),
  2696. smalltalk.Error);
  2697. smalltalk.addMethod(
  2698. '_signal',
  2699. smalltalk.method({
  2700. selector: 'signal',
  2701. category: 'signaling',
  2702. fn: function (){
  2703. var self=this;
  2704. return (function(){throw({smalltalkError: self})})();
  2705. return self;},
  2706. source: unescape('signal%0A%09%5E%7B%27throw%28%7BsmalltalkError%3A%20self%7D%29%27%7D%0A')}),
  2707. smalltalk.Error);
  2708. smalltalk.addMethod(
  2709. '_signal_',
  2710. smalltalk.method({
  2711. selector: 'signal:',
  2712. category: 'instance creation',
  2713. fn: function (aString){
  2714. var self=this;
  2715. return (function($rec){$rec._messageText_(aString);return $rec._signal();})(self._new());
  2716. return self;},
  2717. source: unescape('signal%3A%20aString%0A%09%20%20%20%20%5Eself%20new%0A%09%09messageText%3A%20aString%3B%0A%09%09signal%0A')}),
  2718. smalltalk.Error.klass);
  2719. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel');
  2720. smalltalk.addMethod(
  2721. '__eq',
  2722. smalltalk.method({
  2723. selector: '=',
  2724. category: 'comparing',
  2725. fn: function (anAssociation){
  2726. var self=this;
  2727. return self._class().__eq(anAssociation._class())._and_((function(){return self._key().__eq(anAssociation._key())._and_((function(){return self._value().__eq(anAssociation._value());}));}));
  2728. return self;},
  2729. source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D%0A')}),
  2730. smalltalk.Association);
  2731. smalltalk.addMethod(
  2732. '_key_',
  2733. smalltalk.method({
  2734. selector: 'key:',
  2735. category: 'accessing',
  2736. fn: function (aKey){
  2737. var self=this;
  2738. self['@key']=aKey;
  2739. return self;},
  2740. source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey%0A')}),
  2741. smalltalk.Association);
  2742. smalltalk.addMethod(
  2743. '_key',
  2744. smalltalk.method({
  2745. selector: 'key',
  2746. category: 'accessing',
  2747. fn: function (){
  2748. var self=this;
  2749. return self['@key'];
  2750. return self;},
  2751. source: unescape('key%0A%09%5Ekey%0A')}),
  2752. smalltalk.Association);
  2753. smalltalk.addMethod(
  2754. '_value_',
  2755. smalltalk.method({
  2756. selector: 'value:',
  2757. category: 'accessing',
  2758. fn: function (aValue){
  2759. var self=this;
  2760. self['@value']=aValue;
  2761. return self;},
  2762. source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue%0A')}),
  2763. smalltalk.Association);
  2764. smalltalk.addMethod(
  2765. '_value',
  2766. smalltalk.method({
  2767. selector: 'value',
  2768. category: 'accessing',
  2769. fn: function (){
  2770. var self=this;
  2771. return self['@value'];
  2772. return self;},
  2773. source: unescape('value%0A%09%5Evalue%0A')}),
  2774. smalltalk.Association);
  2775. smalltalk.addMethod(
  2776. '_key_value_',
  2777. smalltalk.method({
  2778. selector: 'key:value:',
  2779. category: 'instance creation',
  2780. fn: function (aKey, aValue){
  2781. var self=this;
  2782. return (function($rec){$rec._key_(aKey);$rec._value_(aValue);return $rec._yourself();})(self._new());
  2783. return self;},
  2784. source: unescape('key%3A%20aKey%20value%3A%20aValue%0A%09%20%20%20%20%5Eself%20new%0A%09%09key%3A%20aKey%3B%0A%09%09value%3A%20aValue%3B%0A%09%09yourself%0A')}),
  2785. smalltalk.Association.klass);
  2786. smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
  2787. smalltalk.addMethod(
  2788. '__eq',
  2789. smalltalk.method({
  2790. selector: '=',
  2791. category: 'comparing',
  2792. fn: function (aDictionary){
  2793. var self=this;
  2794. try{self._class().__eq(aDictionary._class())._ifFalse_((function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();}));
  2795. self._associationsDo_((function(assoc){return aDictionary._at_ifAbsent_(assoc._key(),(function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();})).__eq(assoc._value())._ifFalse_((function(){return (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return false}})})();}));}));
  2796. (function(){throw({name: 'stReturn', selector: '__eq', fn: function(){return true}})})();
  2797. return self;
  2798. } catch(e) {if(e.name === 'stReturn' && e.selector === '__eq'){return e.fn()} throw(e)}},
  2799. source: unescape('%3D%20aDictionary%0A%09self%20class%20%3D%20aDictionary%20class%20ifFalse%3A%20%5B%5Efalse%5D.%0A%09self%20associationsDo%3A%20%5B%3Aassoc%20%7C%0A%09%20%20%20%20%28aDictionary%20at%3A%20assoc%20key%20ifAbsent%3A%20%5B%5Efalse%5D%29%20%3D%20assoc%20value%20%0A%09%09ifFalse%3A%20%5B%5Efalse%5D%5D.%0A%09%5Etrue%0A')}),
  2800. smalltalk.Dictionary);
  2801. smalltalk.addMethod(
  2802. '_shallowCopy',
  2803. smalltalk.method({
  2804. selector: 'shallowCopy',
  2805. category: 'copying',
  2806. fn: function (){
  2807. var self=this;
  2808. var copy=nil;
  2809. copy=self._class()._new();
  2810. self._associationsDo_((function(each){return copy._at_put_(each._key(),each._value());}));
  2811. return copy;
  2812. return self;},
  2813. source: unescape('shallowCopy%0A%09%7C%20copy%20%7C%0A%09copy%20%3A%3D%20self%20class%20new.%0A%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20copy%20at%3A%20each%20key%20%20put%3A%20each%20value%5D.%0A%09%5Ecopy%0A')}),
  2814. smalltalk.Dictionary);
  2815. smalltalk.addMethod(
  2816. '_initialize',
  2817. smalltalk.method({
  2818. selector: 'initialize',
  2819. category: 'initialization',
  2820. fn: function (){
  2821. var self=this;
  2822. self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
  2823. self['@keys']=[];
  2824. return self;},
  2825. source: unescape('initialize%0A%20%20%20%20%09super%20initialize.%0A%20%20%20%20%09keys%20%3A%3D%20%23%28%29%0A')}),
  2826. smalltalk.Dictionary);
  2827. smalltalk.addMethod(
  2828. '_size',
  2829. smalltalk.method({
  2830. selector: 'size',
  2831. category: 'accessing',
  2832. fn: function (){
  2833. var self=this;
  2834. return self['@keys']._size();
  2835. return self;},
  2836. source: unescape('size%0A%09%5Ekeys%20size%0A')}),
  2837. smalltalk.Dictionary);
  2838. smalltalk.addMethod(
  2839. '_associations',
  2840. smalltalk.method({
  2841. selector: 'associations',
  2842. category: 'accessing',
  2843. fn: function (){
  2844. var self=this;
  2845. var associations=nil;
  2846. associations=[];
  2847. self['@keys']._do_((function(each){return associations._add_(smalltalk.Association._key_value_(each,self._at_(each)));}));
  2848. return associations;
  2849. return self;},
  2850. source: unescape('associations%0A%09%7C%20associations%20%7C%0A%09associations%20%3A%3D%20%23%28%29.%0A%09keys%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20associations%20add%3A%20%28Association%20key%3A%20each%20value%3A%20%28self%20at%3A%20each%29%29%5D.%0A%09%5Eassociations%0A')}),
  2851. smalltalk.Dictionary);
  2852. smalltalk.addMethod(
  2853. '_keys',
  2854. smalltalk.method({
  2855. selector: 'keys',
  2856. category: 'accessing',
  2857. fn: function (){
  2858. var self=this;
  2859. return self['@keys']._copy();
  2860. return self;},
  2861. source: unescape('keys%0A%09%5Ekeys%20copy%0A')}),
  2862. smalltalk.Dictionary);
  2863. smalltalk.addMethod(
  2864. '_values',
  2865. smalltalk.method({
  2866. selector: 'values',
  2867. category: 'accessing',
  2868. fn: function (){
  2869. var self=this;
  2870. return self['@keys']._collect_((function(each){return self._at_(each);}));
  2871. return self;},
  2872. source: unescape('values%0A%20%20%20%20%09%5Ekeys%20collect%3A%20%5B%3Aeach%20%7C%20self%20at%3A%20each%5D%0A')}),
  2873. smalltalk.Dictionary);
  2874. smalltalk.addMethod(
  2875. '_at_put_',
  2876. smalltalk.method({
  2877. selector: 'at:put:',
  2878. category: 'accessing',
  2879. fn: function (aKey, aValue){
  2880. var self=this;
  2881. self['@keys']._includes_(aKey)._ifFalse_((function(){return self['@keys']._add_(aKey);}));
  2882. return self._basicAt_put_(aKey,aValue);
  2883. return self;},
  2884. source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%09%28keys%20includes%3A%20aKey%29%20ifFalse%3A%20%5Bkeys%20add%3A%20aKey%5D.%0A%09%5Eself%20basicAt%3A%20aKey%20put%3A%20aValue%0A')}),
  2885. smalltalk.Dictionary);
  2886. smalltalk.addMethod(
  2887. '_at_ifAbsent_',
  2888. smalltalk.method({
  2889. selector: 'at:ifAbsent:',
  2890. category: 'accessing',
  2891. fn: function (aKey, aBlock){
  2892. var self=this;
  2893. return self._basicAt_(aKey)._ifNil_(aBlock);
  2894. return self;},
  2895. source: unescape('at%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNil%3A%20aBlock%0A')}),
  2896. smalltalk.Dictionary);
  2897. smalltalk.addMethod(
  2898. '_at_ifAbsentPut_',
  2899. smalltalk.method({
  2900. selector: 'at:ifAbsentPut:',
  2901. category: 'accessing',
  2902. fn: function (aKey, aBlock){
  2903. var self=this;
  2904. return self._at_ifAbsent_(aKey,(function(){return self._at_put_(aKey,aBlock._value());}));
  2905. return self;},
  2906. source: unescape('at%3A%20aKey%20ifAbsentPut%3A%20aBlock%0A%20%20%20%20%09%5Eself%20at%3A%20aKey%20ifAbsent%3A%20%5B%0A%20%20%20%20%09%20%20%20%20self%20at%3A%20aKey%20put%3A%20aBlock%20value%5D%0A')}),
  2907. smalltalk.Dictionary);
  2908. smalltalk.addMethod(
  2909. '_at_ifPresent_',
  2910. smalltalk.method({
  2911. selector: 'at:ifPresent:',
  2912. category: 'accessing',
  2913. fn: function (aKey, aBlock){
  2914. var self=this;
  2915. return self._basicAt_(aKey)._ifNotNil_((function(){return aBlock._value_(self._at_(aKey));}));
  2916. return self;},
  2917. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  2918. smalltalk.Dictionary);
  2919. smalltalk.addMethod(
  2920. '_at_ifPresent_ifAbsent_',
  2921. smalltalk.method({
  2922. selector: 'at:ifPresent:ifAbsent:',
  2923. category: 'accessing',
  2924. fn: function (aKey, aBlock, anotherBlock){
  2925. var self=this;
  2926. return self._basicAt_(aKey)._ifNil_ifNotNil_(anotherBlock,(function(){return aBlock._value_(self._at_(aKey));}));
  2927. return self;},
  2928. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%20ifAbsent%3A%20anotherBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%0A%09%20%20%20%20ifNil%3A%20anotherBlock%0A%09%20%20%20%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  2929. smalltalk.Dictionary);
  2930. smalltalk.addMethod(
  2931. '_add_',
  2932. smalltalk.method({
  2933. selector: 'add:',
  2934. category: 'adding/removing',
  2935. fn: function (anAssociation){
  2936. var self=this;
  2937. self._at_put_(anAssociation._key(),anAssociation._value());
  2938. return self;},
  2939. source: unescape('add%3A%20anAssociation%0A%20%20%20%20%09self%20at%3A%20anAssociation%20key%20put%3A%20anAssociation%20value%0A')}),
  2940. smalltalk.Dictionary);
  2941. smalltalk.addMethod(
  2942. '_addAll_',
  2943. smalltalk.method({
  2944. selector: 'addAll:',
  2945. category: 'adding/removing',
  2946. fn: function (aDictionary){
  2947. var self=this;
  2948. self.klass.superclass.fn.prototype['_addAll_'].apply(self, [aDictionary._associations()]);
  2949. return aDictionary;
  2950. return self;},
  2951. source: unescape('addAll%3A%20aDictionary%0A%20%20%20%20%09super%20addAll%3A%20aDictionary%20associations.%0A%20%20%20%20%09%5EaDictionary%0A')}),
  2952. smalltalk.Dictionary);
  2953. smalltalk.addMethod(
  2954. '__comma',
  2955. smalltalk.method({
  2956. selector: ',',
  2957. category: 'copying',
  2958. fn: function (aCollection){
  2959. var self=this;
  2960. self._shouldNotImplement();
  2961. return self;},
  2962. source: unescape('%2C%20aCollection%0A%09self%20shouldNotImplement%0A')}),
  2963. smalltalk.Dictionary);
  2964. smalltalk.addMethod(
  2965. '_copyFrom_to_',
  2966. smalltalk.method({
  2967. selector: 'copyFrom:to:',
  2968. category: 'copying',
  2969. fn: function (anIndex, anotherIndex){
  2970. var self=this;
  2971. self._shouldNotImplement();
  2972. return self;},
  2973. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20shouldNotImplement%0A')}),
  2974. smalltalk.Dictionary);
  2975. smalltalk.addMethod(
  2976. '_associationsDo_',
  2977. smalltalk.method({
  2978. selector: 'associationsDo:',
  2979. category: 'enumerating',
  2980. fn: function (aBlock){
  2981. var self=this;
  2982. self._associations()._do_(aBlock);
  2983. return self;},
  2984. source: unescape('associationsDo%3A%20aBlock%0A%20%20%20%20%09self%20associations%20do%3A%20aBlock%0A')}),
  2985. smalltalk.Dictionary);
  2986. smalltalk.addMethod(
  2987. '_keysAndValuesDo_',
  2988. smalltalk.method({
  2989. selector: 'keysAndValuesDo:',
  2990. category: 'enumerating',
  2991. fn: function (aBlock){
  2992. var self=this;
  2993. self._associationsDo_((function(each){return aBlock._value_value_(each._key(),each._value());}));
  2994. return self;},
  2995. source: unescape('keysAndValuesDo%3A%20aBlock%0A%20%20%20%20%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%20key%20value%3A%20each%20value%5D%0A')}),
  2996. smalltalk.Dictionary);
  2997. smalltalk.addMethod(
  2998. '_do_',
  2999. smalltalk.method({
  3000. selector: 'do:',
  3001. category: 'enumerating',
  3002. fn: function (aBlock){
  3003. var self=this;
  3004. self._values()._do_(aBlock);
  3005. return self;},
  3006. source: unescape('do%3A%20aBlock%0A%20%20%20%20%09self%20values%20do%3A%20aBlock%0A')}),
  3007. smalltalk.Dictionary);
  3008. smalltalk.addMethod(
  3009. '_select_',
  3010. smalltalk.method({
  3011. selector: 'select:',
  3012. category: 'enumerating',
  3013. fn: function (aBlock){
  3014. var self=this;
  3015. var newDict=nil;
  3016. newDict=self._class()._new();
  3017. self._keysAndValuesDo_((function(key, value){return aBlock._value_(value)._ifTrue_((function(){return newDict._at_put_(key,value);}));}));
  3018. return newDict;
  3019. return self;},
  3020. source: unescape('select%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3021. smalltalk.Dictionary);
  3022. smalltalk.addMethod(
  3023. '_collect_',
  3024. smalltalk.method({
  3025. selector: 'collect:',
  3026. category: 'enumerating',
  3027. fn: function (aBlock){
  3028. var self=this;
  3029. var newDict=nil;
  3030. newDict=self._class()._new();
  3031. self._keysAndValuesDo_((function(key, value){return aBlock._value_(value)._ifTrue_((function(){return newDict._at_put_(key,value);}));}));
  3032. return newDict;
  3033. return self;},
  3034. source: unescape('collect%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3035. smalltalk.Dictionary);
  3036. smalltalk.addMethod(
  3037. '_detect_ifNone_',
  3038. smalltalk.method({
  3039. selector: 'detect:ifNone:',
  3040. category: 'enumerating',
  3041. fn: function (aBlock, anotherBlock){
  3042. var self=this;
  3043. return self._values()._detect_ifNone_(aBlock,anotherBlock);
  3044. return self;},
  3045. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5Eself%20values%20detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A')}),
  3046. smalltalk.Dictionary);
  3047. smalltalk.addMethod(
  3048. '_includes_',
  3049. smalltalk.method({
  3050. selector: 'includes:',
  3051. category: 'enumerating',
  3052. fn: function (anObject){
  3053. var self=this;
  3054. return self._values()._includes_(anObject);
  3055. return self;},
  3056. source: unescape('includes%3A%20anObject%0A%09%5Eself%20values%20includes%3A%20anObject%0A')}),
  3057. smalltalk.Dictionary);
  3058. smalltalk.addMethod(
  3059. '_remove_',
  3060. smalltalk.method({
  3061. selector: 'remove:',
  3062. category: 'adding/removing',
  3063. fn: function (aKey){
  3064. var self=this;
  3065. self._removeKey_(aKey);
  3066. return self;},
  3067. source: unescape('remove%3A%20aKey%0A%20%20%20%20self%20removeKey%3A%20aKey%0A')}),
  3068. smalltalk.Dictionary);
  3069. smalltalk.addMethod(
  3070. '_removeKey_',
  3071. smalltalk.method({
  3072. selector: 'removeKey:',
  3073. category: 'adding/removing',
  3074. fn: function (aKey){
  3075. var self=this;
  3076. self['@keys']._remove_(aKey);
  3077. return self;},
  3078. source: unescape('removeKey%3A%20aKey%0A%20%20%20%20keys%20remove%3A%20aKey%0A')}),
  3079. smalltalk.Dictionary);
  3080. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel');
  3081. smalltalk.addMethod(
  3082. '_superclass_subclass_',
  3083. smalltalk.method({
  3084. selector: 'superclass:subclass:',
  3085. category: 'class creation',
  3086. fn: function (aClass, aString){
  3087. var self=this;
  3088. self._superclass_subclass_instanceVariableNames_category_(aClass,aString,"",nil);
  3089. return self;},
  3090. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%0A%09self%20superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20%27%27%20category%3A%20nil%0A')}),
  3091. smalltalk.ClassBuilder);
  3092. smalltalk.addMethod(
  3093. '_superclass_subclass_instanceVariableNames_category_',
  3094. smalltalk.method({
  3095. selector: 'superclass:subclass:instanceVariableNames:category:',
  3096. category: 'class creation',
  3097. fn: function (aClass, aString, aString2, aString3){
  3098. var self=this;
  3099. var newClass=nil;
  3100. newClass=self._addSubclassOf_named_instanceVariableNames_(aClass,aString,self._instanceVariableNamesFor_(aString2));
  3101. self._setupClass_(newClass);
  3102. newClass._category_(aString3._ifNil_((function(){return "unclassified";})));
  3103. return self;},
  3104. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29.%0A%09self%20setupClass%3A%20newClass.%0A%09newClass%20category%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29%0A')}),
  3105. smalltalk.ClassBuilder);
  3106. smalltalk.addMethod(
  3107. '_class_instanceVariableNames_',
  3108. smalltalk.method({
  3109. selector: 'class:instanceVariableNames:',
  3110. category: 'class creation',
  3111. fn: function (aClass, aString){
  3112. var self=this;
  3113. aClass._isMetaclass()._ifFalse_((function(){return self._error_(aClass._name().__comma(" is not a metaclass"));}));
  3114. aClass._basicAt_put_("iVarNames",self._instanceVariableNamesFor_(aString));
  3115. self._setupClass_(aClass);
  3116. return self;},
  3117. source: unescape('class%3A%20aClass%20instanceVariableNames%3A%20aString%0A%09aClass%20isMetaclass%20ifFalse%3A%20%5Bself%20error%3A%20aClass%20name%2C%20%27%20is%20not%20a%20metaclass%27%5D.%0A%09aClass%20basicAt%3A%20%27iVarNames%27%20put%3A%20%28self%20instanceVariableNamesFor%3A%20aString%29.%0A%09self%20setupClass%3A%20aClass%0A')}),
  3118. smalltalk.ClassBuilder);
  3119. smalltalk.addMethod(
  3120. '_instanceVariableNamesFor_',
  3121. smalltalk.method({
  3122. selector: 'instanceVariableNamesFor:',
  3123. category: 'private',
  3124. fn: function (aString){
  3125. var self=this;
  3126. return aString._tokenize_(" ")._reject_((function(each){return each._isEmpty();}));
  3127. return self;},
  3128. source: unescape('instanceVariableNamesFor%3A%20aString%0A%09%5E%28aString%20tokenize%3A%20%27%20%27%29%20reject%3A%20%5B%3Aeach%20%7C%20each%20isEmpty%5D%0A')}),
  3129. smalltalk.ClassBuilder);
  3130. smalltalk.addMethod(
  3131. '_addSubclassOf_named_instanceVariableNames_',
  3132. smalltalk.method({
  3133. selector: 'addSubclassOf:named:instanceVariableNames:',
  3134. category: 'private',
  3135. fn: function (aClass, aString, aCollection){
  3136. var self=this;
  3137. return (function(){smalltalk.addClass(aString, aClass, aCollection);
  3138. return smalltalk[aString]})();
  3139. return self;},
  3140. source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%0A%09%5E%7B%27smalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%27%7D%0A')}),
  3141. smalltalk.ClassBuilder);
  3142. smalltalk.addMethod(
  3143. '_setupClass_',
  3144. smalltalk.method({
  3145. selector: 'setupClass:',
  3146. category: 'private',
  3147. fn: function (aClass){
  3148. var self=this;
  3149. (function(){smalltalk.init(aClass);})();
  3150. return self;},
  3151. source: unescape('setupClass%3A%20aClass%0A%09%7B%27smalltalk.init%28aClass%29%3B%27%7D%0A')}),
  3152. smalltalk.ClassBuilder);
  3153. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel');
  3154. smalltalk.addMethod(
  3155. '_initialize',
  3156. smalltalk.method({
  3157. selector: 'initialize',
  3158. category: 'initialization',
  3159. fn: function (){
  3160. var self=this;
  3161. self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
  3162. self['@chunkParser']=smalltalk.ChunkParser._new();
  3163. return self;},
  3164. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  3165. smalltalk.ClassCategoryReader);
  3166. smalltalk.addMethod(
  3167. '_class_category_',
  3168. smalltalk.method({
  3169. selector: 'class:category:',
  3170. category: 'accessing',
  3171. fn: function (aClass, aString){
  3172. var self=this;
  3173. self['@class']=aClass;
  3174. self['@category']=aString;
  3175. return self;},
  3176. source: unescape('class%3A%20aClass%20category%3A%20aString%0A%09class%20%3A%3D%20aClass.%0A%09category%20%3A%3D%20aString%0A')}),
  3177. smalltalk.ClassCategoryReader);
  3178. smalltalk.addMethod(
  3179. '_scanFrom_',
  3180. smalltalk.method({
  3181. selector: 'scanFrom:',
  3182. category: 'fileIn',
  3183. fn: function (aStream){
  3184. var self=this;
  3185. var nextChunk=nil;
  3186. nextChunk=self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  3187. nextChunk._isEmptyChunk()._ifFalse_((function(){self._compileMethod_(nextChunk._contents());return self._scanFrom_(aStream);}));
  3188. return self;},
  3189. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20compileMethod%3A%20nextChunk%20contents.%0A%09%20%20%20%20self%20scanFrom%3A%20aStream%5D.%0A')}),
  3190. smalltalk.ClassCategoryReader);
  3191. smalltalk.addMethod(
  3192. '_compileMethod_',
  3193. smalltalk.method({
  3194. selector: 'compileMethod:',
  3195. category: 'private',
  3196. fn: function (aString){
  3197. var self=this;
  3198. var method=nil;
  3199. method=smalltalk.Compiler._new()._load_forClass_(aString,self['@class']);
  3200. method._category_(self['@category']);
  3201. self['@class']._addCompiledMethod_(method);
  3202. return self;},
  3203. source: unescape('compileMethod%3A%20aString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20class.%0A%09method%20category%3A%20category.%0A%09class%20addCompiledMethod%3A%20method%0A')}),
  3204. smalltalk.ClassCategoryReader);
  3205. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel');
  3206. smalltalk.addMethod(
  3207. '_collection',
  3208. smalltalk.method({
  3209. selector: 'collection',
  3210. category: 'accessing',
  3211. fn: function (){
  3212. var self=this;
  3213. return self['@collection'];
  3214. return self;},
  3215. source: unescape('collection%0A%09%5Ecollection%0A')}),
  3216. smalltalk.Stream);
  3217. smalltalk.addMethod(
  3218. '_setCollection_',
  3219. smalltalk.method({
  3220. selector: 'setCollection:',
  3221. category: 'accessing',
  3222. fn: function (aCollection){
  3223. var self=this;
  3224. self['@collection']=aCollection;
  3225. return self;},
  3226. source: unescape('setCollection%3A%20aCollection%0A%09collection%20%3A%3D%20aCollection%0A')}),
  3227. smalltalk.Stream);
  3228. smalltalk.addMethod(
  3229. '_position',
  3230. smalltalk.method({
  3231. selector: 'position',
  3232. category: 'accessing',
  3233. fn: function (){
  3234. var self=this;
  3235. return self['@position']._ifNil_((function(){return self['@position']=(0);}));
  3236. return self;},
  3237. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5Bposition%20%3A%3D%200%5D%0A')}),
  3238. smalltalk.Stream);
  3239. smalltalk.addMethod(
  3240. '_position_',
  3241. smalltalk.method({
  3242. selector: 'position:',
  3243. category: 'accessing',
  3244. fn: function (anInteger){
  3245. var self=this;
  3246. self['@position']=anInteger;
  3247. return self;},
  3248. source: unescape('position%3A%20anInteger%0A%09position%20%3A%3D%20anInteger%0A')}),
  3249. smalltalk.Stream);
  3250. smalltalk.addMethod(
  3251. '_streamSize',
  3252. smalltalk.method({
  3253. selector: 'streamSize',
  3254. category: 'accessing',
  3255. fn: function (){
  3256. var self=this;
  3257. return self['@streamSize'];
  3258. return self;},
  3259. source: unescape('streamSize%0A%09%5EstreamSize%0A')}),
  3260. smalltalk.Stream);
  3261. smalltalk.addMethod(
  3262. '_setStreamSize_',
  3263. smalltalk.method({
  3264. selector: 'setStreamSize:',
  3265. category: 'accessing',
  3266. fn: function (anInteger){
  3267. var self=this;
  3268. self['@streamSize']=anInteger;
  3269. return self;},
  3270. source: unescape('setStreamSize%3A%20anInteger%0A%09streamSize%20%3A%3D%20anInteger%0A')}),
  3271. smalltalk.Stream);
  3272. smalltalk.addMethod(
  3273. '_contents',
  3274. smalltalk.method({
  3275. selector: 'contents',
  3276. category: 'accessing',
  3277. fn: function (){
  3278. var self=this;
  3279. return self._collection()._copyFrom_to_((1),self._streamSize());
  3280. return self;},
  3281. source: unescape('contents%0A%09%5Eself%20collection%0A%09%20%20%20%20copyFrom%3A%201%20%0A%09%20%20%20%20to%3A%20self%20streamSize%0A')}),
  3282. smalltalk.Stream);
  3283. smalltalk.addMethod(
  3284. '_size',
  3285. smalltalk.method({
  3286. selector: 'size',
  3287. category: 'accessing',
  3288. fn: function (){
  3289. var self=this;
  3290. return self._streamSize();
  3291. return self;},
  3292. source: unescape('size%0A%09%5Eself%20streamSize%0A')}),
  3293. smalltalk.Stream);
  3294. smalltalk.addMethod(
  3295. '_reset',
  3296. smalltalk.method({
  3297. selector: 'reset',
  3298. category: 'actions',
  3299. fn: function (){
  3300. var self=this;
  3301. self._position_((0));
  3302. return self;},
  3303. source: unescape('reset%0A%09self%20position%3A%200%0A')}),
  3304. smalltalk.Stream);
  3305. smalltalk.addMethod(
  3306. '_close',
  3307. smalltalk.method({
  3308. selector: 'close',
  3309. category: 'actions',
  3310. fn: function (){
  3311. var self=this;
  3312. return self;},
  3313. source: unescape('close%0A')}),
  3314. smalltalk.Stream);
  3315. smalltalk.addMethod(
  3316. '_flush',
  3317. smalltalk.method({
  3318. selector: 'flush',
  3319. category: 'actions',
  3320. fn: function (){
  3321. var self=this;
  3322. return self;},
  3323. source: unescape('flush%0A')}),
  3324. smalltalk.Stream);
  3325. smalltalk.addMethod(
  3326. '_resetContents',
  3327. smalltalk.method({
  3328. selector: 'resetContents',
  3329. category: 'actions',
  3330. fn: function (){
  3331. var self=this;
  3332. self._reset();
  3333. self._setStreamSize_((0));
  3334. return self;},
  3335. source: unescape('resetContents%0A%09self%20reset.%0A%09self%20setStreamSize%3A%200%0A')}),
  3336. smalltalk.Stream);
  3337. smalltalk.addMethod(
  3338. '_do_',
  3339. smalltalk.method({
  3340. selector: 'do:',
  3341. category: 'enumerating',
  3342. fn: function (aBlock){
  3343. var self=this;
  3344. (function(){return self._atEnd();})._whileFalse_((function(){return aBlock._value_(self._next());}));
  3345. return self;},
  3346. source: unescape('do%3A%20aBlock%0A%09%5Bself%20atEnd%5D%20whileFalse%3A%20%5BaBlock%20value%3A%20self%20next%5D%0A')}),
  3347. smalltalk.Stream);
  3348. smalltalk.addMethod(
  3349. '_setToEnd',
  3350. smalltalk.method({
  3351. selector: 'setToEnd',
  3352. category: 'positioning',
  3353. fn: function (){
  3354. var self=this;
  3355. self._position_(self._size());
  3356. return self;},
  3357. source: unescape('setToEnd%0A%09self%20position%3A%20self%20size%0A')}),
  3358. smalltalk.Stream);
  3359. smalltalk.addMethod(
  3360. '_skip_',
  3361. smalltalk.method({
  3362. selector: 'skip:',
  3363. category: 'positioning',
  3364. fn: function (anInteger){
  3365. var self=this;
  3366. self._position_(self._position().__plus(anInteger)._min_max_(self._size(),(0)));
  3367. return self;},
  3368. source: unescape('skip%3A%20anInteger%0A%09self%20position%3A%20%28%28self%20position%20+%20anInteger%29%20min%3A%20self%20size%20max%3A%200%29%0A')}),
  3369. smalltalk.Stream);
  3370. smalltalk.addMethod(
  3371. '_next',
  3372. smalltalk.method({
  3373. selector: 'next',
  3374. category: 'reading',
  3375. fn: function (){
  3376. var self=this;
  3377. self._position_(self._position().__plus((1)));
  3378. return self['@collection']._at_(self._position());
  3379. return self;},
  3380. source: unescape('next%0A%09self%20position%3A%20self%20position%20+%201.%20%0A%09%5Ecollection%20at%3A%20self%20position%0A')}),
  3381. smalltalk.Stream);
  3382. smalltalk.addMethod(
  3383. '_next_',
  3384. smalltalk.method({
  3385. selector: 'next:',
  3386. category: 'reading',
  3387. fn: function (anInteger){
  3388. var self=this;
  3389. var tempCollection=nil;
  3390. tempCollection=self._collection()._class()._new();
  3391. anInteger._timesRepeat_((function(){return self._atEnd()._ifFalse_((function(){return tempCollection._add_(self._next());}));}));
  3392. return tempCollection;
  3393. return self;},
  3394. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20add%3A%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  3395. smalltalk.Stream);
  3396. smalltalk.addMethod(
  3397. '_nextPut_',
  3398. smalltalk.method({
  3399. selector: 'nextPut:',
  3400. category: 'writing',
  3401. fn: function (anObject){
  3402. var self=this;
  3403. self._position_(self._position().__plus((1)));
  3404. self._collection()._at_put_(self._position(),anObject);
  3405. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3406. return self;},
  3407. source: unescape('nextPut%3A%20anObject%0A%09self%20position%3A%20self%20position%20+%201.%0A%09self%20collection%20at%3A%20self%20position%20put%3A%20anObject.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  3408. smalltalk.Stream);
  3409. smalltalk.addMethod(
  3410. '_nextPutAll_',
  3411. smalltalk.method({
  3412. selector: 'nextPutAll:',
  3413. category: 'writing',
  3414. fn: function (aCollection){
  3415. var self=this;
  3416. aCollection._do_((function(each){return self._nextPut_(each);}));
  3417. return self;},
  3418. source: unescape('nextPutAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20nextPut%3A%20each%5D%0A')}),
  3419. smalltalk.Stream);
  3420. smalltalk.addMethod(
  3421. '_peek',
  3422. smalltalk.method({
  3423. selector: 'peek',
  3424. category: 'reading',
  3425. fn: function (){
  3426. var self=this;
  3427. return self._atEnd()._ifFalse_((function(){return self._collection()._at_(self._position().__plus((1)));}));
  3428. return self;},
  3429. source: unescape('peek%0A%09%5Eself%20atEnd%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20collection%20at%3A%20self%20position%20+%201%5D%0A')}),
  3430. smalltalk.Stream);
  3431. smalltalk.addMethod(
  3432. '_atEnd',
  3433. smalltalk.method({
  3434. selector: 'atEnd',
  3435. category: 'testing',
  3436. fn: function (){
  3437. var self=this;
  3438. return self._position().__eq(self._size());
  3439. return self;},
  3440. source: unescape('atEnd%0A%09%5Eself%20position%20%3D%20self%20size%0A')}),
  3441. smalltalk.Stream);
  3442. smalltalk.addMethod(
  3443. '_atStart',
  3444. smalltalk.method({
  3445. selector: 'atStart',
  3446. category: 'testing',
  3447. fn: function (){
  3448. var self=this;
  3449. return self._position().__eq((0));
  3450. return self;},
  3451. source: unescape('atStart%0A%09%5Eself%20position%20%3D%200%0A')}),
  3452. smalltalk.Stream);
  3453. smalltalk.addMethod(
  3454. '_isEmpty',
  3455. smalltalk.method({
  3456. selector: 'isEmpty',
  3457. category: 'testing',
  3458. fn: function (){
  3459. var self=this;
  3460. return self._size().__eq((0));
  3461. return self;},
  3462. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  3463. smalltalk.Stream);
  3464. smalltalk.addMethod(
  3465. '_on_',
  3466. smalltalk.method({
  3467. selector: 'on:',
  3468. category: 'instance creation',
  3469. fn: function (aCollection){
  3470. var self=this;
  3471. return (function($rec){$rec._setCollection_(aCollection);$rec._setStreamSize_(aCollection._size());return $rec._yourself();})(self._new());
  3472. return self;},
  3473. source: unescape('on%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%20%0A%09%09setCollection%3A%20aCollection%3B%0A%09%09setStreamSize%3A%20aCollection%20size%3B%0A%09%09yourself%0A')}),
  3474. smalltalk.Stream.klass);
  3475. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel');
  3476. smalltalk.addMethod(
  3477. '_next_',
  3478. smalltalk.method({
  3479. selector: 'next:',
  3480. category: 'reading',
  3481. fn: function (anInteger){
  3482. var self=this;
  3483. var tempCollection=nil;
  3484. tempCollection=self._collection()._class()._new();
  3485. anInteger._timesRepeat_((function(){return self._atEnd()._ifFalse_((function(){return tempCollection=tempCollection.__comma(self._next());}));}));
  3486. return tempCollection;
  3487. return self;},
  3488. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20%3A%3D%20tempCollection%2C%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  3489. smalltalk.StringStream);
  3490. smalltalk.addMethod(
  3491. '_nextPut_',
  3492. smalltalk.method({
  3493. selector: 'nextPut:',
  3494. category: 'writing',
  3495. fn: function (aString){
  3496. var self=this;
  3497. self._nextPutAll_(aString);
  3498. return self;},
  3499. source: unescape('nextPut%3A%20aString%0A%09self%20nextPutAll%3A%20aString%0A')}),
  3500. smalltalk.StringStream);
  3501. smalltalk.addMethod(
  3502. '_nextPutAll_',
  3503. smalltalk.method({
  3504. selector: 'nextPutAll:',
  3505. category: 'writing',
  3506. fn: function (aString){
  3507. var self=this;
  3508. self._setCollection_(self._collection()._copyFrom_to_((1),self._position()).__comma(aString).__comma(self._collection()._copyFrom_to_(self._position().__plus((1)).__plus(aString._size()),self._collection()._size())));
  3509. self._position_(self._position().__plus(aString._size()));
  3510. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3511. return self;},
  3512. source: unescape('nextPutAll%3A%20aString%0A%09self%20setCollection%3A%20%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%201%20to%3A%20self%20position%29%2C%0A%09%20%20%20%20aString%2C%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%20%28self%20position%20+%201%20+%20aString%20size%29%20to%3A%20self%20collection%20size%29.%0A%09self%20position%3A%20self%20position%20+%20aString%20size.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  3513. smalltalk.StringStream);
  3514. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel');
  3515. smalltalk.addMethod(
  3516. '_class_',
  3517. smalltalk.method({
  3518. selector: 'class:',
  3519. category: 'accessing',
  3520. fn: function (aClass){
  3521. var self=this;
  3522. self['@class']=aClass;
  3523. return self;},
  3524. source: unescape('class%3A%20aClass%0A%09class%20%3A%3D%20aClass%0A')}),
  3525. smalltalk.ClassCommentReader);
  3526. smalltalk.addMethod(
  3527. '_scanFrom_',
  3528. smalltalk.method({
  3529. selector: 'scanFrom:',
  3530. category: 'fileIn',
  3531. fn: function (aStream){
  3532. var self=this;
  3533. var nextChunk=nil;
  3534. nextChunk=self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  3535. nextChunk._isEmptyChunk()._ifFalse_((function(){return self._setComment_(nextChunk._contents());}));
  3536. return self;},
  3537. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20setComment%3A%20nextChunk%20contents%5D.%0A')}),
  3538. smalltalk.ClassCommentReader);
  3539. smalltalk.addMethod(
  3540. '_initialize',
  3541. smalltalk.method({
  3542. selector: 'initialize',
  3543. category: 'initialization',
  3544. fn: function (){
  3545. var self=this;
  3546. self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
  3547. self['@chunkParser']=smalltalk.ChunkParser._new();
  3548. return self;},
  3549. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  3550. smalltalk.ClassCommentReader);
  3551. smalltalk.addMethod(
  3552. '_setComment_',
  3553. smalltalk.method({
  3554. selector: 'setComment:',
  3555. category: 'private',
  3556. fn: function (aString){
  3557. var self=this;
  3558. self['@class']._comment_(aString);
  3559. return self;},
  3560. source: unescape('setComment%3A%20aString%0A%20%20%20%20class%20comment%3A%20aString%0A')}),
  3561. smalltalk.ClassCommentReader);