Kernel.js 147 KB

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