1
0

Kernel.js 166 KB

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