Kernel.js 129 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446
  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. '_streamClass',
  2166. smalltalk.method({
  2167. selector: 'streamClass',
  2168. category: 'accessing',
  2169. fn: function () {
  2170. var self = this;
  2171. return smalltalk.Stream;
  2172. return self;
  2173. },
  2174. source: unescape('streamClass%0A%09%20%20%20%20%5EStream%0A')}),
  2175. smalltalk.Collection.klass);
  2176. smalltalk.addMethod(
  2177. '_with_',
  2178. smalltalk.method({
  2179. selector: 'with:',
  2180. category: 'instance creation',
  2181. fn: function (anObject) {
  2182. var self = this;
  2183. return function ($rec) {$rec._add_(anObject);return $rec._yourself();}(self._new());
  2184. return self;
  2185. },
  2186. source: unescape('with%3A%20anObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09yourself%0A')}),
  2187. smalltalk.Collection.klass);
  2188. smalltalk.addMethod(
  2189. '_with_with_',
  2190. smalltalk.method({
  2191. selector: 'with:with:',
  2192. category: 'instance creation',
  2193. fn: function (anObject, anotherObject) {
  2194. var self = this;
  2195. return function ($rec) {$rec._add_(anObject);$rec._add_(anotherObject);return $rec._yourself();}(self._new());
  2196. return self;
  2197. },
  2198. 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')}),
  2199. smalltalk.Collection.klass);
  2200. smalltalk.addMethod(
  2201. '_with_with_with_',
  2202. smalltalk.method({
  2203. selector: 'with:with:with:',
  2204. category: 'instance creation',
  2205. fn: function (firstObject, secondObject, thirdObject) {
  2206. var self = this;
  2207. return function ($rec) {$rec._add_(firstObject);$rec._add_(secondObject);$rec._add_(thirdObject);return $rec._yourself();}(self._new());
  2208. return self;
  2209. },
  2210. 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')}),
  2211. smalltalk.Collection.klass);
  2212. smalltalk.addMethod(
  2213. '_withAll_',
  2214. smalltalk.method({
  2215. selector: 'withAll:',
  2216. category: 'instance creation',
  2217. fn: function (aCollection) {
  2218. var self = this;
  2219. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._new());
  2220. return self;
  2221. },
  2222. source: unescape('withAll%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%0A%09%09addAll%3A%20aCollection%3B%0A%09%09yourself%0A')}),
  2223. smalltalk.Collection.klass);
  2224. smalltalk.addClass('String', smalltalk.Collection, [], 'Kernel');
  2225. smalltalk.addMethod(
  2226. '__eq',
  2227. smalltalk.method({
  2228. selector: '=',
  2229. category: 'comparing',
  2230. fn: function (aString) {
  2231. var self = this;
  2232. return function () {return String(self) == aString;}();
  2233. return self;
  2234. },
  2235. source: unescape('%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3D%3D%20aString%27%7D%0A')}),
  2236. smalltalk.String);
  2237. smalltalk.addMethod(
  2238. '_size',
  2239. smalltalk.method({
  2240. selector: 'size',
  2241. category: 'accessing',
  2242. fn: function () {
  2243. var self = this;
  2244. return function () {return self.length;}();
  2245. return self;
  2246. },
  2247. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2248. smalltalk.String);
  2249. smalltalk.addMethod(
  2250. '_at_',
  2251. smalltalk.method({
  2252. selector: 'at:',
  2253. category: 'accessing',
  2254. fn: function (anIndex) {
  2255. var self = this;
  2256. return function () {return self[anIndex - 1] || nil;}();
  2257. return self;
  2258. },
  2259. 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')}),
  2260. smalltalk.String);
  2261. smalltalk.addMethod(
  2262. '_at_put_',
  2263. smalltalk.method({
  2264. selector: 'at:put:',
  2265. category: 'accessing',
  2266. fn: function (anIndex, anObject) {
  2267. var self = this;
  2268. self._errorReadOnly();
  2269. return self;
  2270. },
  2271. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2272. smalltalk.String);
  2273. smalltalk.addMethod(
  2274. '_at_ifAbsent_',
  2275. smalltalk.method({
  2276. selector: 'at:ifAbsent:',
  2277. category: 'accessing',
  2278. fn: function (anIndex, aBlock) {
  2279. var self = this;
  2280. self._at_(anIndex)._ifNil_(function () {return aBlock;});
  2281. return self;
  2282. },
  2283. 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')}),
  2284. smalltalk.String);
  2285. smalltalk.addMethod(
  2286. '_escaped',
  2287. smalltalk.method({
  2288. selector: 'escaped',
  2289. category: 'accessing',
  2290. fn: function () {
  2291. var self = this;
  2292. return function () {return escape(self);}();
  2293. return self;
  2294. },
  2295. source: unescape('escaped%0A%09%5E%7B%27return%20escape%28self%29%27%7D%0A')}),
  2296. smalltalk.String);
  2297. smalltalk.addMethod(
  2298. '_unescaped',
  2299. smalltalk.method({
  2300. selector: 'unescaped',
  2301. category: 'accessing',
  2302. fn: function () {
  2303. var self = this;
  2304. return function () {return unescape(self);}();
  2305. return self;
  2306. },
  2307. source: unescape('unescaped%0A%09%5E%7B%27return%20unescape%28self%29%27%7D%0A')}),
  2308. smalltalk.String);
  2309. smalltalk.addMethod(
  2310. '_add_',
  2311. smalltalk.method({
  2312. selector: 'add:',
  2313. category: 'adding',
  2314. fn: function (anObject) {
  2315. var self = this;
  2316. self._errorReadOnly();
  2317. return self;
  2318. },
  2319. source: unescape('add%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2320. smalltalk.String);
  2321. smalltalk.addMethod(
  2322. '__comma',
  2323. smalltalk.method({
  2324. selector: ',',
  2325. category: 'copying',
  2326. fn: function (aString) {
  2327. var self = this;
  2328. return function () {return self + aString;}();
  2329. return self;
  2330. },
  2331. source: unescape('%2C%20aString%0A%20%20%20%20%09%5E%7B%27return%20self%20+%20aString%27%7D%0A')}),
  2332. smalltalk.String);
  2333. smalltalk.addMethod(
  2334. '_copyFrom_to_',
  2335. smalltalk.method({
  2336. selector: 'copyFrom:to:',
  2337. category: 'copying',
  2338. fn: function (anIndex, anotherIndex) {
  2339. var self = this;
  2340. return function () {return self.substring(anIndex - 1, anotherIndex);}();
  2341. return self;
  2342. },
  2343. 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')}),
  2344. smalltalk.String);
  2345. smalltalk.addMethod(
  2346. '_shallowCopy',
  2347. smalltalk.method({
  2348. selector: 'shallowCopy',
  2349. category: 'copying',
  2350. fn: function () {
  2351. var self = this;
  2352. return self._class()._fromString_(self);
  2353. return self;
  2354. },
  2355. source: unescape('shallowCopy%0A%20%20%20%20%09%5Eself%20class%20fromString%3A%20self%0A')}),
  2356. smalltalk.String);
  2357. smalltalk.addMethod(
  2358. '_deepCopy',
  2359. smalltalk.method({
  2360. selector: 'deepCopy',
  2361. category: 'copying',
  2362. fn: function () {
  2363. var self = this;
  2364. return self._shallowCopy();
  2365. return self;
  2366. },
  2367. source: unescape('deepCopy%0A%20%20%20%20%09%5Eself%20shallowCopy%0A')}),
  2368. smalltalk.String);
  2369. smalltalk.addMethod(
  2370. '_asSelector',
  2371. smalltalk.method({
  2372. selector: 'asSelector',
  2373. category: 'converting',
  2374. fn: function () {
  2375. var self = this;
  2376. var selector = nil;
  2377. selector = "_".__comma(self);
  2378. selector = selector._replace_with_(":", "_");
  2379. selector = selector._replace_with_(unescape("%5B+%5D"), "_plus");
  2380. selector = selector._replace_with_(unescape("-"), "_minus");
  2381. selector = selector._replace_with_(unescape("%5B*%5D"), "_star");
  2382. selector = selector._replace_with_(unescape("%5B/%5D"), "_slash");
  2383. selector = selector._replace_with_(unescape("%3E"), "_gt");
  2384. selector = selector._replace_with_(unescape("%3C"), "_lt");
  2385. selector = selector._replace_with_(unescape("%3D"), "_eq");
  2386. selector = selector._replace_with_(unescape("%2C"), "_comma");
  2387. selector = selector._replace_with_(unescape("%5B@%5D"), "_at");
  2388. return selector;
  2389. return self;
  2390. },
  2391. 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')}),
  2392. smalltalk.String);
  2393. smalltalk.addMethod(
  2394. '_asJavascript',
  2395. smalltalk.method({
  2396. selector: 'asJavascript',
  2397. category: 'converting',
  2398. fn: function () {
  2399. var self = this;
  2400. return function () {if (self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1) {return "unescape(\"" + escape(self) + "\")";} else {return "\"" + self + "\"";}}();
  2401. return self;
  2402. },
  2403. 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')}),
  2404. smalltalk.String);
  2405. smalltalk.addMethod(
  2406. '_replace_with_',
  2407. smalltalk.method({
  2408. selector: 'replace:with:',
  2409. category: 'regular expressions',
  2410. fn: function (aString, anotherString) {
  2411. var self = this;
  2412. return self._replaceRegexp_with_(smalltalk.RegularExpression._fromString_flag_(aString, "g"), anotherString);
  2413. return self;
  2414. },
  2415. 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')}),
  2416. smalltalk.String);
  2417. smalltalk.addMethod(
  2418. '_replaceRegexp_with_',
  2419. smalltalk.method({
  2420. selector: 'replaceRegexp:with:',
  2421. category: 'regular expressions',
  2422. fn: function (aRegexp, aString) {
  2423. var self = this;
  2424. return function () {return self.replace(aRegexp, aString);}();
  2425. return self;
  2426. },
  2427. 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')}),
  2428. smalltalk.String);
  2429. smalltalk.addMethod(
  2430. '_tokenize_',
  2431. smalltalk.method({
  2432. selector: 'tokenize:',
  2433. category: 'converting',
  2434. fn: function (aString) {
  2435. var self = this;
  2436. return function () {return self.split(aString);}();
  2437. return self;
  2438. },
  2439. source: unescape('tokenize%3A%20aString%0A%09%5E%7B%27return%20self.split%28aString%29%27%7D%0A')}),
  2440. smalltalk.String);
  2441. smalltalk.addMethod(
  2442. '_match_',
  2443. smalltalk.method({
  2444. selector: 'match:',
  2445. category: 'regular expressions',
  2446. fn: function (aRegexp) {
  2447. var self = this;
  2448. return function () {return self.search(aRegexp) != -1;}();
  2449. return self;
  2450. },
  2451. 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')}),
  2452. smalltalk.String);
  2453. smalltalk.addMethod(
  2454. '_asString',
  2455. smalltalk.method({
  2456. selector: 'asString',
  2457. category: 'converting',
  2458. fn: function () {
  2459. var self = this;
  2460. return self;
  2461. return self;
  2462. },
  2463. source: unescape('asString%0A%20%20%20%20%09%5Eself%0A')}),
  2464. smalltalk.String);
  2465. smalltalk.addMethod(
  2466. '_asNumber',
  2467. smalltalk.method({
  2468. selector: 'asNumber',
  2469. category: 'converting',
  2470. fn: function () {
  2471. var self = this;
  2472. return function () {return Number(self);}();
  2473. return self;
  2474. },
  2475. source: unescape('asNumber%0A%09%5E%7B%27return%20Number%28self%29%3B%27%7D%0A')}),
  2476. smalltalk.String);
  2477. smalltalk.addMethod(
  2478. '_asParser',
  2479. smalltalk.method({
  2480. selector: 'asParser',
  2481. category: 'converting',
  2482. fn: function () {
  2483. var self = this;
  2484. return smalltalk.PPStringParser._new()._string_(self);
  2485. return self;
  2486. },
  2487. source: unescape('asParser%0A%20%20%20%20%09%5EPPStringParser%20new%20string%3A%20self%0A')}),
  2488. smalltalk.String);
  2489. smalltalk.addMethod(
  2490. '_asChoiceParser',
  2491. smalltalk.method({
  2492. selector: 'asChoiceParser',
  2493. category: 'converting',
  2494. fn: function () {
  2495. var self = this;
  2496. return smalltalk.PPChoiceParser._withAll_(self._asArray()._collect_(function (each) {return each._asParser();}));
  2497. return self;
  2498. },
  2499. 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')}),
  2500. smalltalk.String);
  2501. smalltalk.addMethod(
  2502. '_asCharacterParser',
  2503. smalltalk.method({
  2504. selector: 'asCharacterParser',
  2505. category: 'converting',
  2506. fn: function () {
  2507. var self = this;
  2508. return smalltalk.PPCharacterParser._new()._string_(self);
  2509. return self;
  2510. },
  2511. source: unescape('asCharacterParser%0A%20%20%20%20%09%5EPPCharacterParser%20new%20string%3A%20self%0A')}),
  2512. smalltalk.String);
  2513. smalltalk.addMethod(
  2514. '_errorReadOnly',
  2515. smalltalk.method({
  2516. selector: 'errorReadOnly',
  2517. category: 'error handling',
  2518. fn: function () {
  2519. var self = this;
  2520. self._error_(unescape("Object%20is%20read-only"));
  2521. return self;
  2522. },
  2523. source: unescape('errorReadOnly%0A%20%20%20%20%09self%20error%3A%20%27Object%20is%20read-only%27%0A')}),
  2524. smalltalk.String);
  2525. smalltalk.addMethod(
  2526. '_printString',
  2527. smalltalk.method({
  2528. selector: 'printString',
  2529. category: 'printing',
  2530. fn: function () {
  2531. var self = this;
  2532. return unescape("%27").__comma(self).__comma(unescape("%27"));
  2533. return self;
  2534. },
  2535. source: unescape('printString%0A%20%20%20%20%09%5E%27%27%27%27%2C%20self%2C%20%27%27%27%27%0A')}),
  2536. smalltalk.String);
  2537. smalltalk.addMethod(
  2538. '_printNl',
  2539. smalltalk.method({
  2540. selector: 'printNl',
  2541. category: 'printing',
  2542. fn: function () {
  2543. var self = this;
  2544. (function () {console.log(self);}());
  2545. return self;
  2546. },
  2547. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  2548. smalltalk.String);
  2549. smalltalk.addMethod(
  2550. '_isString',
  2551. smalltalk.method({
  2552. selector: 'isString',
  2553. category: 'testing',
  2554. fn: function () {
  2555. var self = this;
  2556. return true;
  2557. return self;
  2558. },
  2559. source: unescape('isString%0A%20%20%20%20%09%5Etrue%0A')}),
  2560. smalltalk.String);
  2561. smalltalk.addMethod(
  2562. '_asJQuery',
  2563. smalltalk.method({
  2564. selector: 'asJQuery',
  2565. category: '*JQuery',
  2566. fn: function () {
  2567. var self = this;
  2568. return smalltalk.JQuery._fromString_(self);
  2569. return self;
  2570. },
  2571. source: unescape('asJQuery%0A%20%20%20%20%5EJQuery%20fromString%3A%20self%0A')}),
  2572. smalltalk.String);
  2573. smalltalk.addMethod(
  2574. '_appendToJQuery_',
  2575. smalltalk.method({
  2576. selector: 'appendToJQuery:',
  2577. category: '*JQuery',
  2578. fn: function (aJQuery) {
  2579. var self = this;
  2580. (function () {aJQuery._appendElement_(String(self));}());
  2581. return self;
  2582. },
  2583. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20%7B%27aJQuery._appendElement_%28String%28self%29%29%27%7D%0A')}),
  2584. smalltalk.String);
  2585. smalltalk.addMethod(
  2586. '_appendToBrush_',
  2587. smalltalk.method({
  2588. selector: 'appendToBrush:',
  2589. category: '*Canvas',
  2590. fn: function (aTagBrush) {
  2591. var self = this;
  2592. aTagBrush._appendString_(self);
  2593. return self;
  2594. },
  2595. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendString%3A%20self%0A')}),
  2596. smalltalk.String);
  2597. smalltalk.addMethod(
  2598. '__gt',
  2599. smalltalk.method({
  2600. selector: '>',
  2601. category: 'comparing',
  2602. fn: function (aString) {
  2603. var self = this;
  2604. return function () {return String(self) > aString;}();
  2605. return self;
  2606. },
  2607. source: unescape('%3E%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%20aString%27%7D%0A')}),
  2608. smalltalk.String);
  2609. smalltalk.addMethod(
  2610. '__lt',
  2611. smalltalk.method({
  2612. selector: '<',
  2613. category: 'comparing',
  2614. fn: function (aString) {
  2615. var self = this;
  2616. return function () {return String(self) < aString;}();
  2617. return self;
  2618. },
  2619. source: unescape('%3C%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%20aString%27%7D%0A')}),
  2620. smalltalk.String);
  2621. smalltalk.addMethod(
  2622. '__gt_eq',
  2623. smalltalk.method({
  2624. selector: '>=',
  2625. category: 'comparing',
  2626. fn: function (aString) {
  2627. var self = this;
  2628. return function () {return String(self) >= aString;}();
  2629. return self;
  2630. },
  2631. source: unescape('%3E%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3E%3D%20aString%27%7D%0A')}),
  2632. smalltalk.String);
  2633. smalltalk.addMethod(
  2634. '__lt_eq',
  2635. smalltalk.method({
  2636. selector: '<=',
  2637. category: 'comparing',
  2638. fn: function (aString) {
  2639. var self = this;
  2640. return function () {return String(self) <= aString;}();
  2641. return self;
  2642. },
  2643. source: unescape('%3C%3D%20aString%0A%09%5E%7B%27return%20String%28self%29%20%3C%3D%20aString%27%7D%0A')}),
  2644. smalltalk.String);
  2645. smalltalk.addMethod(
  2646. '_remove_',
  2647. smalltalk.method({
  2648. selector: 'remove:',
  2649. category: 'adding',
  2650. fn: function (anObject) {
  2651. var self = this;
  2652. self._errorReadOnly();
  2653. return self;
  2654. },
  2655. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20errorReadOnly%0A')}),
  2656. smalltalk.String);
  2657. smalltalk.addMethod(
  2658. '_streamClass',
  2659. smalltalk.method({
  2660. selector: 'streamClass',
  2661. category: 'accessing',
  2662. fn: function () {
  2663. var self = this;
  2664. return smalltalk.StringStream;
  2665. return self;
  2666. },
  2667. source: unescape('streamClass%0A%09%20%20%20%20%5EStringStream%0A')}),
  2668. smalltalk.String.klass);
  2669. smalltalk.addMethod(
  2670. '_fromString_',
  2671. smalltalk.method({
  2672. selector: 'fromString:',
  2673. category: 'instance creation',
  2674. fn: function (aString) {
  2675. var self = this;
  2676. return function () {return new self.fn(aString);}();
  2677. return self;
  2678. },
  2679. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5E%7B%27return%20new%20self.fn%28aString%29%3B%27%7D%0A')}),
  2680. smalltalk.String.klass);
  2681. smalltalk.addMethod(
  2682. '_cr',
  2683. smalltalk.method({
  2684. selector: 'cr',
  2685. category: 'accessing',
  2686. fn: function () {
  2687. var self = this;
  2688. return function () {return "\n";}();
  2689. return self;
  2690. },
  2691. source: unescape('cr%0A%09%20%20%20%20%5E%7B%27%7Breturn%20%27%27%5Cn%27%27%7D%3B%27%7D%0A')}),
  2692. smalltalk.String.klass);
  2693. smalltalk.addMethod(
  2694. '_lf',
  2695. smalltalk.method({
  2696. selector: 'lf',
  2697. category: 'accessing',
  2698. fn: function () {
  2699. var self = this;
  2700. return function () {return "\r";}();
  2701. return self;
  2702. },
  2703. source: unescape('lf%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Cr%27%27%3B%27%7D%0A')}),
  2704. smalltalk.String.klass);
  2705. smalltalk.addMethod(
  2706. '_space',
  2707. smalltalk.method({
  2708. selector: 'space',
  2709. category: 'accessing',
  2710. fn: function () {
  2711. var self = this;
  2712. return function () {return " ";}();
  2713. return self;
  2714. },
  2715. source: unescape('space%0A%09%20%20%20%20%5E%7B%27return%20%27%27%20%27%27%3B%27%7D%0A')}),
  2716. smalltalk.String.klass);
  2717. smalltalk.addMethod(
  2718. '_tab',
  2719. smalltalk.method({
  2720. selector: 'tab',
  2721. category: 'accessing',
  2722. fn: function () {
  2723. var self = this;
  2724. return function () {return "\t";}();
  2725. return self;
  2726. },
  2727. source: unescape('tab%0A%09%20%20%20%20%5E%7B%27return%20%27%27%5Ct%27%27%3B%27%7D%0A')}),
  2728. smalltalk.String.klass);
  2729. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel');
  2730. smalltalk.addMethod(
  2731. '_compile_',
  2732. smalltalk.method({
  2733. selector: 'compile:',
  2734. category: 'evaluating',
  2735. fn: function (aString) {
  2736. var self = this;
  2737. return function () {return self.compile(aString);}();
  2738. return self;
  2739. },
  2740. source: unescape('compile%3A%20aString%0A%09%5E%7B%27return%20self.compile%28aString%29%3B%27%7D%0A')}),
  2741. smalltalk.RegularExpression);
  2742. smalltalk.addMethod(
  2743. '_exec_',
  2744. smalltalk.method({
  2745. selector: 'exec:',
  2746. category: 'evaluating',
  2747. fn: function (aString) {
  2748. var self = this;
  2749. return function () {return self.exec(aString);}();
  2750. return self;
  2751. },
  2752. source: unescape('exec%3A%20aString%0A%09%5E%7B%27return%20self.exec%28aString%29%3B%27%7D%0A')}),
  2753. smalltalk.RegularExpression);
  2754. smalltalk.addMethod(
  2755. '_test_',
  2756. smalltalk.method({
  2757. selector: 'test:',
  2758. category: 'evaluating',
  2759. fn: function (aString) {
  2760. var self = this;
  2761. return function () {return self.test(aString);}();
  2762. return self;
  2763. },
  2764. source: unescape('test%3A%20aString%0A%09%5E%7B%27return%20self.test%28aString%29%3B%27%7D%0A')}),
  2765. smalltalk.RegularExpression);
  2766. smalltalk.addMethod(
  2767. '_fromString_flag_',
  2768. smalltalk.method({
  2769. selector: 'fromString:flag:',
  2770. category: 'instance creation',
  2771. fn: function (aString, anotherString) {
  2772. var self = this;
  2773. return function () {return new RegExp(aString, anotherString);}();
  2774. return self;
  2775. },
  2776. 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')}),
  2777. smalltalk.RegularExpression.klass);
  2778. smalltalk.addMethod(
  2779. '_fromString_',
  2780. smalltalk.method({
  2781. selector: 'fromString:',
  2782. category: 'instance creation',
  2783. fn: function (aString) {
  2784. var self = this;
  2785. return self._fromString_flag_(aString, "");
  2786. return self;
  2787. },
  2788. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5Eself%20fromString%3A%20aString%20flag%3A%20%27%27%0A')}),
  2789. smalltalk.RegularExpression.klass);
  2790. smalltalk.addClass('Array', smalltalk.Collection, [], 'Kernel');
  2791. smalltalk.addMethod(
  2792. '_size',
  2793. smalltalk.method({
  2794. selector: 'size',
  2795. category: 'accessing',
  2796. fn: function () {
  2797. var self = this;
  2798. return function () {return self.length;}();
  2799. return self;
  2800. },
  2801. source: unescape('size%0A%09%5E%7B%27return%20self.length%27%7D%0A')}),
  2802. smalltalk.Array);
  2803. smalltalk.addMethod(
  2804. '_at_put_',
  2805. smalltalk.method({
  2806. selector: 'at:put:',
  2807. category: 'accessing',
  2808. fn: function (anIndex, anObject) {
  2809. var self = this;
  2810. return function () {return self[anIndex - 1] = anObject;}();
  2811. return self;
  2812. },
  2813. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09%5E%7B%27return%20self%5BanIndex%20-%201%5D%20%3D%20anObject%27%7D%0A')}),
  2814. smalltalk.Array);
  2815. smalltalk.addMethod(
  2816. '_at_ifAbsent_',
  2817. smalltalk.method({
  2818. selector: 'at:ifAbsent:',
  2819. category: 'accessing',
  2820. fn: function (anIndex, aBlock) {
  2821. var self = this;
  2822. return function () {var value = self[anIndex - 1];if (value === undefined) {return aBlock();} else {return value;}}();
  2823. return self;
  2824. },
  2825. 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')}),
  2826. smalltalk.Array);
  2827. smalltalk.addMethod(
  2828. '_add_',
  2829. smalltalk.method({
  2830. selector: 'add:',
  2831. category: 'adding',
  2832. fn: function (anObject) {
  2833. var self = this;
  2834. return function () {self.push(anObject);return anObject;}();
  2835. return self;
  2836. },
  2837. source: unescape('add%3A%20anObject%0A%09%5E%7B%27self.push%28anObject%29%3B%20return%20anObject%3B%27%7D%0A')}),
  2838. smalltalk.Array);
  2839. smalltalk.addMethod(
  2840. '_addLast_',
  2841. smalltalk.method({
  2842. selector: 'addLast:',
  2843. category: 'adding',
  2844. fn: function (anObject) {
  2845. var self = this;
  2846. return self._add_(anObject);
  2847. return self;
  2848. },
  2849. source: unescape('addLast%3A%20anObject%0A%09%5Eself%20add%3A%20anObject%0A')}),
  2850. smalltalk.Array);
  2851. smalltalk.addMethod(
  2852. '_shallowCopy',
  2853. smalltalk.method({
  2854. selector: 'shallowCopy',
  2855. category: 'copying',
  2856. fn: function () {
  2857. var self = this;
  2858. var newCollection = nil;
  2859. newCollection = self._class()._new();
  2860. self._do_(function (each) {return newCollection._add_(each);});
  2861. return newCollection;
  2862. return self;
  2863. },
  2864. 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')}),
  2865. smalltalk.Array);
  2866. smalltalk.addMethod(
  2867. '_deepCopy',
  2868. smalltalk.method({
  2869. selector: 'deepCopy',
  2870. category: 'copying',
  2871. fn: function () {
  2872. var self = this;
  2873. var newCollection = nil;
  2874. newCollection = self._class()._new();
  2875. self._do_(function (each) {return newCollection._add_(each._deepCopy());});
  2876. return newCollection;
  2877. return self;
  2878. },
  2879. 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')}),
  2880. smalltalk.Array);
  2881. smalltalk.addMethod(
  2882. '_copyFrom_to_',
  2883. smalltalk.method({
  2884. selector: 'copyFrom:to:',
  2885. category: 'copying',
  2886. fn: function (anIndex, anotherIndex) {
  2887. var self = this;
  2888. var array = nil;
  2889. array = self._class()._new();
  2890. anIndex._to_do_(anotherIndex, function (each) {return array._add_(self._at_(each));});
  2891. return array;
  2892. return self;
  2893. },
  2894. 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')}),
  2895. smalltalk.Array);
  2896. smalltalk.addMethod(
  2897. '_join_',
  2898. smalltalk.method({
  2899. selector: 'join:',
  2900. category: 'enumerating',
  2901. fn: function (aString) {
  2902. var self = this;
  2903. return function () {return self.join(aString);}();
  2904. return self;
  2905. },
  2906. source: unescape('join%3A%20aString%0A%09%5E%7B%27return%20self.join%28aString%29%3B%27%7D%0A')}),
  2907. smalltalk.Array);
  2908. smalltalk.addMethod(
  2909. '_asJavascript',
  2910. smalltalk.method({
  2911. selector: 'asJavascript',
  2912. category: 'converting',
  2913. fn: function () {
  2914. var self = this;
  2915. return unescape("%5B").__comma(self._collect_(function (each) {return each._asJavascript();})._join_(unescape("%2C%20"))).__comma(unescape("%5D"));
  2916. return self;
  2917. },
  2918. 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')}),
  2919. smalltalk.Array);
  2920. smalltalk.addMethod(
  2921. '_sort',
  2922. smalltalk.method({
  2923. selector: 'sort',
  2924. category: 'enumerating',
  2925. fn: function () {
  2926. var self = this;
  2927. return self._copy()._basicPerform_("sort");
  2928. return self;
  2929. },
  2930. source: unescape('sort%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%0A')}),
  2931. smalltalk.Array);
  2932. smalltalk.addMethod(
  2933. '_sort_',
  2934. smalltalk.method({
  2935. selector: 'sort:',
  2936. category: 'enumerating',
  2937. fn: function (aBlock) {
  2938. var self = this;
  2939. return self._copy()._basicPerform_withArguments_("sort", smalltalk.Array._with_(aBlock));
  2940. return self;
  2941. },
  2942. source: unescape('sort%3A%20aBlock%0A%20%20%20%20%5Eself%20copy%20basicPerform%3A%20%27sort%27%20withArguments%3A%20%28Array%20with%3A%20aBlock%29%0A')}),
  2943. smalltalk.Array);
  2944. smalltalk.addMethod(
  2945. '_remove_',
  2946. smalltalk.method({
  2947. selector: 'remove:',
  2948. category: 'adding',
  2949. fn: function (anObject) {
  2950. var self = this;
  2951. (function () {for (var i = 0; i < self.length; i++) {if (self[i] == anObject) {self.splice(i, 1);break;}}}());
  2952. return self;
  2953. },
  2954. 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')}),
  2955. smalltalk.Array);
  2956. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel');
  2957. smalltalk.addMethod(
  2958. '_messageText',
  2959. smalltalk.method({
  2960. selector: 'messageText',
  2961. category: 'accessing',
  2962. fn: function () {
  2963. var self = this;
  2964. return self['@messageText'];
  2965. return self;
  2966. },
  2967. source: unescape('messageText%0A%09%5EmessageText%0A')}),
  2968. smalltalk.Error);
  2969. smalltalk.addMethod(
  2970. '_messageText_',
  2971. smalltalk.method({
  2972. selector: 'messageText:',
  2973. category: 'accessing',
  2974. fn: function (aString) {
  2975. var self = this;
  2976. self['@messageText'] = aString;
  2977. return self;
  2978. },
  2979. source: unescape('messageText%3A%20aString%0A%09messageText%20%3A%3D%20aString%0A')}),
  2980. smalltalk.Error);
  2981. smalltalk.addMethod(
  2982. '_signal',
  2983. smalltalk.method({
  2984. selector: 'signal',
  2985. category: 'signaling',
  2986. fn: function () {
  2987. var self = this;
  2988. return function () {throw {smalltalkError: self};}();
  2989. return self;
  2990. },
  2991. source: unescape('signal%0A%09%5E%7B%27throw%28%7BsmalltalkError%3A%20self%7D%29%27%7D%0A')}),
  2992. smalltalk.Error);
  2993. smalltalk.addMethod(
  2994. '_signal_',
  2995. smalltalk.method({
  2996. selector: 'signal:',
  2997. category: 'instance creation',
  2998. fn: function (aString) {
  2999. var self = this;
  3000. return function ($rec) {$rec._messageText_(aString);return $rec._signal();}(self._new());
  3001. return self;
  3002. },
  3003. source: unescape('signal%3A%20aString%0A%09%20%20%20%20%5Eself%20new%0A%09%09messageText%3A%20aString%3B%0A%09%09signal%0A')}),
  3004. smalltalk.Error.klass);
  3005. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel');
  3006. smalltalk.addMethod(
  3007. '__eq',
  3008. smalltalk.method({
  3009. selector: '=',
  3010. category: 'comparing',
  3011. fn: function (anAssociation) {
  3012. var self = this;
  3013. return self._class().__eq(anAssociation._class())._and_(function () {return self._key().__eq(anAssociation._key())._and_(function () {return self._value().__eq(anAssociation._value());});});
  3014. return self;
  3015. },
  3016. 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')}),
  3017. smalltalk.Association);
  3018. smalltalk.addMethod(
  3019. '_key_',
  3020. smalltalk.method({
  3021. selector: 'key:',
  3022. category: 'accessing',
  3023. fn: function (aKey) {
  3024. var self = this;
  3025. self['@key'] = aKey;
  3026. return self;
  3027. },
  3028. source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey%0A')}),
  3029. smalltalk.Association);
  3030. smalltalk.addMethod(
  3031. '_key',
  3032. smalltalk.method({
  3033. selector: 'key',
  3034. category: 'accessing',
  3035. fn: function () {
  3036. var self = this;
  3037. return self['@key'];
  3038. return self;
  3039. },
  3040. source: unescape('key%0A%09%5Ekey%0A')}),
  3041. smalltalk.Association);
  3042. smalltalk.addMethod(
  3043. '_value_',
  3044. smalltalk.method({
  3045. selector: 'value:',
  3046. category: 'accessing',
  3047. fn: function (aValue) {
  3048. var self = this;
  3049. self['@value'] = aValue;
  3050. return self;
  3051. },
  3052. source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue%0A')}),
  3053. smalltalk.Association);
  3054. smalltalk.addMethod(
  3055. '_value',
  3056. smalltalk.method({
  3057. selector: 'value',
  3058. category: 'accessing',
  3059. fn: function () {
  3060. var self = this;
  3061. return self['@value'];
  3062. return self;
  3063. },
  3064. source: unescape('value%0A%09%5Evalue%0A')}),
  3065. smalltalk.Association);
  3066. smalltalk.addMethod(
  3067. '_key_value_',
  3068. smalltalk.method({
  3069. selector: 'key:value:',
  3070. category: 'instance creation',
  3071. fn: function (aKey, aValue) {
  3072. var self = this;
  3073. return function ($rec) {$rec._key_(aKey);$rec._value_(aValue);return $rec._yourself();}(self._new());
  3074. return self;
  3075. },
  3076. 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')}),
  3077. smalltalk.Association.klass);
  3078. smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
  3079. smalltalk.addMethod(
  3080. '__eq',
  3081. smalltalk.method({
  3082. selector: '=',
  3083. category: 'comparing',
  3084. fn: function (aDictionary) {
  3085. var self = this;
  3086. try {
  3087. self._class().__eq(aDictionary._class())._ifFalse_(function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();});
  3088. 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;}};}();});});
  3089. (function () {throw {name: "stReturn", selector: "__eq", fn: function () {return true;}};}());
  3090. return self;
  3091. } catch (e) {
  3092. if (e.name === "stReturn" && e.selector === "__eq") {
  3093. return e.fn();
  3094. }
  3095. throw e;
  3096. }
  3097. },
  3098. 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')}),
  3099. smalltalk.Dictionary);
  3100. smalltalk.addMethod(
  3101. '_shallowCopy',
  3102. smalltalk.method({
  3103. selector: 'shallowCopy',
  3104. category: 'copying',
  3105. fn: function () {
  3106. var self = this;
  3107. var copy = nil;
  3108. copy = self._class()._new();
  3109. self._associationsDo_(function (each) {return copy._at_put_(each._key(), each._value());});
  3110. return copy;
  3111. return self;
  3112. },
  3113. 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')}),
  3114. smalltalk.Dictionary);
  3115. smalltalk.addMethod(
  3116. '_initialize',
  3117. smalltalk.method({
  3118. selector: 'initialize',
  3119. category: 'initialization',
  3120. fn: function () {
  3121. var self = this;
  3122. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3123. self['@keys'] = [];
  3124. return self;
  3125. },
  3126. source: unescape('initialize%0A%20%20%20%20%09super%20initialize.%0A%20%20%20%20%09keys%20%3A%3D%20%23%28%29%0A')}),
  3127. smalltalk.Dictionary);
  3128. smalltalk.addMethod(
  3129. '_size',
  3130. smalltalk.method({
  3131. selector: 'size',
  3132. category: 'accessing',
  3133. fn: function () {
  3134. var self = this;
  3135. return self['@keys']._size();
  3136. return self;
  3137. },
  3138. source: unescape('size%0A%09%5Ekeys%20size%0A')}),
  3139. smalltalk.Dictionary);
  3140. smalltalk.addMethod(
  3141. '_associations',
  3142. smalltalk.method({
  3143. selector: 'associations',
  3144. category: 'accessing',
  3145. fn: function () {
  3146. var self = this;
  3147. var associations = nil;
  3148. associations = [];
  3149. self['@keys']._do_(function (each) {return associations._add_(smalltalk.Association._key_value_(each, self._at_(each)));});
  3150. return associations;
  3151. return self;
  3152. },
  3153. 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')}),
  3154. smalltalk.Dictionary);
  3155. smalltalk.addMethod(
  3156. '_keys',
  3157. smalltalk.method({
  3158. selector: 'keys',
  3159. category: 'accessing',
  3160. fn: function () {
  3161. var self = this;
  3162. return self['@keys']._copy();
  3163. return self;
  3164. },
  3165. source: unescape('keys%0A%09%5Ekeys%20copy%0A')}),
  3166. smalltalk.Dictionary);
  3167. smalltalk.addMethod(
  3168. '_values',
  3169. smalltalk.method({
  3170. selector: 'values',
  3171. category: 'accessing',
  3172. fn: function () {
  3173. var self = this;
  3174. return self['@keys']._collect_(function (each) {return self._at_(each);});
  3175. return self;
  3176. },
  3177. source: unescape('values%0A%20%20%20%20%09%5Ekeys%20collect%3A%20%5B%3Aeach%20%7C%20self%20at%3A%20each%5D%0A')}),
  3178. smalltalk.Dictionary);
  3179. smalltalk.addMethod(
  3180. '_at_put_',
  3181. smalltalk.method({
  3182. selector: 'at:put:',
  3183. category: 'accessing',
  3184. fn: function (aKey, aValue) {
  3185. var self = this;
  3186. self['@keys']._includes_(aKey)._ifFalse_(function () {return self['@keys']._add_(aKey);});
  3187. return self._basicAt_put_(aKey, aValue);
  3188. return self;
  3189. },
  3190. 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')}),
  3191. smalltalk.Dictionary);
  3192. smalltalk.addMethod(
  3193. '_at_ifAbsent_',
  3194. smalltalk.method({
  3195. selector: 'at:ifAbsent:',
  3196. category: 'accessing',
  3197. fn: function (aKey, aBlock) {
  3198. var self = this;
  3199. return self._basicAt_(aKey)._ifNil_(aBlock);
  3200. return self;
  3201. },
  3202. source: unescape('at%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNil%3A%20aBlock%0A')}),
  3203. smalltalk.Dictionary);
  3204. smalltalk.addMethod(
  3205. '_at_ifAbsentPut_',
  3206. smalltalk.method({
  3207. selector: 'at:ifAbsentPut:',
  3208. category: 'accessing',
  3209. fn: function (aKey, aBlock) {
  3210. var self = this;
  3211. return self._at_ifAbsent_(aKey, function () {return self._at_put_(aKey, aBlock._value());});
  3212. return self;
  3213. },
  3214. 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')}),
  3215. smalltalk.Dictionary);
  3216. smalltalk.addMethod(
  3217. '_at_ifPresent_',
  3218. smalltalk.method({
  3219. selector: 'at:ifPresent:',
  3220. category: 'accessing',
  3221. fn: function (aKey, aBlock) {
  3222. var self = this;
  3223. return self._basicAt_(aKey)._ifNotNil_(function () {return aBlock._value_(self._at_(aKey));});
  3224. return self;
  3225. },
  3226. 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')}),
  3227. smalltalk.Dictionary);
  3228. smalltalk.addMethod(
  3229. '_at_ifPresent_ifAbsent_',
  3230. smalltalk.method({
  3231. selector: 'at:ifPresent:ifAbsent:',
  3232. category: 'accessing',
  3233. fn: function (aKey, aBlock, anotherBlock) {
  3234. var self = this;
  3235. return self._basicAt_(aKey)._ifNil_ifNotNil_(anotherBlock, function () {return aBlock._value_(self._at_(aKey));});
  3236. return self;
  3237. },
  3238. 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')}),
  3239. smalltalk.Dictionary);
  3240. smalltalk.addMethod(
  3241. '_add_',
  3242. smalltalk.method({
  3243. selector: 'add:',
  3244. category: 'adding/removing',
  3245. fn: function (anAssociation) {
  3246. var self = this;
  3247. self._at_put_(anAssociation._key(), anAssociation._value());
  3248. return self;
  3249. },
  3250. source: unescape('add%3A%20anAssociation%0A%20%20%20%20%09self%20at%3A%20anAssociation%20key%20put%3A%20anAssociation%20value%0A')}),
  3251. smalltalk.Dictionary);
  3252. smalltalk.addMethod(
  3253. '_addAll_',
  3254. smalltalk.method({
  3255. selector: 'addAll:',
  3256. category: 'adding/removing',
  3257. fn: function (aDictionary) {
  3258. var self = this;
  3259. self.klass.superclass.fn.prototype._addAll_.apply(self, [aDictionary._associations()]);
  3260. return aDictionary;
  3261. return self;
  3262. },
  3263. source: unescape('addAll%3A%20aDictionary%0A%20%20%20%20%09super%20addAll%3A%20aDictionary%20associations.%0A%20%20%20%20%09%5EaDictionary%0A')}),
  3264. smalltalk.Dictionary);
  3265. smalltalk.addMethod(
  3266. '__comma',
  3267. smalltalk.method({
  3268. selector: ',',
  3269. category: 'copying',
  3270. fn: function (aCollection) {
  3271. var self = this;
  3272. self._shouldNotImplement();
  3273. return self;
  3274. },
  3275. source: unescape('%2C%20aCollection%0A%09self%20shouldNotImplement%0A')}),
  3276. smalltalk.Dictionary);
  3277. smalltalk.addMethod(
  3278. '_copyFrom_to_',
  3279. smalltalk.method({
  3280. selector: 'copyFrom:to:',
  3281. category: 'copying',
  3282. fn: function (anIndex, anotherIndex) {
  3283. var self = this;
  3284. self._shouldNotImplement();
  3285. return self;
  3286. },
  3287. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20shouldNotImplement%0A')}),
  3288. smalltalk.Dictionary);
  3289. smalltalk.addMethod(
  3290. '_associationsDo_',
  3291. smalltalk.method({
  3292. selector: 'associationsDo:',
  3293. category: 'enumerating',
  3294. fn: function (aBlock) {
  3295. var self = this;
  3296. self._associations()._do_(aBlock);
  3297. return self;
  3298. },
  3299. source: unescape('associationsDo%3A%20aBlock%0A%20%20%20%20%09self%20associations%20do%3A%20aBlock%0A')}),
  3300. smalltalk.Dictionary);
  3301. smalltalk.addMethod(
  3302. '_keysAndValuesDo_',
  3303. smalltalk.method({
  3304. selector: 'keysAndValuesDo:',
  3305. category: 'enumerating',
  3306. fn: function (aBlock) {
  3307. var self = this;
  3308. self._associationsDo_(function (each) {return aBlock._value_value_(each._key(), each._value());});
  3309. return self;
  3310. },
  3311. 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')}),
  3312. smalltalk.Dictionary);
  3313. smalltalk.addMethod(
  3314. '_do_',
  3315. smalltalk.method({
  3316. selector: 'do:',
  3317. category: 'enumerating',
  3318. fn: function (aBlock) {
  3319. var self = this;
  3320. self._values()._do_(aBlock);
  3321. return self;
  3322. },
  3323. source: unescape('do%3A%20aBlock%0A%20%20%20%20%09self%20values%20do%3A%20aBlock%0A')}),
  3324. smalltalk.Dictionary);
  3325. smalltalk.addMethod(
  3326. '_select_',
  3327. smalltalk.method({
  3328. selector: 'select:',
  3329. category: 'enumerating',
  3330. fn: function (aBlock) {
  3331. var self = this;
  3332. var newDict = nil;
  3333. newDict = self._class()._new();
  3334. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3335. return newDict;
  3336. return self;
  3337. },
  3338. 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')}),
  3339. smalltalk.Dictionary);
  3340. smalltalk.addMethod(
  3341. '_collect_',
  3342. smalltalk.method({
  3343. selector: 'collect:',
  3344. category: 'enumerating',
  3345. fn: function (aBlock) {
  3346. var self = this;
  3347. var newDict = nil;
  3348. newDict = self._class()._new();
  3349. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3350. return newDict;
  3351. return self;
  3352. },
  3353. 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')}),
  3354. smalltalk.Dictionary);
  3355. smalltalk.addMethod(
  3356. '_detect_ifNone_',
  3357. smalltalk.method({
  3358. selector: 'detect:ifNone:',
  3359. category: 'enumerating',
  3360. fn: function (aBlock, anotherBlock) {
  3361. var self = this;
  3362. return self._values()._detect_ifNone_(aBlock, anotherBlock);
  3363. return self;
  3364. },
  3365. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5Eself%20values%20detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A')}),
  3366. smalltalk.Dictionary);
  3367. smalltalk.addMethod(
  3368. '_includes_',
  3369. smalltalk.method({
  3370. selector: 'includes:',
  3371. category: 'enumerating',
  3372. fn: function (anObject) {
  3373. var self = this;
  3374. return self._values()._includes_(anObject);
  3375. return self;
  3376. },
  3377. source: unescape('includes%3A%20anObject%0A%09%5Eself%20values%20includes%3A%20anObject%0A')}),
  3378. smalltalk.Dictionary);
  3379. smalltalk.addMethod(
  3380. '_remove_',
  3381. smalltalk.method({
  3382. selector: 'remove:',
  3383. category: 'adding/removing',
  3384. fn: function (aKey) {
  3385. var self = this;
  3386. self._removeKey_(aKey);
  3387. return self;
  3388. },
  3389. source: unescape('remove%3A%20aKey%0A%20%20%20%20self%20removeKey%3A%20aKey%0A')}),
  3390. smalltalk.Dictionary);
  3391. smalltalk.addMethod(
  3392. '_removeKey_',
  3393. smalltalk.method({
  3394. selector: 'removeKey:',
  3395. category: 'adding/removing',
  3396. fn: function (aKey) {
  3397. var self = this;
  3398. self['@keys']._remove_(aKey);
  3399. return self;
  3400. },
  3401. source: unescape('removeKey%3A%20aKey%0A%20%20%20%20keys%20remove%3A%20aKey%0A')}),
  3402. smalltalk.Dictionary);
  3403. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel');
  3404. smalltalk.addMethod(
  3405. '_superclass_subclass_',
  3406. smalltalk.method({
  3407. selector: 'superclass:subclass:',
  3408. category: 'class creation',
  3409. fn: function (aClass, aString) {
  3410. var self = this;
  3411. self._superclass_subclass_instanceVariableNames_category_(aClass, aString, "", nil);
  3412. return self;
  3413. },
  3414. 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')}),
  3415. smalltalk.ClassBuilder);
  3416. smalltalk.addMethod(
  3417. '_superclass_subclass_instanceVariableNames_category_',
  3418. smalltalk.method({
  3419. selector: 'superclass:subclass:instanceVariableNames:category:',
  3420. category: 'class creation',
  3421. fn: function (aClass, aString, aString2, aString3) {
  3422. var self = this;
  3423. var newClass = nil;
  3424. newClass = self._addSubclassOf_named_instanceVariableNames_(aClass, aString, self._instanceVariableNamesFor_(aString2));
  3425. self._setupClass_(newClass);
  3426. newClass._category_(aString3._ifNil_(function () {return "unclassified";}));
  3427. return self;
  3428. },
  3429. 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')}),
  3430. smalltalk.ClassBuilder);
  3431. smalltalk.addMethod(
  3432. '_class_instanceVariableNames_',
  3433. smalltalk.method({
  3434. selector: 'class:instanceVariableNames:',
  3435. category: 'class creation',
  3436. fn: function (aClass, aString) {
  3437. var self = this;
  3438. aClass._isMetaclass()._ifFalse_(function () {return self._error_(aClass._name().__comma(" is not a metaclass"));});
  3439. aClass._basicAt_put_("iVarNames", self._instanceVariableNamesFor_(aString));
  3440. self._setupClass_(aClass);
  3441. return self;
  3442. },
  3443. 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')}),
  3444. smalltalk.ClassBuilder);
  3445. smalltalk.addMethod(
  3446. '_instanceVariableNamesFor_',
  3447. smalltalk.method({
  3448. selector: 'instanceVariableNamesFor:',
  3449. category: 'private',
  3450. fn: function (aString) {
  3451. var self = this;
  3452. return aString._tokenize_(" ")._reject_(function (each) {return each._isEmpty();});
  3453. return self;
  3454. },
  3455. 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')}),
  3456. smalltalk.ClassBuilder);
  3457. smalltalk.addMethod(
  3458. '_addSubclassOf_named_instanceVariableNames_',
  3459. smalltalk.method({
  3460. selector: 'addSubclassOf:named:instanceVariableNames:',
  3461. category: 'private',
  3462. fn: function (aClass, aString, aCollection) {
  3463. var self = this;
  3464. return function () {smalltalk.addClass(aString, aClass, aCollection);return smalltalk[aString];}();
  3465. return self;
  3466. },
  3467. 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')}),
  3468. smalltalk.ClassBuilder);
  3469. smalltalk.addMethod(
  3470. '_setupClass_',
  3471. smalltalk.method({
  3472. selector: 'setupClass:',
  3473. category: 'private',
  3474. fn: function (aClass) {
  3475. var self = this;
  3476. (function () {smalltalk.init(aClass);}());
  3477. return self;
  3478. },
  3479. source: unescape('setupClass%3A%20aClass%0A%09%7B%27smalltalk.init%28aClass%29%3B%27%7D%0A')}),
  3480. smalltalk.ClassBuilder);
  3481. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel');
  3482. smalltalk.addMethod(
  3483. '_initialize',
  3484. smalltalk.method({
  3485. selector: 'initialize',
  3486. category: 'initialization',
  3487. fn: function () {
  3488. var self = this;
  3489. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3490. self['@chunkParser'] = smalltalk.ChunkParser._new();
  3491. return self;
  3492. },
  3493. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  3494. smalltalk.ClassCategoryReader);
  3495. smalltalk.addMethod(
  3496. '_class_category_',
  3497. smalltalk.method({
  3498. selector: 'class:category:',
  3499. category: 'accessing',
  3500. fn: function (aClass, aString) {
  3501. var self = this;
  3502. self['@class'] = aClass;
  3503. self['@category'] = aString;
  3504. return self;
  3505. },
  3506. source: unescape('class%3A%20aClass%20category%3A%20aString%0A%09class%20%3A%3D%20aClass.%0A%09category%20%3A%3D%20aString%0A')}),
  3507. smalltalk.ClassCategoryReader);
  3508. smalltalk.addMethod(
  3509. '_scanFrom_',
  3510. smalltalk.method({
  3511. selector: 'scanFrom:',
  3512. category: 'fileIn',
  3513. fn: function (aStream) {
  3514. var self = this;
  3515. var nextChunk = nil;
  3516. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  3517. nextChunk._isEmptyChunk()._ifFalse_(function () {self._compileMethod_(nextChunk._contents());return self._scanFrom_(aStream);});
  3518. return self;
  3519. },
  3520. 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')}),
  3521. smalltalk.ClassCategoryReader);
  3522. smalltalk.addMethod(
  3523. '_compileMethod_',
  3524. smalltalk.method({
  3525. selector: 'compileMethod:',
  3526. category: 'private',
  3527. fn: function (aString) {
  3528. var self = this;
  3529. var method = nil;
  3530. method = smalltalk.Compiler._new()._load_forClass_(aString, self['@class']);
  3531. method._category_(self['@category']);
  3532. self['@class']._addCompiledMethod_(method);
  3533. return self;
  3534. },
  3535. 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')}),
  3536. smalltalk.ClassCategoryReader);
  3537. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel');
  3538. smalltalk.addMethod(
  3539. '_collection',
  3540. smalltalk.method({
  3541. selector: 'collection',
  3542. category: 'accessing',
  3543. fn: function () {
  3544. var self = this;
  3545. return self['@collection'];
  3546. return self;
  3547. },
  3548. source: unescape('collection%0A%09%5Ecollection%0A')}),
  3549. smalltalk.Stream);
  3550. smalltalk.addMethod(
  3551. '_setCollection_',
  3552. smalltalk.method({
  3553. selector: 'setCollection:',
  3554. category: 'accessing',
  3555. fn: function (aCollection) {
  3556. var self = this;
  3557. self['@collection'] = aCollection;
  3558. return self;
  3559. },
  3560. source: unescape('setCollection%3A%20aCollection%0A%09collection%20%3A%3D%20aCollection%0A')}),
  3561. smalltalk.Stream);
  3562. smalltalk.addMethod(
  3563. '_position',
  3564. smalltalk.method({
  3565. selector: 'position',
  3566. category: 'accessing',
  3567. fn: function () {
  3568. var self = this;
  3569. return self['@position']._ifNil_(function () {return self['@position'] = 0;});
  3570. return self;
  3571. },
  3572. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5Bposition%20%3A%3D%200%5D%0A')}),
  3573. smalltalk.Stream);
  3574. smalltalk.addMethod(
  3575. '_position_',
  3576. smalltalk.method({
  3577. selector: 'position:',
  3578. category: 'accessing',
  3579. fn: function (anInteger) {
  3580. var self = this;
  3581. self['@position'] = anInteger;
  3582. return self;
  3583. },
  3584. source: unescape('position%3A%20anInteger%0A%09position%20%3A%3D%20anInteger%0A')}),
  3585. smalltalk.Stream);
  3586. smalltalk.addMethod(
  3587. '_streamSize',
  3588. smalltalk.method({
  3589. selector: 'streamSize',
  3590. category: 'accessing',
  3591. fn: function () {
  3592. var self = this;
  3593. return self['@streamSize'];
  3594. return self;
  3595. },
  3596. source: unescape('streamSize%0A%09%5EstreamSize%0A')}),
  3597. smalltalk.Stream);
  3598. smalltalk.addMethod(
  3599. '_setStreamSize_',
  3600. smalltalk.method({
  3601. selector: 'setStreamSize:',
  3602. category: 'accessing',
  3603. fn: function (anInteger) {
  3604. var self = this;
  3605. self['@streamSize'] = anInteger;
  3606. return self;
  3607. },
  3608. source: unescape('setStreamSize%3A%20anInteger%0A%09streamSize%20%3A%3D%20anInteger%0A')}),
  3609. smalltalk.Stream);
  3610. smalltalk.addMethod(
  3611. '_contents',
  3612. smalltalk.method({
  3613. selector: 'contents',
  3614. category: 'accessing',
  3615. fn: function () {
  3616. var self = this;
  3617. return self._collection()._copyFrom_to_(1, self._streamSize());
  3618. return self;
  3619. },
  3620. 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')}),
  3621. smalltalk.Stream);
  3622. smalltalk.addMethod(
  3623. '_size',
  3624. smalltalk.method({
  3625. selector: 'size',
  3626. category: 'accessing',
  3627. fn: function () {
  3628. var self = this;
  3629. return self._streamSize();
  3630. return self;
  3631. },
  3632. source: unescape('size%0A%09%5Eself%20streamSize%0A')}),
  3633. smalltalk.Stream);
  3634. smalltalk.addMethod(
  3635. '_reset',
  3636. smalltalk.method({
  3637. selector: 'reset',
  3638. category: 'actions',
  3639. fn: function () {
  3640. var self = this;
  3641. self._position_(0);
  3642. return self;
  3643. },
  3644. source: unescape('reset%0A%09self%20position%3A%200%0A')}),
  3645. smalltalk.Stream);
  3646. smalltalk.addMethod(
  3647. '_close',
  3648. smalltalk.method({
  3649. selector: 'close',
  3650. category: 'actions',
  3651. fn: function () {
  3652. var self = this;
  3653. return self;
  3654. },
  3655. source: unescape('close%0A')}),
  3656. smalltalk.Stream);
  3657. smalltalk.addMethod(
  3658. '_flush',
  3659. smalltalk.method({
  3660. selector: 'flush',
  3661. category: 'actions',
  3662. fn: function () {
  3663. var self = this;
  3664. return self;
  3665. },
  3666. source: unescape('flush%0A')}),
  3667. smalltalk.Stream);
  3668. smalltalk.addMethod(
  3669. '_resetContents',
  3670. smalltalk.method({
  3671. selector: 'resetContents',
  3672. category: 'actions',
  3673. fn: function () {
  3674. var self = this;
  3675. self._reset();
  3676. self._setStreamSize_(0);
  3677. return self;
  3678. },
  3679. source: unescape('resetContents%0A%09self%20reset.%0A%09self%20setStreamSize%3A%200%0A')}),
  3680. smalltalk.Stream);
  3681. smalltalk.addMethod(
  3682. '_do_',
  3683. smalltalk.method({
  3684. selector: 'do:',
  3685. category: 'enumerating',
  3686. fn: function (aBlock) {
  3687. var self = this;
  3688. (function () {return self._atEnd();}._whileFalse_(function () {return aBlock._value_(self._next());}));
  3689. return self;
  3690. },
  3691. source: unescape('do%3A%20aBlock%0A%09%5Bself%20atEnd%5D%20whileFalse%3A%20%5BaBlock%20value%3A%20self%20next%5D%0A')}),
  3692. smalltalk.Stream);
  3693. smalltalk.addMethod(
  3694. '_setToEnd',
  3695. smalltalk.method({
  3696. selector: 'setToEnd',
  3697. category: 'positioning',
  3698. fn: function () {
  3699. var self = this;
  3700. self._position_(self._size());
  3701. return self;
  3702. },
  3703. source: unescape('setToEnd%0A%09self%20position%3A%20self%20size%0A')}),
  3704. smalltalk.Stream);
  3705. smalltalk.addMethod(
  3706. '_skip_',
  3707. smalltalk.method({
  3708. selector: 'skip:',
  3709. category: 'positioning',
  3710. fn: function (anInteger) {
  3711. var self = this;
  3712. self._position_(self._position().__plus(anInteger)._min_max_(self._size(), 0));
  3713. return self;
  3714. },
  3715. 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')}),
  3716. smalltalk.Stream);
  3717. smalltalk.addMethod(
  3718. '_next',
  3719. smalltalk.method({
  3720. selector: 'next',
  3721. category: 'reading',
  3722. fn: function () {
  3723. var self = this;
  3724. self._position_(self._position().__plus(1));
  3725. return self['@collection']._at_(self._position());
  3726. return self;
  3727. },
  3728. source: unescape('next%0A%09self%20position%3A%20self%20position%20+%201.%20%0A%09%5Ecollection%20at%3A%20self%20position%0A')}),
  3729. smalltalk.Stream);
  3730. smalltalk.addMethod(
  3731. '_next_',
  3732. smalltalk.method({
  3733. selector: 'next:',
  3734. category: 'reading',
  3735. fn: function (anInteger) {
  3736. var self = this;
  3737. var tempCollection = nil;
  3738. tempCollection = self._collection()._class()._new();
  3739. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection._add_(self._next());});});
  3740. return tempCollection;
  3741. return self;
  3742. },
  3743. 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')}),
  3744. smalltalk.Stream);
  3745. smalltalk.addMethod(
  3746. '_nextPut_',
  3747. smalltalk.method({
  3748. selector: 'nextPut:',
  3749. category: 'writing',
  3750. fn: function (anObject) {
  3751. var self = this;
  3752. self._position_(self._position().__plus(1));
  3753. self._collection()._at_put_(self._position(), anObject);
  3754. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3755. return self;
  3756. },
  3757. 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')}),
  3758. smalltalk.Stream);
  3759. smalltalk.addMethod(
  3760. '_nextPutAll_',
  3761. smalltalk.method({
  3762. selector: 'nextPutAll:',
  3763. category: 'writing',
  3764. fn: function (aCollection) {
  3765. var self = this;
  3766. aCollection._do_(function (each) {return self._nextPut_(each);});
  3767. return self;
  3768. },
  3769. 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')}),
  3770. smalltalk.Stream);
  3771. smalltalk.addMethod(
  3772. '_peek',
  3773. smalltalk.method({
  3774. selector: 'peek',
  3775. category: 'reading',
  3776. fn: function () {
  3777. var self = this;
  3778. return self._atEnd()._ifFalse_(function () {return self._collection()._at_(self._position().__plus(1));});
  3779. return self;
  3780. },
  3781. 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')}),
  3782. smalltalk.Stream);
  3783. smalltalk.addMethod(
  3784. '_atEnd',
  3785. smalltalk.method({
  3786. selector: 'atEnd',
  3787. category: 'testing',
  3788. fn: function () {
  3789. var self = this;
  3790. return self._position().__eq(self._size());
  3791. return self;
  3792. },
  3793. source: unescape('atEnd%0A%09%5Eself%20position%20%3D%20self%20size%0A')}),
  3794. smalltalk.Stream);
  3795. smalltalk.addMethod(
  3796. '_atStart',
  3797. smalltalk.method({
  3798. selector: 'atStart',
  3799. category: 'testing',
  3800. fn: function () {
  3801. var self = this;
  3802. return self._position().__eq(0);
  3803. return self;
  3804. },
  3805. source: unescape('atStart%0A%09%5Eself%20position%20%3D%200%0A')}),
  3806. smalltalk.Stream);
  3807. smalltalk.addMethod(
  3808. '_isEmpty',
  3809. smalltalk.method({
  3810. selector: 'isEmpty',
  3811. category: 'testing',
  3812. fn: function () {
  3813. var self = this;
  3814. return self._size().__eq(0);
  3815. return self;
  3816. },
  3817. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  3818. smalltalk.Stream);
  3819. smalltalk.addMethod(
  3820. '_on_',
  3821. smalltalk.method({
  3822. selector: 'on:',
  3823. category: 'instance creation',
  3824. fn: function (aCollection) {
  3825. var self = this;
  3826. return function ($rec) {$rec._setCollection_(aCollection);$rec._setStreamSize_(aCollection._size());return $rec._yourself();}(self._new());
  3827. return self;
  3828. },
  3829. 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')}),
  3830. smalltalk.Stream.klass);
  3831. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel');
  3832. smalltalk.addMethod(
  3833. '_next_',
  3834. smalltalk.method({
  3835. selector: 'next:',
  3836. category: 'reading',
  3837. fn: function (anInteger) {
  3838. var self = this;
  3839. var tempCollection = nil;
  3840. tempCollection = self._collection()._class()._new();
  3841. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection = tempCollection.__comma(self._next());});});
  3842. return tempCollection;
  3843. return self;
  3844. },
  3845. 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')}),
  3846. smalltalk.StringStream);
  3847. smalltalk.addMethod(
  3848. '_nextPut_',
  3849. smalltalk.method({
  3850. selector: 'nextPut:',
  3851. category: 'writing',
  3852. fn: function (aString) {
  3853. var self = this;
  3854. self._nextPutAll_(aString);
  3855. return self;
  3856. },
  3857. source: unescape('nextPut%3A%20aString%0A%09self%20nextPutAll%3A%20aString%0A')}),
  3858. smalltalk.StringStream);
  3859. smalltalk.addMethod(
  3860. '_nextPutAll_',
  3861. smalltalk.method({
  3862. selector: 'nextPutAll:',
  3863. category: 'writing',
  3864. fn: function (aString) {
  3865. var self = this;
  3866. 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())));
  3867. self._position_(self._position().__plus(aString._size()));
  3868. self._setStreamSize_(self._streamSize()._max_(self._position()));
  3869. return self;
  3870. },
  3871. 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')}),
  3872. smalltalk.StringStream);
  3873. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel');
  3874. smalltalk.addMethod(
  3875. '_class_',
  3876. smalltalk.method({
  3877. selector: 'class:',
  3878. category: 'accessing',
  3879. fn: function (aClass) {
  3880. var self = this;
  3881. self['@class'] = aClass;
  3882. return self;
  3883. },
  3884. source: unescape('class%3A%20aClass%0A%09class%20%3A%3D%20aClass%0A')}),
  3885. smalltalk.ClassCommentReader);
  3886. smalltalk.addMethod(
  3887. '_scanFrom_',
  3888. smalltalk.method({
  3889. selector: 'scanFrom:',
  3890. category: 'fileIn',
  3891. fn: function (aStream) {
  3892. var self = this;
  3893. var nextChunk = nil;
  3894. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  3895. nextChunk._isEmptyChunk()._ifFalse_(function () {return self._setComment_(nextChunk._contents());});
  3896. return self;
  3897. },
  3898. 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')}),
  3899. smalltalk.ClassCommentReader);
  3900. smalltalk.addMethod(
  3901. '_initialize',
  3902. smalltalk.method({
  3903. selector: 'initialize',
  3904. category: 'initialization',
  3905. fn: function () {
  3906. var self = this;
  3907. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3908. self['@chunkParser'] = smalltalk.ChunkParser._new();
  3909. return self;
  3910. },
  3911. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  3912. smalltalk.ClassCommentReader);
  3913. smalltalk.addMethod(
  3914. '_setComment_',
  3915. smalltalk.method({
  3916. selector: 'setComment:',
  3917. category: 'private',
  3918. fn: function (aString) {
  3919. var self = this;
  3920. self['@class']._comment_(aString);
  3921. return self;
  3922. },
  3923. source: unescape('setComment%3A%20aString%0A%20%20%20%20class%20comment%3A%20aString%0A')}),
  3924. smalltalk.ClassCommentReader);
  3925. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel');
  3926. smalltalk.addMethod(
  3927. '_next',
  3928. smalltalk.method({
  3929. selector: 'next',
  3930. category: 'accessing',
  3931. fn: function () {
  3932. var self = this;
  3933. return function () {return Math.random();}();
  3934. return self;
  3935. },
  3936. source: unescape('next%0A%20%20%20%20%5E%7B%27return%20Math.random%28%29%27%7D%0A')}),
  3937. smalltalk.Random);
  3938. smalltalk.addMethod(
  3939. '_next_',
  3940. smalltalk.method({
  3941. selector: 'next:',
  3942. category: 'accessing',
  3943. fn: function (anInteger) {
  3944. var self = this;
  3945. return (1)._to_collect_(anInteger, function (each) {return self._next();});
  3946. return self;
  3947. },
  3948. 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')}),
  3949. smalltalk.Random);
  3950. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel');
  3951. smalltalk.addMethod(
  3952. '_x',
  3953. smalltalk.method({
  3954. selector: 'x',
  3955. category: 'accessing',
  3956. fn: function () {
  3957. var self = this;
  3958. return self['@x'];
  3959. return self;
  3960. },
  3961. source: unescape('x%0A%09%5Ex')}),
  3962. smalltalk.Point);
  3963. smalltalk.addMethod(
  3964. '_y',
  3965. smalltalk.method({
  3966. selector: 'y',
  3967. category: 'accessing',
  3968. fn: function () {
  3969. var self = this;
  3970. return self['@y'];
  3971. return self;
  3972. },
  3973. source: unescape('y%0A%09%5Ey')}),
  3974. smalltalk.Point);
  3975. smalltalk.addMethod(
  3976. '_y_',
  3977. smalltalk.method({
  3978. selector: 'y:',
  3979. category: 'accessing',
  3980. fn: function (aNumber) {
  3981. var self = this;
  3982. self['@y'] = aNumber;
  3983. return self;
  3984. },
  3985. source: unescape('y%3A%20aNumber%0A%09y%20%3A%3D%20aNumber')}),
  3986. smalltalk.Point);
  3987. smalltalk.addMethod(
  3988. '_x_',
  3989. smalltalk.method({
  3990. selector: 'x:',
  3991. category: 'accessing',
  3992. fn: function (aNumber) {
  3993. var self = this;
  3994. self['@x'] = aNumber;
  3995. return self;
  3996. },
  3997. source: unescape('x%3A%20aNumber%0A%09x%20%3A%3D%20aNumber')}),
  3998. smalltalk.Point);
  3999. smalltalk.addMethod(
  4000. '__star',
  4001. smalltalk.method({
  4002. selector: '*',
  4003. category: 'arithmetic',
  4004. fn: function (aPoint) {
  4005. var self = this;
  4006. return smalltalk.Point._x_y_(self._x().__star(aPoint._asPoint()._x()), self._y().__star(aPoint._asPoint()._y()));
  4007. return self;
  4008. },
  4009. source: unescape('*%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20*%20aPoint%20asPoint%20x%20y%3A%20self%20y%20*%20aPoint%20asPoint%20y')}),
  4010. smalltalk.Point);
  4011. smalltalk.addMethod(
  4012. '__plus',
  4013. smalltalk.method({
  4014. selector: '+',
  4015. category: 'arithmetic',
  4016. fn: function (aPoint) {
  4017. var self = this;
  4018. return smalltalk.Point._x_y_(self._x().__plus(aPoint._asPoint()._x()), self._y().__plus(aPoint._asPoint()._y()));
  4019. return self;
  4020. },
  4021. source: unescape('+%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20+%20aPoint%20asPoint%20x%20y%3A%20self%20y%20+%20aPoint%20asPoint%20y')}),
  4022. smalltalk.Point);
  4023. smalltalk.addMethod(
  4024. '__minus',
  4025. smalltalk.method({
  4026. selector: '-',
  4027. category: 'arithmetic',
  4028. fn: function (aPoint) {
  4029. var self = this;
  4030. return smalltalk.Point._x_y_(self._x().__minus(aPoint._asPoint()._x()), self._y().__minus(aPoint._asPoint()._y()));
  4031. return self;
  4032. },
  4033. source: unescape('-%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20-%20aPoint%20asPoint%20x%20y%3A%20self%20y%20-%20aPoint%20asPoint%20y')}),
  4034. smalltalk.Point);
  4035. smalltalk.addMethod(
  4036. '__slash',
  4037. smalltalk.method({
  4038. selector: '/',
  4039. category: 'arithmetic',
  4040. fn: function (aPoint) {
  4041. var self = this;
  4042. return smalltalk.Point._x_y_(self._x().__slash(aPoint._asPoint()._x()), self._y().__slash(aPoint._asPoint()._y()));
  4043. return self;
  4044. },
  4045. source: unescape('/%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20/%20aPoint%20asPoint%20x%20y%3A%20self%20y%20/%20aPoint%20asPoint%20y')}),
  4046. smalltalk.Point);
  4047. smalltalk.addMethod(
  4048. '_asPoint',
  4049. smalltalk.method({
  4050. selector: 'asPoint',
  4051. category: 'converting',
  4052. fn: function () {
  4053. var self = this;
  4054. return self;
  4055. return self;
  4056. },
  4057. source: unescape('asPoint%0A%09%5Eself')}),
  4058. smalltalk.Point);
  4059. smalltalk.addMethod(
  4060. '_x_y_',
  4061. smalltalk.method({
  4062. selector: 'x:y:',
  4063. category: 'instance creation',
  4064. fn: function (aNumber, anotherNumber) {
  4065. var self = this;
  4066. return function ($rec) {$rec._x_(aNumber);$rec._y_(anotherNumber);return $rec._yourself();}(self._new());
  4067. return self;
  4068. },
  4069. 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')}),
  4070. smalltalk.Point.klass);