1
0

Kernel.js 133 KB

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