Kernel.js 145 KB

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