Kernel.js 166 KB

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