2
0

Kernel.js 167 KB

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