Kernel-Collections.js 221 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841
  1. define("amber_core/Kernel-Collections", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Kernel-Collections');
  3. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  5. globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "=",
  9. protocol: 'comparing',
  10. fn: function (anAssociation){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. var $3,$2,$5,$4,$6,$1;
  14. $3=self._class();
  15. $ctx1.sendIdx["class"]=1;
  16. $2=_st($3).__eq(_st(anAssociation)._class());
  17. $ctx1.sendIdx["="]=1;
  18. $1=_st($2)._and_((function(){
  19. return smalltalk.withContext(function($ctx2) {
  20. $5=self._key();
  21. $ctx2.sendIdx["key"]=1;
  22. $4=_st($5).__eq(_st(anAssociation)._key());
  23. $ctx2.sendIdx["="]=2;
  24. return _st($4)._and_((function(){
  25. return smalltalk.withContext(function($ctx3) {
  26. $6=self._value();
  27. $ctx3.sendIdx["value"]=1;
  28. return _st($6).__eq(_st(anAssociation)._value());
  29. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  30. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  31. $ctx1.sendIdx["and:"]=1;
  32. return $1;
  33. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)})},
  34. args: ["anAssociation"],
  35. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  36. messageSends: ["and:", "=", "class", "key", "value"],
  37. referencedClasses: []
  38. }),
  39. globals.Association);
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "key",
  43. protocol: 'accessing',
  44. fn: function (){
  45. var self=this;
  46. var $1;
  47. $1=self["@key"];
  48. return $1;
  49. },
  50. args: [],
  51. source: "key\x0a\x09^ key",
  52. messageSends: [],
  53. referencedClasses: []
  54. }),
  55. globals.Association);
  56. smalltalk.addMethod(
  57. smalltalk.method({
  58. selector: "key:",
  59. protocol: 'accessing',
  60. fn: function (aKey){
  61. var self=this;
  62. self["@key"]=aKey;
  63. return self},
  64. args: ["aKey"],
  65. source: "key: aKey\x0a\x09key := aKey",
  66. messageSends: [],
  67. referencedClasses: []
  68. }),
  69. globals.Association);
  70. smalltalk.addMethod(
  71. smalltalk.method({
  72. selector: "printOn:",
  73. protocol: 'printing',
  74. fn: function (aStream){
  75. var self=this;
  76. return smalltalk.withContext(function($ctx1) {
  77. _st(self._key())._printOn_(aStream);
  78. $ctx1.sendIdx["printOn:"]=1;
  79. _st(aStream)._nextPutAll_(" -> ");
  80. _st(self._value())._printOn_(aStream);
  81. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)})},
  82. args: ["aStream"],
  83. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  84. messageSends: ["printOn:", "key", "nextPutAll:", "value"],
  85. referencedClasses: []
  86. }),
  87. globals.Association);
  88. smalltalk.addMethod(
  89. smalltalk.method({
  90. selector: "value",
  91. protocol: 'accessing',
  92. fn: function (){
  93. var self=this;
  94. var $1;
  95. $1=self["@value"];
  96. return $1;
  97. },
  98. args: [],
  99. source: "value\x0a\x09^ value",
  100. messageSends: [],
  101. referencedClasses: []
  102. }),
  103. globals.Association);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "value:",
  107. protocol: 'accessing',
  108. fn: function (aValue){
  109. var self=this;
  110. self["@value"]=aValue;
  111. return self},
  112. args: ["aValue"],
  113. source: "value: aValue\x0a\x09value := aValue",
  114. messageSends: [],
  115. referencedClasses: []
  116. }),
  117. globals.Association);
  118. smalltalk.addMethod(
  119. smalltalk.method({
  120. selector: "key:value:",
  121. protocol: 'instance creation',
  122. fn: function (aKey,aValue){
  123. var self=this;
  124. return smalltalk.withContext(function($ctx1) {
  125. var $2,$3,$1;
  126. $2=self._new();
  127. _st($2)._key_(aKey);
  128. _st($2)._value_(aValue);
  129. $3=_st($2)._yourself();
  130. $1=$3;
  131. return $1;
  132. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)})},
  133. args: ["aKey", "aValue"],
  134. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  135. messageSends: ["key:", "new", "value:", "yourself"],
  136. referencedClasses: []
  137. }),
  138. globals.Association.klass);
  139. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  140. globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  141. smalltalk.addMethod(
  142. smalltalk.method({
  143. selector: "bucketOfElement:",
  144. protocol: 'accessing',
  145. fn: function (anObject){
  146. var self=this;
  147. return smalltalk.withContext(function($ctx1) {
  148. var hash = self['@hashBlock'](anObject);
  149. if (!hash) return null;
  150. var buckets = self['@buckets'],
  151. bucket = buckets[hash];
  152. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  153. return bucket;
  154. ;
  155. return self}, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)})},
  156. args: ["anObject"],
  157. source: "bucketOfElement: anObject\x0a\x09<\x0a\x09\x09var hash = self['@hashBlock'](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = self['@buckets'],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09>",
  158. messageSends: [],
  159. referencedClasses: []
  160. }),
  161. globals.BucketStore);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "do:",
  165. protocol: 'enumerating',
  166. fn: function (aBlock){
  167. var self=this;
  168. return smalltalk.withContext(function($ctx1) {
  169. var buckets = self['@buckets'];
  170. var keys = Object.keys(buckets);
  171. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  172. ;
  173. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)})},
  174. args: ["aBlock"],
  175. source: "do: aBlock\x0a\x09<\x0a\x09\x09var buckets = self['@buckets'];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09>",
  176. messageSends: [],
  177. referencedClasses: []
  178. }),
  179. globals.BucketStore);
  180. smalltalk.addMethod(
  181. smalltalk.method({
  182. selector: "hashBlock:",
  183. protocol: 'accessing',
  184. fn: function (aBlock){
  185. var self=this;
  186. self["@hashBlock"]=aBlock;
  187. return self},
  188. args: ["aBlock"],
  189. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  190. messageSends: [],
  191. referencedClasses: []
  192. }),
  193. globals.BucketStore);
  194. smalltalk.addMethod(
  195. smalltalk.method({
  196. selector: "initialize",
  197. protocol: 'initialization',
  198. fn: function (){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx1) {
  201. globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []);
  202. self._removeAll();
  203. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)})},
  204. args: [],
  205. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  206. messageSends: ["initialize", "removeAll"],
  207. referencedClasses: []
  208. }),
  209. globals.BucketStore);
  210. smalltalk.addMethod(
  211. smalltalk.method({
  212. selector: "newBucket",
  213. protocol: 'private',
  214. fn: function (){
  215. var self=this;
  216. return smalltalk.withContext(function($ctx1) {
  217. self._subclassResponsibility();
  218. return self}, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)})},
  219. args: [],
  220. source: "newBucket\x0a\x09self subclassResponsibility",
  221. messageSends: ["subclassResponsibility"],
  222. referencedClasses: []
  223. }),
  224. globals.BucketStore);
  225. smalltalk.addMethod(
  226. smalltalk.method({
  227. selector: "removeAll",
  228. protocol: 'adding/removing',
  229. fn: function (){
  230. var self=this;
  231. return smalltalk.withContext(function($ctx1) {
  232. self['@buckets'] = Object.create(null);;
  233. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)})},
  234. args: [],
  235. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  236. messageSends: [],
  237. referencedClasses: []
  238. }),
  239. globals.BucketStore);
  240. smalltalk.addMethod(
  241. smalltalk.method({
  242. selector: "hashBlock:",
  243. protocol: 'instance creation',
  244. fn: function (aBlock){
  245. var self=this;
  246. return smalltalk.withContext(function($ctx1) {
  247. var $2,$3,$1;
  248. $2=self._new();
  249. _st($2)._hashBlock_(aBlock);
  250. $3=_st($2)._yourself();
  251. $1=$3;
  252. return $1;
  253. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)})},
  254. args: ["aBlock"],
  255. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  256. messageSends: ["hashBlock:", "new", "yourself"],
  257. referencedClasses: []
  258. }),
  259. globals.BucketStore.klass);
  260. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  261. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  262. smalltalk.addMethod(
  263. smalltalk.method({
  264. selector: "newBucket",
  265. protocol: 'private',
  266. fn: function (){
  267. var self=this;
  268. var $1;
  269. $1=[];
  270. return $1;
  271. },
  272. args: [],
  273. source: "newBucket\x0a\x09^ #()",
  274. messageSends: [],
  275. referencedClasses: []
  276. }),
  277. globals.ArrayBucketStore);
  278. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  279. globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  280. smalltalk.addMethod(
  281. smalltalk.method({
  282. selector: ",",
  283. protocol: 'copying',
  284. fn: function (aCollection){
  285. var self=this;
  286. return smalltalk.withContext(function($ctx1) {
  287. var $2,$3,$1;
  288. $2=self._copy();
  289. _st($2)._addAll_(aCollection);
  290. $3=_st($2)._yourself();
  291. $1=$3;
  292. return $1;
  293. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)})},
  294. args: ["aCollection"],
  295. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  296. messageSends: ["addAll:", "copy", "yourself"],
  297. referencedClasses: []
  298. }),
  299. globals.Collection);
  300. smalltalk.addMethod(
  301. smalltalk.method({
  302. selector: "add:",
  303. protocol: 'adding/removing',
  304. fn: function (anObject){
  305. var self=this;
  306. return smalltalk.withContext(function($ctx1) {
  307. self._subclassResponsibility();
  308. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)})},
  309. args: ["anObject"],
  310. source: "add: anObject\x0a\x09self subclassResponsibility",
  311. messageSends: ["subclassResponsibility"],
  312. referencedClasses: []
  313. }),
  314. globals.Collection);
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "addAll:",
  318. protocol: 'adding/removing',
  319. fn: function (aCollection){
  320. var self=this;
  321. return smalltalk.withContext(function($ctx1) {
  322. _st(aCollection)._do_((function(each){
  323. return smalltalk.withContext(function($ctx2) {
  324. return self._add_(each);
  325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  326. return aCollection;
  327. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)})},
  328. args: ["aCollection"],
  329. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  330. messageSends: ["do:", "add:"],
  331. referencedClasses: []
  332. }),
  333. globals.Collection);
  334. smalltalk.addMethod(
  335. smalltalk.method({
  336. selector: "allSatisfy:",
  337. protocol: 'enumerating',
  338. fn: function (aBlock){
  339. var self=this;
  340. return smalltalk.withContext(function($ctx1) {
  341. var $1;
  342. var $early={};
  343. try {
  344. self._do_((function(each){
  345. return smalltalk.withContext(function($ctx2) {
  346. $1=_st(aBlock)._value_(each);
  347. if(! smalltalk.assert($1)){
  348. throw $early=[false];
  349. };
  350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  351. return true;
  352. }
  353. catch(e) {if(e===$early)return e[0]; throw e}
  354. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)})},
  355. args: ["aBlock"],
  356. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  357. messageSends: ["do:", "ifFalse:", "value:"],
  358. referencedClasses: []
  359. }),
  360. globals.Collection);
  361. smalltalk.addMethod(
  362. smalltalk.method({
  363. selector: "anyOne",
  364. protocol: 'adding/removing',
  365. fn: function (){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) {
  368. var $early={};
  369. try {
  370. self._ifEmpty_((function(){
  371. return smalltalk.withContext(function($ctx2) {
  372. return self._error_("Collection is empty");
  373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  374. self._do_((function(each){
  375. throw $early=[each];
  376. }));
  377. return self}
  378. catch(e) {if(e===$early)return e[0]; throw e}
  379. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)})},
  380. args: [],
  381. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  382. messageSends: ["ifEmpty:", "error:", "do:"],
  383. referencedClasses: []
  384. }),
  385. globals.Collection);
  386. smalltalk.addMethod(
  387. smalltalk.method({
  388. selector: "anySatisfy:",
  389. protocol: 'enumerating',
  390. fn: function (aBlock){
  391. var self=this;
  392. return smalltalk.withContext(function($ctx1) {
  393. var $1;
  394. var $early={};
  395. try {
  396. self._do_((function(each){
  397. return smalltalk.withContext(function($ctx2) {
  398. $1=_st(aBlock)._value_(each);
  399. if(smalltalk.assert($1)){
  400. throw $early=[true];
  401. };
  402. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  403. return false;
  404. }
  405. catch(e) {if(e===$early)return e[0]; throw e}
  406. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)})},
  407. args: ["aBlock"],
  408. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  409. messageSends: ["do:", "ifTrue:", "value:"],
  410. referencedClasses: []
  411. }),
  412. globals.Collection);
  413. smalltalk.addMethod(
  414. smalltalk.method({
  415. selector: "asArray",
  416. protocol: 'converting',
  417. fn: function (){
  418. var self=this;
  419. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. $1=_st($Array())._withAll_(self);
  423. return $1;
  424. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)})},
  425. args: [],
  426. source: "asArray\x0a\x09^ Array withAll: self",
  427. messageSends: ["withAll:"],
  428. referencedClasses: ["Array"]
  429. }),
  430. globals.Collection);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "asJSON",
  434. protocol: 'converting',
  435. fn: function (){
  436. var self=this;
  437. return smalltalk.withContext(function($ctx1) {
  438. var $1;
  439. $1=_st(self._asArray())._collect_((function(each){
  440. return smalltalk.withContext(function($ctx2) {
  441. return _st(each)._asJSON();
  442. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  443. return $1;
  444. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)})},
  445. args: [],
  446. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  447. messageSends: ["collect:", "asArray", "asJSON"],
  448. referencedClasses: []
  449. }),
  450. globals.Collection);
  451. smalltalk.addMethod(
  452. smalltalk.method({
  453. selector: "asOrderedCollection",
  454. protocol: 'converting',
  455. fn: function (){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) {
  458. var $1;
  459. $1=self._asArray();
  460. return $1;
  461. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)})},
  462. args: [],
  463. source: "asOrderedCollection\x0a\x09^ self asArray",
  464. messageSends: ["asArray"],
  465. referencedClasses: []
  466. }),
  467. globals.Collection);
  468. smalltalk.addMethod(
  469. smalltalk.method({
  470. selector: "asSet",
  471. protocol: 'converting',
  472. fn: function (){
  473. var self=this;
  474. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  475. return smalltalk.withContext(function($ctx1) {
  476. var $1;
  477. $1=_st($Set())._withAll_(self);
  478. return $1;
  479. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)})},
  480. args: [],
  481. source: "asSet\x0a\x09^ Set withAll: self",
  482. messageSends: ["withAll:"],
  483. referencedClasses: ["Set"]
  484. }),
  485. globals.Collection);
  486. smalltalk.addMethod(
  487. smalltalk.method({
  488. selector: "collect:",
  489. protocol: 'enumerating',
  490. fn: function (aBlock){
  491. var self=this;
  492. var stream;
  493. return smalltalk.withContext(function($ctx1) {
  494. var $1;
  495. stream=_st(_st(self._class())._new())._writeStream();
  496. self._do_((function(each){
  497. return smalltalk.withContext(function($ctx2) {
  498. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  499. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  500. $1=_st(stream)._contents();
  501. return $1;
  502. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  503. args: ["aBlock"],
  504. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  505. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  506. referencedClasses: []
  507. }),
  508. globals.Collection);
  509. smalltalk.addMethod(
  510. smalltalk.method({
  511. selector: "contains:",
  512. protocol: 'testing',
  513. fn: function (aBlock){
  514. var self=this;
  515. return smalltalk.withContext(function($ctx1) {
  516. var $1;
  517. self._deprecatedAPI();
  518. $1=self._anySatisfy_(aBlock);
  519. return $1;
  520. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)})},
  521. args: ["aBlock"],
  522. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  523. messageSends: ["deprecatedAPI", "anySatisfy:"],
  524. referencedClasses: []
  525. }),
  526. globals.Collection);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "copyWith:",
  530. protocol: 'copying',
  531. fn: function (anObject){
  532. var self=this;
  533. return smalltalk.withContext(function($ctx1) {
  534. var $2,$3,$1;
  535. $2=self._copy();
  536. _st($2)._add_(anObject);
  537. $3=_st($2)._yourself();
  538. $1=$3;
  539. return $1;
  540. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)})},
  541. args: ["anObject"],
  542. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  543. messageSends: ["add:", "copy", "yourself"],
  544. referencedClasses: []
  545. }),
  546. globals.Collection);
  547. smalltalk.addMethod(
  548. smalltalk.method({
  549. selector: "copyWithAll:",
  550. protocol: 'copying',
  551. fn: function (aCollection){
  552. var self=this;
  553. return smalltalk.withContext(function($ctx1) {
  554. var $2,$3,$1;
  555. $2=self._copy();
  556. _st($2)._addAll_(aCollection);
  557. $3=_st($2)._yourself();
  558. $1=$3;
  559. return $1;
  560. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)})},
  561. args: ["aCollection"],
  562. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  563. messageSends: ["addAll:", "copy", "yourself"],
  564. referencedClasses: []
  565. }),
  566. globals.Collection);
  567. smalltalk.addMethod(
  568. smalltalk.method({
  569. selector: "copyWithoutAll:",
  570. protocol: 'copying',
  571. fn: function (aCollection){
  572. var self=this;
  573. return smalltalk.withContext(function($ctx1) {
  574. var $1;
  575. $1=self._reject_((function(each){
  576. return smalltalk.withContext(function($ctx2) {
  577. return _st(aCollection)._includes_(each);
  578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  579. return $1;
  580. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)})},
  581. args: ["aCollection"],
  582. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  583. messageSends: ["reject:", "includes:"],
  584. referencedClasses: []
  585. }),
  586. globals.Collection);
  587. smalltalk.addMethod(
  588. smalltalk.method({
  589. selector: "detect:",
  590. protocol: 'enumerating',
  591. fn: function (aBlock){
  592. var self=this;
  593. return smalltalk.withContext(function($ctx1) {
  594. var $1;
  595. $1=self._detect_ifNone_(aBlock,(function(){
  596. return smalltalk.withContext(function($ctx2) {
  597. return self._errorNotFound();
  598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  599. return $1;
  600. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)})},
  601. args: ["aBlock"],
  602. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  603. messageSends: ["detect:ifNone:", "errorNotFound"],
  604. referencedClasses: []
  605. }),
  606. globals.Collection);
  607. smalltalk.addMethod(
  608. smalltalk.method({
  609. selector: "detect:ifNone:",
  610. protocol: 'enumerating',
  611. fn: function (aBlock,anotherBlock){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) {
  614. self._subclassResponsibility();
  615. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  616. args: ["aBlock", "anotherBlock"],
  617. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  618. messageSends: ["subclassResponsibility"],
  619. referencedClasses: []
  620. }),
  621. globals.Collection);
  622. smalltalk.addMethod(
  623. smalltalk.method({
  624. selector: "do:",
  625. protocol: 'enumerating',
  626. fn: function (aBlock){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) {
  629. self._subclassResponsibility();
  630. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)})},
  631. args: ["aBlock"],
  632. source: "do: aBlock\x0a\x09self subclassResponsibility",
  633. messageSends: ["subclassResponsibility"],
  634. referencedClasses: []
  635. }),
  636. globals.Collection);
  637. smalltalk.addMethod(
  638. smalltalk.method({
  639. selector: "do:separatedBy:",
  640. protocol: 'enumerating',
  641. fn: function (aBlock,anotherBlock){
  642. var self=this;
  643. var actionBeforeElement;
  644. return smalltalk.withContext(function($ctx1) {
  645. actionBeforeElement=(function(){
  646. actionBeforeElement=anotherBlock;
  647. return actionBeforeElement;
  648. });
  649. self._do_((function(each){
  650. return smalltalk.withContext(function($ctx2) {
  651. _st(actionBeforeElement)._value();
  652. return _st(aBlock)._value_(each);
  653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  654. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)})},
  655. args: ["aBlock", "anotherBlock"],
  656. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  657. messageSends: ["do:", "value", "value:"],
  658. referencedClasses: []
  659. }),
  660. globals.Collection);
  661. smalltalk.addMethod(
  662. smalltalk.method({
  663. selector: "errorNotFound",
  664. protocol: 'error handling',
  665. fn: function (){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. self._error_("Object is not in the collection");
  669. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)})},
  670. args: [],
  671. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  672. messageSends: ["error:"],
  673. referencedClasses: []
  674. }),
  675. globals.Collection);
  676. smalltalk.addMethod(
  677. smalltalk.method({
  678. selector: "ifEmpty:",
  679. protocol: 'testing',
  680. fn: function (aBlock){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) {
  683. var $2,$1;
  684. $2=self._isEmpty();
  685. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  686. return self;
  687. }));
  688. return $1;
  689. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)})},
  690. args: ["aBlock"],
  691. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  692. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  693. referencedClasses: []
  694. }),
  695. globals.Collection);
  696. smalltalk.addMethod(
  697. smalltalk.method({
  698. selector: "ifEmpty:ifNotEmpty:",
  699. protocol: 'testing',
  700. fn: function (aBlock,anotherBlock){
  701. var self=this;
  702. return smalltalk.withContext(function($ctx1) {
  703. var $2,$1;
  704. $2=self._isEmpty();
  705. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  706. return $1;
  707. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  708. args: ["aBlock", "anotherBlock"],
  709. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  710. messageSends: ["ifTrue:ifFalse:", "isEmpty"],
  711. referencedClasses: []
  712. }),
  713. globals.Collection);
  714. smalltalk.addMethod(
  715. smalltalk.method({
  716. selector: "ifNotEmpty:",
  717. protocol: 'testing',
  718. fn: function (aBlock){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) {
  721. var $2,$1;
  722. $2=self._notEmpty();
  723. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  724. return self;
  725. }));
  726. return $1;
  727. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)})},
  728. args: ["aBlock"],
  729. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ self ]",
  730. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  731. referencedClasses: []
  732. }),
  733. globals.Collection);
  734. smalltalk.addMethod(
  735. smalltalk.method({
  736. selector: "ifNotEmpty:ifEmpty:",
  737. protocol: 'testing',
  738. fn: function (aBlock,anotherBlock){
  739. var self=this;
  740. return smalltalk.withContext(function($ctx1) {
  741. var $2,$1;
  742. $2=self._notEmpty();
  743. $1=_st($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  744. return $1;
  745. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)})},
  746. args: ["aBlock", "anotherBlock"],
  747. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: anotherBlock",
  748. messageSends: ["ifTrue:ifFalse:", "notEmpty"],
  749. referencedClasses: []
  750. }),
  751. globals.Collection);
  752. smalltalk.addMethod(
  753. smalltalk.method({
  754. selector: "includes:",
  755. protocol: 'testing',
  756. fn: function (anObject){
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) {
  759. var $1;
  760. $1=self._anySatisfy_((function(each){
  761. return smalltalk.withContext(function($ctx2) {
  762. return _st(each).__eq(anObject);
  763. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  764. return $1;
  765. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)})},
  766. args: ["anObject"],
  767. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  768. messageSends: ["anySatisfy:", "="],
  769. referencedClasses: []
  770. }),
  771. globals.Collection);
  772. smalltalk.addMethod(
  773. smalltalk.method({
  774. selector: "inject:into:",
  775. protocol: 'enumerating',
  776. fn: function (anObject,aBlock){
  777. var self=this;
  778. var result;
  779. return smalltalk.withContext(function($ctx1) {
  780. var $1;
  781. result=anObject;
  782. self._do_((function(each){
  783. return smalltalk.withContext(function($ctx2) {
  784. result=_st(aBlock)._value_value_(result,each);
  785. return result;
  786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  787. $1=result;
  788. return $1;
  789. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)})},
  790. args: ["anObject", "aBlock"],
  791. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  792. messageSends: ["do:", "value:value:"],
  793. referencedClasses: []
  794. }),
  795. globals.Collection);
  796. smalltalk.addMethod(
  797. smalltalk.method({
  798. selector: "intersection:",
  799. protocol: 'enumerating',
  800. fn: function (aCollection){
  801. var self=this;
  802. var set,outputSet;
  803. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  804. return smalltalk.withContext(function($ctx1) {
  805. var $2,$1,$3;
  806. set=self._asSet();
  807. outputSet=_st($Set())._new();
  808. _st(aCollection)._do_((function(each){
  809. return smalltalk.withContext(function($ctx2) {
  810. $2=_st(set)._includes_(each);
  811. $ctx2.sendIdx["includes:"]=1;
  812. $1=_st($2)._and_((function(){
  813. return smalltalk.withContext(function($ctx3) {
  814. return _st(_st(outputSet)._includes_(each))._not();
  815. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  816. if(smalltalk.assert($1)){
  817. return _st(outputSet)._add_(each);
  818. };
  819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  820. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  821. return $3;
  822. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)})},
  823. args: ["aCollection"],
  824. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  825. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"],
  826. referencedClasses: ["Set"]
  827. }),
  828. globals.Collection);
  829. smalltalk.addMethod(
  830. smalltalk.method({
  831. selector: "isEmpty",
  832. protocol: 'testing',
  833. fn: function (){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) {
  836. var $1;
  837. $1=_st(self._size()).__eq((0));
  838. return $1;
  839. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)})},
  840. args: [],
  841. source: "isEmpty\x0a\x09^ self size = 0",
  842. messageSends: ["=", "size"],
  843. referencedClasses: []
  844. }),
  845. globals.Collection);
  846. smalltalk.addMethod(
  847. smalltalk.method({
  848. selector: "noneSatisfy:",
  849. protocol: 'enumerating',
  850. fn: function (aBlock){
  851. var self=this;
  852. return smalltalk.withContext(function($ctx1) {
  853. var $1;
  854. var $early={};
  855. try {
  856. self._do_((function(item){
  857. return smalltalk.withContext(function($ctx2) {
  858. $1=_st(aBlock)._value_(item);
  859. if(smalltalk.assert($1)){
  860. throw $early=[false];
  861. };
  862. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)})}));
  863. return true;
  864. }
  865. catch(e) {if(e===$early)return e[0]; throw e}
  866. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)})},
  867. args: ["aBlock"],
  868. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  869. messageSends: ["do:", "ifTrue:", "value:"],
  870. referencedClasses: []
  871. }),
  872. globals.Collection);
  873. smalltalk.addMethod(
  874. smalltalk.method({
  875. selector: "notEmpty",
  876. protocol: 'testing',
  877. fn: function (){
  878. var self=this;
  879. return smalltalk.withContext(function($ctx1) {
  880. var $1;
  881. $1=_st(self._isEmpty())._not();
  882. return $1;
  883. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)})},
  884. args: [],
  885. source: "notEmpty\x0a\x09^ self isEmpty not",
  886. messageSends: ["not", "isEmpty"],
  887. referencedClasses: []
  888. }),
  889. globals.Collection);
  890. smalltalk.addMethod(
  891. smalltalk.method({
  892. selector: "occurrencesOf:",
  893. protocol: 'accessing',
  894. fn: function (anObject){
  895. var self=this;
  896. var tally;
  897. return smalltalk.withContext(function($ctx1) {
  898. var $1,$2;
  899. tally=(0);
  900. self._do_((function(each){
  901. return smalltalk.withContext(function($ctx2) {
  902. $1=_st(anObject).__eq(each);
  903. if(smalltalk.assert($1)){
  904. tally=_st(tally).__plus((1));
  905. return tally;
  906. };
  907. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  908. $2=tally;
  909. return $2;
  910. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)})},
  911. args: ["anObject"],
  912. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  913. messageSends: ["do:", "ifTrue:", "=", "+"],
  914. referencedClasses: []
  915. }),
  916. globals.Collection);
  917. smalltalk.addMethod(
  918. smalltalk.method({
  919. selector: "putOn:",
  920. protocol: 'streaming',
  921. fn: function (aStream){
  922. var self=this;
  923. return smalltalk.withContext(function($ctx1) {
  924. self._do_((function(each){
  925. return smalltalk.withContext(function($ctx2) {
  926. return _st(each)._putOn_(aStream);
  927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  928. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)})},
  929. args: ["aStream"],
  930. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  931. messageSends: ["do:", "putOn:"],
  932. referencedClasses: []
  933. }),
  934. globals.Collection);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "reject:",
  938. protocol: 'enumerating',
  939. fn: function (aBlock){
  940. var self=this;
  941. return smalltalk.withContext(function($ctx1) {
  942. var $1;
  943. $1=self._select_((function(each){
  944. return smalltalk.withContext(function($ctx2) {
  945. return _st(_st(aBlock)._value_(each)).__eq(false);
  946. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  947. return $1;
  948. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)})},
  949. args: ["aBlock"],
  950. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  951. messageSends: ["select:", "=", "value:"],
  952. referencedClasses: []
  953. }),
  954. globals.Collection);
  955. smalltalk.addMethod(
  956. smalltalk.method({
  957. selector: "remove:",
  958. protocol: 'adding/removing',
  959. fn: function (anObject){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) {
  962. var $1;
  963. $1=self._remove_ifAbsent_(anObject,(function(){
  964. return smalltalk.withContext(function($ctx2) {
  965. return self._errorNotFound();
  966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  967. return $1;
  968. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)})},
  969. args: ["anObject"],
  970. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  971. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  972. referencedClasses: []
  973. }),
  974. globals.Collection);
  975. smalltalk.addMethod(
  976. smalltalk.method({
  977. selector: "remove:ifAbsent:",
  978. protocol: 'adding/removing',
  979. fn: function (anObject,aBlock){
  980. var self=this;
  981. return smalltalk.withContext(function($ctx1) {
  982. self._subclassResponsibility();
  983. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)})},
  984. args: ["anObject", "aBlock"],
  985. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  986. messageSends: ["subclassResponsibility"],
  987. referencedClasses: []
  988. }),
  989. globals.Collection);
  990. smalltalk.addMethod(
  991. smalltalk.method({
  992. selector: "removeAll",
  993. protocol: 'adding/removing',
  994. fn: function (){
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) {
  997. self._subclassResponsibility();
  998. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)})},
  999. args: [],
  1000. source: "removeAll\x0a\x09self subclassResponsibility",
  1001. messageSends: ["subclassResponsibility"],
  1002. referencedClasses: []
  1003. }),
  1004. globals.Collection);
  1005. smalltalk.addMethod(
  1006. smalltalk.method({
  1007. selector: "select:",
  1008. protocol: 'enumerating',
  1009. fn: function (aBlock){
  1010. var self=this;
  1011. var stream;
  1012. return smalltalk.withContext(function($ctx1) {
  1013. var $1,$2;
  1014. stream=_st(_st(self._class())._new())._writeStream();
  1015. self._do_((function(each){
  1016. return smalltalk.withContext(function($ctx2) {
  1017. $1=_st(aBlock)._value_(each);
  1018. if(smalltalk.assert($1)){
  1019. return _st(stream)._nextPut_(each);
  1020. };
  1021. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1022. $2=_st(stream)._contents();
  1023. return $2;
  1024. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)})},
  1025. args: ["aBlock"],
  1026. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  1027. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  1028. referencedClasses: []
  1029. }),
  1030. globals.Collection);
  1031. smalltalk.addMethod(
  1032. smalltalk.method({
  1033. selector: "select:thenCollect:",
  1034. protocol: 'enumerating',
  1035. fn: function (selectBlock,collectBlock){
  1036. var self=this;
  1037. var stream;
  1038. return smalltalk.withContext(function($ctx1) {
  1039. var $1,$2;
  1040. stream=_st(_st(self._class())._new())._writeStream();
  1041. self._do_((function(each){
  1042. return smalltalk.withContext(function($ctx2) {
  1043. $1=_st(selectBlock)._value_(each);
  1044. $ctx2.sendIdx["value:"]=1;
  1045. if(smalltalk.assert($1)){
  1046. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  1047. };
  1048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1049. $2=_st(stream)._contents();
  1050. return $2;
  1051. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)})},
  1052. args: ["selectBlock", "collectBlock"],
  1053. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  1054. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"],
  1055. referencedClasses: []
  1056. }),
  1057. globals.Collection);
  1058. smalltalk.addMethod(
  1059. smalltalk.method({
  1060. selector: "size",
  1061. protocol: 'accessing',
  1062. fn: function (){
  1063. var self=this;
  1064. return smalltalk.withContext(function($ctx1) {
  1065. self._subclassResponsibility();
  1066. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)})},
  1067. args: [],
  1068. source: "size\x0a\x09self subclassResponsibility",
  1069. messageSends: ["subclassResponsibility"],
  1070. referencedClasses: []
  1071. }),
  1072. globals.Collection);
  1073. smalltalk.addMethod(
  1074. smalltalk.method({
  1075. selector: "heliosClass",
  1076. protocol: 'helios',
  1077. fn: function (){
  1078. var self=this;
  1079. return "collection";
  1080. },
  1081. args: [],
  1082. source: "heliosClass\x0a\x09^ 'collection'",
  1083. messageSends: [],
  1084. referencedClasses: []
  1085. }),
  1086. globals.Collection.klass);
  1087. smalltalk.addMethod(
  1088. smalltalk.method({
  1089. selector: "new:",
  1090. protocol: 'instance creation',
  1091. fn: function (anInteger){
  1092. var self=this;
  1093. return smalltalk.withContext(function($ctx1) {
  1094. var $1;
  1095. $1=self._new();
  1096. return $1;
  1097. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)})},
  1098. args: ["anInteger"],
  1099. source: "new: anInteger\x0a\x09^ self new",
  1100. messageSends: ["new"],
  1101. referencedClasses: []
  1102. }),
  1103. globals.Collection.klass);
  1104. smalltalk.addMethod(
  1105. smalltalk.method({
  1106. selector: "with:",
  1107. protocol: 'instance creation',
  1108. fn: function (anObject){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) {
  1111. var $2,$3,$1;
  1112. $2=self._new();
  1113. _st($2)._add_(anObject);
  1114. $3=_st($2)._yourself();
  1115. $1=$3;
  1116. return $1;
  1117. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)})},
  1118. args: ["anObject"],
  1119. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1120. messageSends: ["add:", "new", "yourself"],
  1121. referencedClasses: []
  1122. }),
  1123. globals.Collection.klass);
  1124. smalltalk.addMethod(
  1125. smalltalk.method({
  1126. selector: "with:with:",
  1127. protocol: 'instance creation',
  1128. fn: function (anObject,anotherObject){
  1129. var self=this;
  1130. return smalltalk.withContext(function($ctx1) {
  1131. var $2,$3,$1;
  1132. $2=self._new();
  1133. _st($2)._add_(anObject);
  1134. $ctx1.sendIdx["add:"]=1;
  1135. _st($2)._add_(anotherObject);
  1136. $3=_st($2)._yourself();
  1137. $1=$3;
  1138. return $1;
  1139. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)})},
  1140. args: ["anObject", "anotherObject"],
  1141. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1142. messageSends: ["add:", "new", "yourself"],
  1143. referencedClasses: []
  1144. }),
  1145. globals.Collection.klass);
  1146. smalltalk.addMethod(
  1147. smalltalk.method({
  1148. selector: "with:with:with:",
  1149. protocol: 'instance creation',
  1150. fn: function (firstObject,secondObject,thirdObject){
  1151. var self=this;
  1152. return smalltalk.withContext(function($ctx1) {
  1153. var $2,$3,$1;
  1154. $2=self._new();
  1155. _st($2)._add_(firstObject);
  1156. $ctx1.sendIdx["add:"]=1;
  1157. _st($2)._add_(secondObject);
  1158. $ctx1.sendIdx["add:"]=2;
  1159. _st($2)._add_(thirdObject);
  1160. $3=_st($2)._yourself();
  1161. $1=$3;
  1162. return $1;
  1163. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)})},
  1164. args: ["firstObject", "secondObject", "thirdObject"],
  1165. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  1166. messageSends: ["add:", "new", "yourself"],
  1167. referencedClasses: []
  1168. }),
  1169. globals.Collection.klass);
  1170. smalltalk.addMethod(
  1171. smalltalk.method({
  1172. selector: "withAll:",
  1173. protocol: 'instance creation',
  1174. fn: function (aCollection){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) {
  1177. var $2,$3,$1;
  1178. $2=self._new();
  1179. _st($2)._addAll_(aCollection);
  1180. $3=_st($2)._yourself();
  1181. $1=$3;
  1182. return $1;
  1183. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)})},
  1184. args: ["aCollection"],
  1185. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1186. messageSends: ["addAll:", "new", "yourself"],
  1187. referencedClasses: []
  1188. }),
  1189. globals.Collection.klass);
  1190. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  1191. globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1192. smalltalk.addMethod(
  1193. smalltalk.method({
  1194. selector: "at:",
  1195. protocol: 'accessing',
  1196. fn: function (anIndex){
  1197. var self=this;
  1198. return smalltalk.withContext(function($ctx1) {
  1199. var $1;
  1200. $1=self._at_ifAbsent_(anIndex,(function(){
  1201. return smalltalk.withContext(function($ctx2) {
  1202. return self._errorNotFound();
  1203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1204. return $1;
  1205. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)})},
  1206. args: ["anIndex"],
  1207. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  1208. messageSends: ["at:ifAbsent:", "errorNotFound"],
  1209. referencedClasses: []
  1210. }),
  1211. globals.IndexableCollection);
  1212. smalltalk.addMethod(
  1213. smalltalk.method({
  1214. selector: "at:ifAbsent:",
  1215. protocol: 'accessing',
  1216. fn: function (anIndex,aBlock){
  1217. var self=this;
  1218. return smalltalk.withContext(function($ctx1) {
  1219. self._subclassResponsibility();
  1220. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  1221. args: ["anIndex", "aBlock"],
  1222. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1223. messageSends: ["subclassResponsibility"],
  1224. referencedClasses: []
  1225. }),
  1226. globals.IndexableCollection);
  1227. smalltalk.addMethod(
  1228. smalltalk.method({
  1229. selector: "at:ifAbsentPut:",
  1230. protocol: 'accessing',
  1231. fn: function (aKey,aBlock){
  1232. var self=this;
  1233. return smalltalk.withContext(function($ctx1) {
  1234. var $1;
  1235. $1=self._at_ifAbsent_(aKey,(function(){
  1236. return smalltalk.withContext(function($ctx2) {
  1237. return self._at_put_(aKey,_st(aBlock)._value());
  1238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1239. return $1;
  1240. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)})},
  1241. args: ["aKey", "aBlock"],
  1242. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1243. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  1244. referencedClasses: []
  1245. }),
  1246. globals.IndexableCollection);
  1247. smalltalk.addMethod(
  1248. smalltalk.method({
  1249. selector: "at:ifPresent:",
  1250. protocol: 'accessing',
  1251. fn: function (anIndex,aBlock){
  1252. var self=this;
  1253. return smalltalk.withContext(function($ctx1) {
  1254. var $1;
  1255. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1256. return nil;
  1257. }));
  1258. return $1;
  1259. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)})},
  1260. args: ["anIndex", "aBlock"],
  1261. source: "at: anIndex ifPresent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer nil.\x22\x0a\x0a\x09^ self at: anIndex ifPresent: aBlock ifAbsent: [ nil ]",
  1262. messageSends: ["at:ifPresent:ifAbsent:"],
  1263. referencedClasses: []
  1264. }),
  1265. globals.IndexableCollection);
  1266. smalltalk.addMethod(
  1267. smalltalk.method({
  1268. selector: "at:ifPresent:ifAbsent:",
  1269. protocol: 'accessing',
  1270. fn: function (anIndex,aBlock,anotherBlock){
  1271. var self=this;
  1272. return smalltalk.withContext(function($ctx1) {
  1273. self._subclassResponsibility();
  1274. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)})},
  1275. args: ["anIndex", "aBlock", "anotherBlock"],
  1276. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value of evaluating aBlock with the value stored at anIndex.\x0a\x09Otherwise, answer the value of anotherBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1277. messageSends: ["subclassResponsibility"],
  1278. referencedClasses: []
  1279. }),
  1280. globals.IndexableCollection);
  1281. smalltalk.addMethod(
  1282. smalltalk.method({
  1283. selector: "at:put:",
  1284. protocol: 'accessing',
  1285. fn: function (anIndex,anObject){
  1286. var self=this;
  1287. return smalltalk.withContext(function($ctx1) {
  1288. self._subclassResponsibility();
  1289. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)})},
  1290. args: ["anIndex", "anObject"],
  1291. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1292. messageSends: ["subclassResponsibility"],
  1293. referencedClasses: []
  1294. }),
  1295. globals.IndexableCollection);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "indexOf:",
  1299. protocol: 'accessing',
  1300. fn: function (anObject){
  1301. var self=this;
  1302. return smalltalk.withContext(function($ctx1) {
  1303. var $1;
  1304. $1=self._indexOf_ifAbsent_(anObject,(function(){
  1305. return smalltalk.withContext(function($ctx2) {
  1306. return self._errorNotFound();
  1307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1308. return $1;
  1309. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)})},
  1310. args: ["anObject"],
  1311. source: "indexOf: anObject\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, raise an error.\x22\x0a\x0a\x09^ self indexOf: anObject ifAbsent: [ self errorNotFound ]",
  1312. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  1313. referencedClasses: []
  1314. }),
  1315. globals.IndexableCollection);
  1316. smalltalk.addMethod(
  1317. smalltalk.method({
  1318. selector: "indexOf:ifAbsent:",
  1319. protocol: 'accessing',
  1320. fn: function (anObject,aBlock){
  1321. var self=this;
  1322. return smalltalk.withContext(function($ctx1) {
  1323. self._subclassResponsibility();
  1324. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)})},
  1325. args: ["anObject", "aBlock"],
  1326. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09\x22Lookup index at which anObject is stored in the receiver.\x0a\x09If not present, return value of executing aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1327. messageSends: ["subclassResponsibility"],
  1328. referencedClasses: []
  1329. }),
  1330. globals.IndexableCollection);
  1331. smalltalk.addMethod(
  1332. smalltalk.method({
  1333. selector: "with:do:",
  1334. protocol: 'enumarating',
  1335. fn: function (anotherCollection,aBlock){
  1336. var self=this;
  1337. return smalltalk.withContext(function($ctx1) {
  1338. self._withIndexDo_((function(each,index){
  1339. return smalltalk.withContext(function($ctx2) {
  1340. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  1341. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  1342. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)})},
  1343. args: ["anotherCollection", "aBlock"],
  1344. source: "with: anotherCollection do: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with indetically-indexed value from anotherCollection\x22\x0a\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09aBlock value: each value: (anotherCollection at: index) ]",
  1345. messageSends: ["withIndexDo:", "value:value:", "at:"],
  1346. referencedClasses: []
  1347. }),
  1348. globals.IndexableCollection);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "withIndexDo:",
  1352. protocol: 'enumarating',
  1353. fn: function (aBlock){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) {
  1356. self._subclassResponsibility();
  1357. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)})},
  1358. args: ["aBlock"],
  1359. source: "withIndexDo: aBlock\x0a\x09\x22Calls aBlock with every value from self\x0a\x09and with its index as the second argument\x22\x0a\x0a\x09self subclassResponsibility",
  1360. messageSends: ["subclassResponsibility"],
  1361. referencedClasses: []
  1362. }),
  1363. globals.IndexableCollection);
  1364. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  1365. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1366. smalltalk.addMethod(
  1367. smalltalk.method({
  1368. selector: "=",
  1369. protocol: 'comparing',
  1370. fn: function (anAssocitativeCollection){
  1371. var self=this;
  1372. return smalltalk.withContext(function($ctx1) {
  1373. var $2,$1,$4,$3,$6,$5;
  1374. $2=self._class();
  1375. $ctx1.sendIdx["class"]=1;
  1376. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  1377. $ctx1.sendIdx["="]=1;
  1378. if(! smalltalk.assert($1)){
  1379. return false;
  1380. };
  1381. $4=self._size();
  1382. $ctx1.sendIdx["size"]=1;
  1383. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  1384. $ctx1.sendIdx["="]=2;
  1385. if(! smalltalk.assert($3)){
  1386. return false;
  1387. };
  1388. $6=self._associations();
  1389. $ctx1.sendIdx["associations"]=1;
  1390. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  1391. return $5;
  1392. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)})},
  1393. args: ["anAssocitativeCollection"],
  1394. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1395. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  1396. referencedClasses: []
  1397. }),
  1398. globals.AssociativeCollection);
  1399. smalltalk.addMethod(
  1400. smalltalk.method({
  1401. selector: "add:",
  1402. protocol: 'adding/removing',
  1403. fn: function (anAssociation){
  1404. var self=this;
  1405. return smalltalk.withContext(function($ctx1) {
  1406. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  1407. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)})},
  1408. args: ["anAssociation"],
  1409. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1410. messageSends: ["at:put:", "key", "value"],
  1411. referencedClasses: []
  1412. }),
  1413. globals.AssociativeCollection);
  1414. smalltalk.addMethod(
  1415. smalltalk.method({
  1416. selector: "addAll:",
  1417. protocol: 'adding/removing',
  1418. fn: function (anAssociativeCollection){
  1419. var self=this;
  1420. return smalltalk.withContext(function($ctx1) {
  1421. globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]);
  1422. return anAssociativeCollection;
  1423. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)})},
  1424. args: ["anAssociativeCollection"],
  1425. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1426. messageSends: ["addAll:", "associations"],
  1427. referencedClasses: []
  1428. }),
  1429. globals.AssociativeCollection);
  1430. smalltalk.addMethod(
  1431. smalltalk.method({
  1432. selector: "asDictionary",
  1433. protocol: 'converting',
  1434. fn: function (){
  1435. var self=this;
  1436. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  1437. return smalltalk.withContext(function($ctx1) {
  1438. var $1;
  1439. $1=_st($Dictionary())._from_(self._associations());
  1440. return $1;
  1441. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)})},
  1442. args: [],
  1443. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1444. messageSends: ["from:", "associations"],
  1445. referencedClasses: ["Dictionary"]
  1446. }),
  1447. globals.AssociativeCollection);
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "asHashedCollection",
  1451. protocol: 'converting',
  1452. fn: function (){
  1453. var self=this;
  1454. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1455. return smalltalk.withContext(function($ctx1) {
  1456. var $1;
  1457. $1=_st($HashedCollection())._from_(self._associations());
  1458. return $1;
  1459. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)})},
  1460. args: [],
  1461. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1462. messageSends: ["from:", "associations"],
  1463. referencedClasses: ["HashedCollection"]
  1464. }),
  1465. globals.AssociativeCollection);
  1466. smalltalk.addMethod(
  1467. smalltalk.method({
  1468. selector: "asJSON",
  1469. protocol: 'converting',
  1470. fn: function (){
  1471. var self=this;
  1472. var hash;
  1473. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  1474. return smalltalk.withContext(function($ctx1) {
  1475. var $1;
  1476. hash=_st($HashedCollection())._new();
  1477. self._keysAndValuesDo_((function(key,value){
  1478. return smalltalk.withContext(function($ctx2) {
  1479. return _st(hash)._at_put_(key,_st(value)._asJSON());
  1480. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1481. $1=hash;
  1482. return $1;
  1483. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)})},
  1484. args: [],
  1485. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  1486. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"],
  1487. referencedClasses: ["HashedCollection"]
  1488. }),
  1489. globals.AssociativeCollection);
  1490. smalltalk.addMethod(
  1491. smalltalk.method({
  1492. selector: "associations",
  1493. protocol: 'accessing',
  1494. fn: function (){
  1495. var self=this;
  1496. var associations;
  1497. return smalltalk.withContext(function($ctx1) {
  1498. var $1;
  1499. associations=[];
  1500. self._associationsDo_((function(each){
  1501. return smalltalk.withContext(function($ctx2) {
  1502. return _st(associations)._add_(each);
  1503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1504. $1=associations;
  1505. return $1;
  1506. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)})},
  1507. args: [],
  1508. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1509. messageSends: ["associationsDo:", "add:"],
  1510. referencedClasses: []
  1511. }),
  1512. globals.AssociativeCollection);
  1513. smalltalk.addMethod(
  1514. smalltalk.method({
  1515. selector: "associationsDo:",
  1516. protocol: 'enumerating',
  1517. fn: function (aBlock){
  1518. var self=this;
  1519. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  1520. return smalltalk.withContext(function($ctx1) {
  1521. self._keysAndValuesDo_((function(key,value){
  1522. return smalltalk.withContext(function($ctx2) {
  1523. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  1524. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1525. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1526. args: ["aBlock"],
  1527. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  1528. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  1529. referencedClasses: ["Association"]
  1530. }),
  1531. globals.AssociativeCollection);
  1532. smalltalk.addMethod(
  1533. smalltalk.method({
  1534. selector: "at:ifPresent:ifAbsent:",
  1535. protocol: 'accessing',
  1536. fn: function (aKey,aBlock,anotherBlock){
  1537. var self=this;
  1538. return smalltalk.withContext(function($ctx1) {
  1539. var $2,$1;
  1540. $2=self._includesKey_(aKey);
  1541. if(smalltalk.assert($2)){
  1542. $1=_st(aBlock)._value_(self._at_(aKey));
  1543. } else {
  1544. $1=_st(anotherBlock)._value();
  1545. };
  1546. return $1;
  1547. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  1548. args: ["aKey", "aBlock", "anotherBlock"],
  1549. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  1550. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"],
  1551. referencedClasses: []
  1552. }),
  1553. globals.AssociativeCollection);
  1554. smalltalk.addMethod(
  1555. smalltalk.method({
  1556. selector: "collect:",
  1557. protocol: 'enumerating',
  1558. fn: function (aBlock){
  1559. var self=this;
  1560. var newDict;
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1;
  1563. newDict=_st(self._class())._new();
  1564. self._keysAndValuesDo_((function(key,value){
  1565. return smalltalk.withContext(function($ctx2) {
  1566. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  1567. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1568. $1=newDict;
  1569. return $1;
  1570. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  1571. args: ["aBlock"],
  1572. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  1573. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  1574. referencedClasses: []
  1575. }),
  1576. globals.AssociativeCollection);
  1577. smalltalk.addMethod(
  1578. smalltalk.method({
  1579. selector: "deepCopy",
  1580. protocol: 'copying',
  1581. fn: function (){
  1582. var self=this;
  1583. var copy;
  1584. return smalltalk.withContext(function($ctx1) {
  1585. var $1;
  1586. copy=_st(self._class())._new();
  1587. self._keysAndValuesDo_((function(key,value){
  1588. return smalltalk.withContext(function($ctx2) {
  1589. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  1590. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1591. $1=copy;
  1592. return $1;
  1593. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)})},
  1594. args: [],
  1595. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  1596. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  1597. referencedClasses: []
  1598. }),
  1599. globals.AssociativeCollection);
  1600. smalltalk.addMethod(
  1601. smalltalk.method({
  1602. selector: "detect:ifNone:",
  1603. protocol: 'enumerating',
  1604. fn: function (aBlock,anotherBlock){
  1605. var self=this;
  1606. return smalltalk.withContext(function($ctx1) {
  1607. var $1;
  1608. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  1609. return $1;
  1610. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)})},
  1611. args: ["aBlock", "anotherBlock"],
  1612. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  1613. messageSends: ["detect:ifNone:", "values"],
  1614. referencedClasses: []
  1615. }),
  1616. globals.AssociativeCollection);
  1617. smalltalk.addMethod(
  1618. smalltalk.method({
  1619. selector: "do:",
  1620. protocol: 'enumerating',
  1621. fn: function (aBlock){
  1622. var self=this;
  1623. return smalltalk.withContext(function($ctx1) {
  1624. self._valuesDo_(aBlock);
  1625. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1626. args: ["aBlock"],
  1627. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  1628. messageSends: ["valuesDo:"],
  1629. referencedClasses: []
  1630. }),
  1631. globals.AssociativeCollection);
  1632. smalltalk.addMethod(
  1633. smalltalk.method({
  1634. selector: "includes:",
  1635. protocol: 'enumerating',
  1636. fn: function (anObject){
  1637. var self=this;
  1638. return smalltalk.withContext(function($ctx1) {
  1639. var $1;
  1640. $1=_st(self._values())._includes_(anObject);
  1641. return $1;
  1642. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)})},
  1643. args: ["anObject"],
  1644. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  1645. messageSends: ["includes:", "values"],
  1646. referencedClasses: []
  1647. }),
  1648. globals.AssociativeCollection);
  1649. smalltalk.addMethod(
  1650. smalltalk.method({
  1651. selector: "includesKey:",
  1652. protocol: 'testing',
  1653. fn: function (aKey){
  1654. var self=this;
  1655. return smalltalk.withContext(function($ctx1) {
  1656. self._subclassResponsibility();
  1657. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)})},
  1658. args: ["aKey"],
  1659. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  1660. messageSends: ["subclassResponsibility"],
  1661. referencedClasses: []
  1662. }),
  1663. globals.AssociativeCollection);
  1664. smalltalk.addMethod(
  1665. smalltalk.method({
  1666. selector: "indexOf:ifAbsent:",
  1667. protocol: 'accessing',
  1668. fn: function (anObject,aBlock){
  1669. var self=this;
  1670. return smalltalk.withContext(function($ctx1) {
  1671. var $1;
  1672. $1=_st(self._keys())._detect_ifNone_((function(each){
  1673. return smalltalk.withContext(function($ctx2) {
  1674. return _st(self._at_(each)).__eq(anObject);
  1675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),aBlock);
  1676. return $1;
  1677. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  1678. args: ["anObject", "aBlock"],
  1679. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  1680. messageSends: ["detect:ifNone:", "keys", "=", "at:"],
  1681. referencedClasses: []
  1682. }),
  1683. globals.AssociativeCollection);
  1684. smalltalk.addMethod(
  1685. smalltalk.method({
  1686. selector: "keyAtValue:",
  1687. protocol: 'accessing',
  1688. fn: function (anObject){
  1689. var self=this;
  1690. return smalltalk.withContext(function($ctx1) {
  1691. var $1;
  1692. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  1693. return smalltalk.withContext(function($ctx2) {
  1694. return self._errorNotFound();
  1695. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1696. return $1;
  1697. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)})},
  1698. args: ["anObject"],
  1699. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  1700. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"],
  1701. referencedClasses: []
  1702. }),
  1703. globals.AssociativeCollection);
  1704. smalltalk.addMethod(
  1705. smalltalk.method({
  1706. selector: "keyAtValue:ifAbsent:",
  1707. protocol: 'accessing',
  1708. fn: function (anObject,aBlock){
  1709. var self=this;
  1710. return smalltalk.withContext(function($ctx1) {
  1711. var $1;
  1712. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  1713. return $1;
  1714. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)})},
  1715. args: ["anObject", "aBlock"],
  1716. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  1717. messageSends: ["indexOf:ifAbsent:"],
  1718. referencedClasses: []
  1719. }),
  1720. globals.AssociativeCollection);
  1721. smalltalk.addMethod(
  1722. smalltalk.method({
  1723. selector: "keys",
  1724. protocol: 'accessing',
  1725. fn: function (){
  1726. var self=this;
  1727. return smalltalk.withContext(function($ctx1) {
  1728. self._subclassResponsibility();
  1729. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)})},
  1730. args: [],
  1731. source: "keys\x0a\x09self subclassResponsibility",
  1732. messageSends: ["subclassResponsibility"],
  1733. referencedClasses: []
  1734. }),
  1735. globals.AssociativeCollection);
  1736. smalltalk.addMethod(
  1737. smalltalk.method({
  1738. selector: "keysAndValuesDo:",
  1739. protocol: 'enumerating',
  1740. fn: function (aBlock){
  1741. var self=this;
  1742. return smalltalk.withContext(function($ctx1) {
  1743. self._keysDo_((function(each){
  1744. return smalltalk.withContext(function($ctx2) {
  1745. return _st(aBlock)._value_value_(each,self._at_(each));
  1746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1747. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1748. args: ["aBlock"],
  1749. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  1750. messageSends: ["keysDo:", "value:value:", "at:"],
  1751. referencedClasses: []
  1752. }),
  1753. globals.AssociativeCollection);
  1754. smalltalk.addMethod(
  1755. smalltalk.method({
  1756. selector: "keysDo:",
  1757. protocol: 'enumerating',
  1758. fn: function (aBlock){
  1759. var self=this;
  1760. return smalltalk.withContext(function($ctx1) {
  1761. self._subclassResponsibility();
  1762. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1763. args: ["aBlock"],
  1764. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  1765. messageSends: ["subclassResponsibility"],
  1766. referencedClasses: []
  1767. }),
  1768. globals.AssociativeCollection);
  1769. smalltalk.addMethod(
  1770. smalltalk.method({
  1771. selector: "printOn:",
  1772. protocol: 'printing',
  1773. fn: function (aStream){
  1774. var self=this;
  1775. return smalltalk.withContext(function($ctx1) {
  1776. globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  1777. $ctx1.sendIdx["printOn:"]=1;
  1778. _st(aStream)._nextPutAll_(" (");
  1779. $ctx1.sendIdx["nextPutAll:"]=1;
  1780. _st(self._associations())._do_separatedBy_((function(each){
  1781. return smalltalk.withContext(function($ctx2) {
  1782. return _st(each)._printOn_(aStream);
  1783. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  1784. return smalltalk.withContext(function($ctx2) {
  1785. return _st(aStream)._nextPutAll_(" , ");
  1786. $ctx2.sendIdx["nextPutAll:"]=2;
  1787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1788. _st(aStream)._nextPutAll_(")");
  1789. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)})},
  1790. args: ["aStream"],
  1791. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  1792. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"],
  1793. referencedClasses: []
  1794. }),
  1795. globals.AssociativeCollection);
  1796. smalltalk.addMethod(
  1797. smalltalk.method({
  1798. selector: "remove:ifAbsent:",
  1799. protocol: 'adding/removing',
  1800. fn: function (aKey,aBlock){
  1801. var self=this;
  1802. return smalltalk.withContext(function($ctx1) {
  1803. var $1;
  1804. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  1805. return $1;
  1806. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  1807. args: ["aKey", "aBlock"],
  1808. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  1809. messageSends: ["removeKey:ifAbsent:"],
  1810. referencedClasses: []
  1811. }),
  1812. globals.AssociativeCollection);
  1813. smalltalk.addMethod(
  1814. smalltalk.method({
  1815. selector: "removeAll",
  1816. protocol: 'adding/removing',
  1817. fn: function (){
  1818. var self=this;
  1819. return smalltalk.withContext(function($ctx1) {
  1820. var $1;
  1821. $1=_st(self._keys())._do_((function(each){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return self._removeKey_(each);
  1824. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1825. return $1;
  1826. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)})},
  1827. args: [],
  1828. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  1829. messageSends: ["do:", "keys", "removeKey:"],
  1830. referencedClasses: []
  1831. }),
  1832. globals.AssociativeCollection);
  1833. smalltalk.addMethod(
  1834. smalltalk.method({
  1835. selector: "removeKey:",
  1836. protocol: 'adding/removing',
  1837. fn: function (aKey){
  1838. var self=this;
  1839. return smalltalk.withContext(function($ctx1) {
  1840. var $1;
  1841. $1=self._remove_(aKey);
  1842. return $1;
  1843. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)})},
  1844. args: ["aKey"],
  1845. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  1846. messageSends: ["remove:"],
  1847. referencedClasses: []
  1848. }),
  1849. globals.AssociativeCollection);
  1850. smalltalk.addMethod(
  1851. smalltalk.method({
  1852. selector: "removeKey:ifAbsent:",
  1853. protocol: 'adding/removing',
  1854. fn: function (aKey,aBlock){
  1855. var self=this;
  1856. return smalltalk.withContext(function($ctx1) {
  1857. self._subclassResponsibility();
  1858. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)})},
  1859. args: ["aKey", "aBlock"],
  1860. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1861. messageSends: ["subclassResponsibility"],
  1862. referencedClasses: []
  1863. }),
  1864. globals.AssociativeCollection);
  1865. smalltalk.addMethod(
  1866. smalltalk.method({
  1867. selector: "select:",
  1868. protocol: 'enumerating',
  1869. fn: function (aBlock){
  1870. var self=this;
  1871. var newDict;
  1872. return smalltalk.withContext(function($ctx1) {
  1873. var $1,$2;
  1874. newDict=_st(self._class())._new();
  1875. self._keysAndValuesDo_((function(key,value){
  1876. return smalltalk.withContext(function($ctx2) {
  1877. $1=_st(aBlock)._value_(value);
  1878. if(smalltalk.assert($1)){
  1879. return _st(newDict)._at_put_(key,value);
  1880. };
  1881. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1882. $2=newDict;
  1883. return $2;
  1884. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)})},
  1885. args: ["aBlock"],
  1886. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  1887. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"],
  1888. referencedClasses: []
  1889. }),
  1890. globals.AssociativeCollection);
  1891. smalltalk.addMethod(
  1892. smalltalk.method({
  1893. selector: "shallowCopy",
  1894. protocol: 'copying',
  1895. fn: function (){
  1896. var self=this;
  1897. var copy;
  1898. return smalltalk.withContext(function($ctx1) {
  1899. var $1;
  1900. copy=_st(self._class())._new();
  1901. self._keysAndValuesDo_((function(key,value){
  1902. return smalltalk.withContext(function($ctx2) {
  1903. return _st(copy)._at_put_(key,value);
  1904. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1905. $1=copy;
  1906. return $1;
  1907. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)})},
  1908. args: [],
  1909. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  1910. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  1911. referencedClasses: []
  1912. }),
  1913. globals.AssociativeCollection);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "size",
  1917. protocol: 'accessing',
  1918. fn: function (){
  1919. var self=this;
  1920. return smalltalk.withContext(function($ctx1) {
  1921. var $1;
  1922. $1=_st(self._keys())._size();
  1923. return $1;
  1924. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)})},
  1925. args: [],
  1926. source: "size\x0a\x09^ self keys size",
  1927. messageSends: ["size", "keys"],
  1928. referencedClasses: []
  1929. }),
  1930. globals.AssociativeCollection);
  1931. smalltalk.addMethod(
  1932. smalltalk.method({
  1933. selector: "values",
  1934. protocol: 'accessing',
  1935. fn: function (){
  1936. var self=this;
  1937. return smalltalk.withContext(function($ctx1) {
  1938. self._subclassResponsibility();
  1939. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)})},
  1940. args: [],
  1941. source: "values\x0a\x09self subclassResponsibility",
  1942. messageSends: ["subclassResponsibility"],
  1943. referencedClasses: []
  1944. }),
  1945. globals.AssociativeCollection);
  1946. smalltalk.addMethod(
  1947. smalltalk.method({
  1948. selector: "valuesDo:",
  1949. protocol: 'enumerating',
  1950. fn: function (aBlock){
  1951. var self=this;
  1952. return smalltalk.withContext(function($ctx1) {
  1953. self._subclassResponsibility();
  1954. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1955. args: ["aBlock"],
  1956. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  1957. messageSends: ["subclassResponsibility"],
  1958. referencedClasses: []
  1959. }),
  1960. globals.AssociativeCollection);
  1961. smalltalk.addMethod(
  1962. smalltalk.method({
  1963. selector: "withIndexDo:",
  1964. protocol: 'enumerating',
  1965. fn: function (aBlock){
  1966. var self=this;
  1967. return smalltalk.withContext(function($ctx1) {
  1968. self._keysAndValuesDo_((function(key,value){
  1969. return smalltalk.withContext(function($ctx2) {
  1970. return _st(aBlock)._value_value_(value,key);
  1971. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)})}));
  1972. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)})},
  1973. args: ["aBlock"],
  1974. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  1975. messageSends: ["keysAndValuesDo:", "value:value:"],
  1976. referencedClasses: []
  1977. }),
  1978. globals.AssociativeCollection);
  1979. smalltalk.addMethod(
  1980. smalltalk.method({
  1981. selector: "from:",
  1982. protocol: 'instance creation',
  1983. fn: function (aCollection){
  1984. var self=this;
  1985. var newCollection;
  1986. return smalltalk.withContext(function($ctx1) {
  1987. var $1;
  1988. newCollection=self._new();
  1989. _st(aCollection)._do_((function(each){
  1990. return smalltalk.withContext(function($ctx2) {
  1991. return _st(newCollection)._add_(each);
  1992. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1993. $1=newCollection;
  1994. return $1;
  1995. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  1996. args: ["aCollection"],
  1997. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  1998. messageSends: ["new", "do:", "add:"],
  1999. referencedClasses: []
  2000. }),
  2001. globals.AssociativeCollection.klass);
  2002. smalltalk.addMethod(
  2003. smalltalk.method({
  2004. selector: "fromPairs:",
  2005. protocol: 'instance creation',
  2006. fn: function (aCollection){
  2007. var self=this;
  2008. return smalltalk.withContext(function($ctx1) {
  2009. var $1;
  2010. $1=self._from_(aCollection);
  2011. return $1;
  2012. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)})},
  2013. args: ["aCollection"],
  2014. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2015. messageSends: ["from:"],
  2016. referencedClasses: []
  2017. }),
  2018. globals.AssociativeCollection.klass);
  2019. smalltalk.addMethod(
  2020. smalltalk.method({
  2021. selector: "newFromPairs:",
  2022. protocol: 'instance creation',
  2023. fn: function (aCollection){
  2024. var self=this;
  2025. var newCollection;
  2026. return smalltalk.withContext(function($ctx1) {
  2027. var $2,$1,$3,$4,$5;
  2028. $2=_st(aCollection)._size();
  2029. $ctx1.sendIdx["size"]=1;
  2030. $1=_st($2)._even();
  2031. if(! smalltalk.assert($1)){
  2032. self._error_("#newFromPairs only accepts arrays of an even length");
  2033. };
  2034. newCollection=self._new();
  2035. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  2036. return smalltalk.withContext(function($ctx2) {
  2037. $3=newCollection;
  2038. $4=_st(aCollection)._at_(each);
  2039. $ctx2.sendIdx["at:"]=1;
  2040. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  2041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  2042. $5=newCollection;
  2043. return $5;
  2044. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)})},
  2045. args: ["aCollection"],
  2046. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  2047. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"],
  2048. referencedClasses: []
  2049. }),
  2050. globals.AssociativeCollection.klass);
  2051. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  2052. globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  2053. smalltalk.addMethod(
  2054. smalltalk.method({
  2055. selector: "at:ifAbsent:",
  2056. protocol: 'accessing',
  2057. fn: function (aKey,aBlock){
  2058. var self=this;
  2059. return smalltalk.withContext(function($ctx1) {
  2060. var index = self._positionOfKey_(aKey);
  2061. return index >=0 ? self['@values'][index] : aBlock._value();
  2062. ;
  2063. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  2064. args: ["aKey", "aBlock"],
  2065. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  2066. messageSends: [],
  2067. referencedClasses: []
  2068. }),
  2069. globals.Dictionary);
  2070. smalltalk.addMethod(
  2071. smalltalk.method({
  2072. selector: "at:put:",
  2073. protocol: 'accessing',
  2074. fn: function (aKey,aValue){
  2075. var self=this;
  2076. return smalltalk.withContext(function($ctx1) {
  2077. var index = self._positionOfKey_(aKey);
  2078. if(index === -1) {
  2079. var keys = self['@keys'];
  2080. index = keys.length;
  2081. keys.push(aKey);
  2082. }
  2083. return self['@values'][index] = aValue;
  2084. ;
  2085. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)})},
  2086. args: ["aKey", "aValue"],
  2087. source: "at: aKey put: aValue\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = self['@keys'];\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return self['@values'][index] = aValue;\x0a\x09>",
  2088. messageSends: [],
  2089. referencedClasses: []
  2090. }),
  2091. globals.Dictionary);
  2092. smalltalk.addMethod(
  2093. smalltalk.method({
  2094. selector: "includesKey:",
  2095. protocol: 'testing',
  2096. fn: function (aKey){
  2097. var self=this;
  2098. return smalltalk.withContext(function($ctx1) {
  2099. return self._positionOfKey_(aKey) >= 0; ;
  2100. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)})},
  2101. args: ["aKey"],
  2102. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  2103. messageSends: [],
  2104. referencedClasses: []
  2105. }),
  2106. globals.Dictionary);
  2107. smalltalk.addMethod(
  2108. smalltalk.method({
  2109. selector: "indexOf:ifAbsent:",
  2110. protocol: 'accessing',
  2111. fn: function (anObject,aBlock){
  2112. var self=this;
  2113. var index;
  2114. return smalltalk.withContext(function($ctx1) {
  2115. var $2,$1;
  2116. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  2117. return (0);
  2118. }));
  2119. $2=_st(index).__eq((0));
  2120. if(smalltalk.assert($2)){
  2121. $1=_st(aBlock)._value();
  2122. } else {
  2123. $1=_st(self["@keys"])._at_(index);
  2124. };
  2125. return $1;
  2126. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)})},
  2127. args: ["anObject", "aBlock"],
  2128. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  2129. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"],
  2130. referencedClasses: []
  2131. }),
  2132. globals.Dictionary);
  2133. smalltalk.addMethod(
  2134. smalltalk.method({
  2135. selector: "initialize",
  2136. protocol: 'initialization',
  2137. fn: function (){
  2138. var self=this;
  2139. return smalltalk.withContext(function($ctx1) {
  2140. globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []);
  2141. self["@keys"]=[];
  2142. self["@values"]=[];
  2143. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)})},
  2144. args: [],
  2145. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2146. messageSends: ["initialize"],
  2147. referencedClasses: []
  2148. }),
  2149. globals.Dictionary);
  2150. smalltalk.addMethod(
  2151. smalltalk.method({
  2152. selector: "keys",
  2153. protocol: 'accessing',
  2154. fn: function (){
  2155. var self=this;
  2156. return smalltalk.withContext(function($ctx1) {
  2157. var $1;
  2158. $1=_st(self["@keys"])._copy();
  2159. return $1;
  2160. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)})},
  2161. args: [],
  2162. source: "keys\x0a\x09^ keys copy",
  2163. messageSends: ["copy"],
  2164. referencedClasses: []
  2165. }),
  2166. globals.Dictionary);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "keysAndValuesDo:",
  2170. protocol: 'enumerating',
  2171. fn: function (aBlock){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. var $1;
  2175. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  2176. return $1;
  2177. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  2178. args: ["aBlock"],
  2179. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  2180. messageSends: ["with:do:"],
  2181. referencedClasses: []
  2182. }),
  2183. globals.Dictionary);
  2184. smalltalk.addMethod(
  2185. smalltalk.method({
  2186. selector: "keysDo:",
  2187. protocol: 'enumerating',
  2188. fn: function (aBlock){
  2189. var self=this;
  2190. return smalltalk.withContext(function($ctx1) {
  2191. var $1;
  2192. $1=_st(self["@keys"])._do_(aBlock);
  2193. return $1;
  2194. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)})},
  2195. args: ["aBlock"],
  2196. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  2197. messageSends: ["do:"],
  2198. referencedClasses: []
  2199. }),
  2200. globals.Dictionary);
  2201. smalltalk.addMethod(
  2202. smalltalk.method({
  2203. selector: "positionOfKey:",
  2204. protocol: 'private',
  2205. fn: function (anObject){
  2206. var self=this;
  2207. return smalltalk.withContext(function($ctx1) {
  2208. var keys = self['@keys'];
  2209. for(var i=0;i<keys.length;i++){
  2210. if(keys[i].__eq(anObject)) { return i;}
  2211. }
  2212. return -1;
  2213. ;
  2214. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)})},
  2215. args: ["anObject"],
  2216. source: "positionOfKey: anObject\x0a\x09<\x0a\x09\x09var keys = self['@keys'];\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09>",
  2217. messageSends: [],
  2218. referencedClasses: []
  2219. }),
  2220. globals.Dictionary);
  2221. smalltalk.addMethod(
  2222. smalltalk.method({
  2223. selector: "removeAll",
  2224. protocol: 'adding/removing',
  2225. fn: function (){
  2226. var self=this;
  2227. return smalltalk.withContext(function($ctx1) {
  2228. _st(self["@keys"])._removeAll();
  2229. $ctx1.sendIdx["removeAll"]=1;
  2230. _st(self["@values"])._removeAll();
  2231. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)})},
  2232. args: [],
  2233. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  2234. messageSends: ["removeAll"],
  2235. referencedClasses: []
  2236. }),
  2237. globals.Dictionary);
  2238. smalltalk.addMethod(
  2239. smalltalk.method({
  2240. selector: "removeKey:ifAbsent:",
  2241. protocol: 'adding/removing',
  2242. fn: function (aKey,aBlock){
  2243. var self=this;
  2244. return smalltalk.withContext(function($ctx1) {
  2245. var index = self._positionOfKey_(aKey);
  2246. if(index === -1) {
  2247. return aBlock._value()
  2248. } else {
  2249. var keys = self['@keys'], values = self['@values'];
  2250. var value = values[index], l = keys.length;
  2251. keys[index] = keys[l-1];
  2252. keys.pop();
  2253. values[index] = values[l-1];
  2254. values.pop();
  2255. return value;
  2256. }
  2257. ;
  2258. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)})},
  2259. args: ["aKey", "aBlock"],
  2260. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = self['@keys'], values = self['@values'];\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09>",
  2261. messageSends: [],
  2262. referencedClasses: []
  2263. }),
  2264. globals.Dictionary);
  2265. smalltalk.addMethod(
  2266. smalltalk.method({
  2267. selector: "values",
  2268. protocol: 'accessing',
  2269. fn: function (){
  2270. var self=this;
  2271. var $1;
  2272. $1=self["@values"];
  2273. return $1;
  2274. },
  2275. args: [],
  2276. source: "values\x0a\x09^ values",
  2277. messageSends: [],
  2278. referencedClasses: []
  2279. }),
  2280. globals.Dictionary);
  2281. smalltalk.addMethod(
  2282. smalltalk.method({
  2283. selector: "valuesDo:",
  2284. protocol: 'enumerating',
  2285. fn: function (aBlock){
  2286. var self=this;
  2287. return smalltalk.withContext(function($ctx1) {
  2288. var $1;
  2289. $1=_st(self["@values"])._do_(aBlock);
  2290. return $1;
  2291. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)})},
  2292. args: ["aBlock"],
  2293. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  2294. messageSends: ["do:"],
  2295. referencedClasses: []
  2296. }),
  2297. globals.Dictionary);
  2298. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  2299. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  2300. smalltalk.addMethod(
  2301. smalltalk.method({
  2302. selector: "at:ifAbsent:",
  2303. protocol: 'accessing',
  2304. fn: function (aKey,aBlock){
  2305. var self=this;
  2306. return smalltalk.withContext(function($ctx1) {
  2307. var $2,$1;
  2308. $2=self._includesKey_(aKey);
  2309. if(smalltalk.assert($2)){
  2310. $1=self._basicAt_(aKey);
  2311. } else {
  2312. $1=_st(aBlock)._value();
  2313. };
  2314. return $1;
  2315. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  2316. args: ["aKey", "aBlock"],
  2317. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  2318. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"],
  2319. referencedClasses: []
  2320. }),
  2321. globals.HashedCollection);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "at:put:",
  2325. protocol: 'accessing',
  2326. fn: function (aKey,aValue){
  2327. var self=this;
  2328. return smalltalk.withContext(function($ctx1) {
  2329. var $1;
  2330. $1=self._basicAt_put_(aKey,aValue);
  2331. return $1;
  2332. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)})},
  2333. args: ["aKey", "aValue"],
  2334. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  2335. messageSends: ["basicAt:put:"],
  2336. referencedClasses: []
  2337. }),
  2338. globals.HashedCollection);
  2339. smalltalk.addMethod(
  2340. smalltalk.method({
  2341. selector: "includesKey:",
  2342. protocol: 'testing',
  2343. fn: function (aKey){
  2344. var self=this;
  2345. return smalltalk.withContext(function($ctx1) {
  2346. return self.hasOwnProperty(aKey);
  2347. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)})},
  2348. args: ["aKey"],
  2349. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  2350. messageSends: [],
  2351. referencedClasses: []
  2352. }),
  2353. globals.HashedCollection);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "keys",
  2357. protocol: 'accessing',
  2358. fn: function (){
  2359. var self=this;
  2360. return smalltalk.withContext(function($ctx1) {
  2361. return Object.keys(self);
  2362. return self}, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)})},
  2363. args: [],
  2364. source: "keys\x0a\x09<return Object.keys(self)>",
  2365. messageSends: [],
  2366. referencedClasses: []
  2367. }),
  2368. globals.HashedCollection);
  2369. smalltalk.addMethod(
  2370. smalltalk.method({
  2371. selector: "keysDo:",
  2372. protocol: 'enumerating',
  2373. fn: function (aBlock){
  2374. var self=this;
  2375. return smalltalk.withContext(function($ctx1) {
  2376. _st(self._keys())._do_(aBlock);
  2377. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)})},
  2378. args: ["aBlock"],
  2379. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  2380. messageSends: ["do:", "keys"],
  2381. referencedClasses: []
  2382. }),
  2383. globals.HashedCollection);
  2384. smalltalk.addMethod(
  2385. smalltalk.method({
  2386. selector: "removeKey:ifAbsent:",
  2387. protocol: 'adding/removing',
  2388. fn: function (aKey,aBlock){
  2389. var self=this;
  2390. return smalltalk.withContext(function($ctx1) {
  2391. var $1;
  2392. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  2393. return smalltalk.withContext(function($ctx2) {
  2394. self._basicDelete_(aKey);
  2395. return removed;
  2396. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)})}),(function(){
  2397. return smalltalk.withContext(function($ctx2) {
  2398. return _st(aBlock)._value();
  2399. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2400. return $1;
  2401. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)})},
  2402. args: ["aKey", "aBlock"],
  2403. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  2404. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"],
  2405. referencedClasses: []
  2406. }),
  2407. globals.HashedCollection);
  2408. smalltalk.addMethod(
  2409. smalltalk.method({
  2410. selector: "values",
  2411. protocol: 'accessing',
  2412. fn: function (){
  2413. var self=this;
  2414. return smalltalk.withContext(function($ctx1) {
  2415. return self._keys().map(function(key){
  2416. return self._at_(key);
  2417. });
  2418. ;
  2419. return self}, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)})},
  2420. args: [],
  2421. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  2422. messageSends: [],
  2423. referencedClasses: []
  2424. }),
  2425. globals.HashedCollection);
  2426. smalltalk.addMethod(
  2427. smalltalk.method({
  2428. selector: "valuesDo:",
  2429. protocol: 'enumerating',
  2430. fn: function (aBlock){
  2431. var self=this;
  2432. return smalltalk.withContext(function($ctx1) {
  2433. _st(self._values())._do_(aBlock);
  2434. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)})},
  2435. args: ["aBlock"],
  2436. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  2437. messageSends: ["do:", "values"],
  2438. referencedClasses: []
  2439. }),
  2440. globals.HashedCollection);
  2441. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  2442. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  2443. smalltalk.addMethod(
  2444. smalltalk.method({
  2445. selector: "=",
  2446. protocol: 'comparing',
  2447. fn: function (aCollection){
  2448. var self=this;
  2449. return smalltalk.withContext(function($ctx1) {
  2450. var $3,$2,$4,$1,$5;
  2451. var $early={};
  2452. try {
  2453. $3=self._class();
  2454. $ctx1.sendIdx["class"]=1;
  2455. $2=_st($3).__eq(_st(aCollection)._class());
  2456. $ctx1.sendIdx["="]=1;
  2457. $1=_st($2)._and_((function(){
  2458. return smalltalk.withContext(function($ctx2) {
  2459. $4=self._size();
  2460. $ctx2.sendIdx["size"]=1;
  2461. return _st($4).__eq(_st(aCollection)._size());
  2462. $ctx2.sendIdx["="]=2;
  2463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2464. if(! smalltalk.assert($1)){
  2465. return false;
  2466. };
  2467. self._withIndexDo_((function(each,i){
  2468. return smalltalk.withContext(function($ctx2) {
  2469. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  2470. if(! smalltalk.assert($5)){
  2471. throw $early=[false];
  2472. };
  2473. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)})}));
  2474. return true;
  2475. }
  2476. catch(e) {if(e===$early)return e[0]; throw e}
  2477. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)})},
  2478. args: ["aCollection"],
  2479. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  2480. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"],
  2481. referencedClasses: []
  2482. }),
  2483. globals.SequenceableCollection);
  2484. smalltalk.addMethod(
  2485. smalltalk.method({
  2486. selector: "addLast:",
  2487. protocol: 'adding/removing',
  2488. fn: function (anObject){
  2489. var self=this;
  2490. return smalltalk.withContext(function($ctx1) {
  2491. self._add_(anObject);
  2492. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)})},
  2493. args: ["anObject"],
  2494. source: "addLast: anObject\x0a\x09self add: anObject",
  2495. messageSends: ["add:"],
  2496. referencedClasses: []
  2497. }),
  2498. globals.SequenceableCollection);
  2499. smalltalk.addMethod(
  2500. smalltalk.method({
  2501. selector: "allButFirst",
  2502. protocol: 'accessing',
  2503. fn: function (){
  2504. var self=this;
  2505. return smalltalk.withContext(function($ctx1) {
  2506. var $1;
  2507. $1=self._copyFrom_to_((2),self._size());
  2508. return $1;
  2509. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)})},
  2510. args: [],
  2511. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  2512. messageSends: ["copyFrom:to:", "size"],
  2513. referencedClasses: []
  2514. }),
  2515. globals.SequenceableCollection);
  2516. smalltalk.addMethod(
  2517. smalltalk.method({
  2518. selector: "allButLast",
  2519. protocol: 'accessing',
  2520. fn: function (){
  2521. var self=this;
  2522. return smalltalk.withContext(function($ctx1) {
  2523. var $1;
  2524. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  2525. return $1;
  2526. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)})},
  2527. args: [],
  2528. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  2529. messageSends: ["copyFrom:to:", "-", "size"],
  2530. referencedClasses: []
  2531. }),
  2532. globals.SequenceableCollection);
  2533. smalltalk.addMethod(
  2534. smalltalk.method({
  2535. selector: "atRandom",
  2536. protocol: 'accessing',
  2537. fn: function (){
  2538. var self=this;
  2539. return smalltalk.withContext(function($ctx1) {
  2540. var $1;
  2541. $1=self._at_(_st(self._size())._atRandom());
  2542. return $1;
  2543. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)})},
  2544. args: [],
  2545. source: "atRandom\x0a\x09^ self at: self size atRandom",
  2546. messageSends: ["at:", "atRandom", "size"],
  2547. referencedClasses: []
  2548. }),
  2549. globals.SequenceableCollection);
  2550. smalltalk.addMethod(
  2551. smalltalk.method({
  2552. selector: "beginsWith:",
  2553. protocol: 'testing',
  2554. fn: function (prefix){
  2555. var self=this;
  2556. return smalltalk.withContext(function($ctx1) {
  2557. var $2,$3,$1,$4;
  2558. $2=self._size();
  2559. $ctx1.sendIdx["size"]=1;
  2560. $3=_st(prefix)._size();
  2561. $ctx1.sendIdx["size"]=2;
  2562. $1=_st($2).__lt($3);
  2563. if(smalltalk.assert($1)){
  2564. return false;
  2565. };
  2566. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  2567. return $4;
  2568. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)})},
  2569. args: ["prefix"],
  2570. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  2571. messageSends: ["ifTrue:", "<", "size", "=", "first:"],
  2572. referencedClasses: []
  2573. }),
  2574. globals.SequenceableCollection);
  2575. smalltalk.addMethod(
  2576. smalltalk.method({
  2577. selector: "copyFrom:to:",
  2578. protocol: 'copying',
  2579. fn: function (anIndex,anotherIndex){
  2580. var self=this;
  2581. var range,newCollection;
  2582. return smalltalk.withContext(function($ctx1) {
  2583. var $1;
  2584. range=_st(anIndex)._to_(anotherIndex);
  2585. newCollection=_st(self._class())._new_(_st(range)._size());
  2586. _st(range)._withIndexDo_((function(each,i){
  2587. return smalltalk.withContext(function($ctx2) {
  2588. return _st(newCollection)._at_put_(i,self._at_(each));
  2589. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)})}));
  2590. $1=newCollection;
  2591. return $1;
  2592. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)})},
  2593. args: ["anIndex", "anotherIndex"],
  2594. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  2595. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"],
  2596. referencedClasses: []
  2597. }),
  2598. globals.SequenceableCollection);
  2599. smalltalk.addMethod(
  2600. smalltalk.method({
  2601. selector: "deepCopy",
  2602. protocol: 'copying',
  2603. fn: function (){
  2604. var self=this;
  2605. var newCollection;
  2606. return smalltalk.withContext(function($ctx1) {
  2607. var $1;
  2608. newCollection=_st(self._class())._new_(self._size());
  2609. self._withIndexDo_((function(each,index){
  2610. return smalltalk.withContext(function($ctx2) {
  2611. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  2612. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2613. $1=newCollection;
  2614. return $1;
  2615. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  2616. args: [],
  2617. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  2618. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"],
  2619. referencedClasses: []
  2620. }),
  2621. globals.SequenceableCollection);
  2622. smalltalk.addMethod(
  2623. smalltalk.method({
  2624. selector: "detect:ifNone:",
  2625. protocol: 'enumerating',
  2626. fn: function (aBlock,anotherBlock){
  2627. var self=this;
  2628. return smalltalk.withContext(function($ctx1) {
  2629. self = self._numericallyIndexable();
  2630. for(var i = 0; i < self.length; i++)
  2631. if(aBlock._value_(self[i]))
  2632. return self[i];
  2633. return anotherBlock._value();
  2634. ;
  2635. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)})},
  2636. args: ["aBlock", "anotherBlock"],
  2637. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09>",
  2638. messageSends: [],
  2639. referencedClasses: []
  2640. }),
  2641. globals.SequenceableCollection);
  2642. smalltalk.addMethod(
  2643. smalltalk.method({
  2644. selector: "do:",
  2645. protocol: 'enumerating',
  2646. fn: function (aBlock){
  2647. var self=this;
  2648. return smalltalk.withContext(function($ctx1) {
  2649. self = self._numericallyIndexable();
  2650. for(var i=0; i < self.length; i++) {
  2651. aBlock._value_(self[i]);
  2652. }
  2653. ;
  2654. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)})},
  2655. args: ["aBlock"],
  2656. source: "do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09>",
  2657. messageSends: [],
  2658. referencedClasses: []
  2659. }),
  2660. globals.SequenceableCollection);
  2661. smalltalk.addMethod(
  2662. smalltalk.method({
  2663. selector: "endsWith:",
  2664. protocol: 'testing',
  2665. fn: function (suffix){
  2666. var self=this;
  2667. return smalltalk.withContext(function($ctx1) {
  2668. var $2,$3,$1,$4;
  2669. $2=self._size();
  2670. $ctx1.sendIdx["size"]=1;
  2671. $3=_st(suffix)._size();
  2672. $ctx1.sendIdx["size"]=2;
  2673. $1=_st($2).__lt($3);
  2674. if(smalltalk.assert($1)){
  2675. return false;
  2676. };
  2677. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  2678. return $4;
  2679. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)})},
  2680. args: ["suffix"],
  2681. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  2682. messageSends: ["ifTrue:", "<", "size", "=", "last:"],
  2683. referencedClasses: []
  2684. }),
  2685. globals.SequenceableCollection);
  2686. smalltalk.addMethod(
  2687. smalltalk.method({
  2688. selector: "first",
  2689. protocol: 'accessing',
  2690. fn: function (){
  2691. var self=this;
  2692. return smalltalk.withContext(function($ctx1) {
  2693. var $1;
  2694. $1=self._at_((1));
  2695. return $1;
  2696. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)})},
  2697. args: [],
  2698. source: "first\x0a\x09^ self at: 1",
  2699. messageSends: ["at:"],
  2700. referencedClasses: []
  2701. }),
  2702. globals.SequenceableCollection);
  2703. smalltalk.addMethod(
  2704. smalltalk.method({
  2705. selector: "first:",
  2706. protocol: 'accessing',
  2707. fn: function (aNumber){
  2708. var self=this;
  2709. return smalltalk.withContext(function($ctx1) {
  2710. var $1,$2;
  2711. $1=_st(self._size()).__lt(aNumber);
  2712. if(smalltalk.assert($1)){
  2713. self._error_("Invalid number of elements");
  2714. };
  2715. $2=self._copyFrom_to_((1),aNumber);
  2716. return $2;
  2717. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)})},
  2718. args: ["aNumber"],
  2719. source: "first: aNumber\x0a\x09\x22Answer the first `aNumber` elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: 1 to: aNumber",
  2720. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"],
  2721. referencedClasses: []
  2722. }),
  2723. globals.SequenceableCollection);
  2724. smalltalk.addMethod(
  2725. smalltalk.method({
  2726. selector: "fourth",
  2727. protocol: 'accessing',
  2728. fn: function (){
  2729. var self=this;
  2730. return smalltalk.withContext(function($ctx1) {
  2731. var $1;
  2732. $1=self._at_((4));
  2733. return $1;
  2734. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)})},
  2735. args: [],
  2736. source: "fourth\x0a\x09^ self at: 4",
  2737. messageSends: ["at:"],
  2738. referencedClasses: []
  2739. }),
  2740. globals.SequenceableCollection);
  2741. smalltalk.addMethod(
  2742. smalltalk.method({
  2743. selector: "includes:",
  2744. protocol: 'testing',
  2745. fn: function (anObject){
  2746. var self=this;
  2747. return smalltalk.withContext(function($ctx1) {
  2748. var $1;
  2749. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  2750. return nil;
  2751. })))._notNil();
  2752. return $1;
  2753. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)})},
  2754. args: ["anObject"],
  2755. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  2756. messageSends: ["notNil", "indexOf:ifAbsent:"],
  2757. referencedClasses: []
  2758. }),
  2759. globals.SequenceableCollection);
  2760. smalltalk.addMethod(
  2761. smalltalk.method({
  2762. selector: "indexOf:ifAbsent:",
  2763. protocol: 'accessing',
  2764. fn: function (anObject,aBlock){
  2765. var self=this;
  2766. return smalltalk.withContext(function($ctx1) {
  2767. self = self._numericallyIndexable();
  2768. for(var i=0; i < self.length; i++) {
  2769. if(_st(self[i]).__eq(anObject)) {return i+1}
  2770. };
  2771. return aBlock._value();
  2772. ;
  2773. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)})},
  2774. args: ["anObject", "aBlock"],
  2775. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  2776. messageSends: [],
  2777. referencedClasses: []
  2778. }),
  2779. globals.SequenceableCollection);
  2780. smalltalk.addMethod(
  2781. smalltalk.method({
  2782. selector: "indexOf:startingAt:",
  2783. protocol: 'accessing',
  2784. fn: function (anObject,start){
  2785. var self=this;
  2786. return smalltalk.withContext(function($ctx1) {
  2787. var $1;
  2788. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  2789. return (0);
  2790. }));
  2791. return $1;
  2792. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)})},
  2793. args: ["anObject", "start"],
  2794. source: "indexOf: anObject startingAt: start\x0a\x09\x22Answer the index of the first occurence of anElement after start\x0a\x09within the receiver. If the receiver does not contain anElement,\x0a\x09answer 0.\x22\x0a\x09^ self indexOf: anObject startingAt: start ifAbsent: [ 0 ]",
  2795. messageSends: ["indexOf:startingAt:ifAbsent:"],
  2796. referencedClasses: []
  2797. }),
  2798. globals.SequenceableCollection);
  2799. smalltalk.addMethod(
  2800. smalltalk.method({
  2801. selector: "indexOf:startingAt:ifAbsent:",
  2802. protocol: 'accessing',
  2803. fn: function (anObject,start,aBlock){
  2804. var self=this;
  2805. return smalltalk.withContext(function($ctx1) {
  2806. self = self._numericallyIndexable();
  2807. for(var i=start - 1; i < self.length; i++){
  2808. if(_st(self[i]).__eq(anObject)) {return i+1}
  2809. }
  2810. return aBlock._value();
  2811. ;
  2812. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)})},
  2813. args: ["anObject", "start", "aBlock"],
  2814. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  2815. messageSends: [],
  2816. referencedClasses: []
  2817. }),
  2818. globals.SequenceableCollection);
  2819. smalltalk.addMethod(
  2820. smalltalk.method({
  2821. selector: "last",
  2822. protocol: 'accessing',
  2823. fn: function (){
  2824. var self=this;
  2825. return smalltalk.withContext(function($ctx1) {
  2826. var $1;
  2827. $1=self._at_(self._size());
  2828. return $1;
  2829. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)})},
  2830. args: [],
  2831. source: "last\x0a\x09^ self at: self size",
  2832. messageSends: ["at:", "size"],
  2833. referencedClasses: []
  2834. }),
  2835. globals.SequenceableCollection);
  2836. smalltalk.addMethod(
  2837. smalltalk.method({
  2838. selector: "last:",
  2839. protocol: 'accessing',
  2840. fn: function (aNumber){
  2841. var self=this;
  2842. return smalltalk.withContext(function($ctx1) {
  2843. var $2,$1,$6,$5,$4,$3;
  2844. $2=self._size();
  2845. $ctx1.sendIdx["size"]=1;
  2846. $1=_st($2).__lt(aNumber);
  2847. if(smalltalk.assert($1)){
  2848. self._error_("Invalid number of elements");
  2849. };
  2850. $6=self._size();
  2851. $ctx1.sendIdx["size"]=2;
  2852. $5=_st($6).__minus(aNumber);
  2853. $4=_st($5).__plus((1));
  2854. $3=self._copyFrom_to_($4,self._size());
  2855. return $3;
  2856. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)})},
  2857. args: ["aNumber"],
  2858. source: "last: aNumber\x0a\x09\x22Answer the last aNumber elements of the receiver.\x0a\x09Raise an error if there are not enough elements in the receiver.\x22\x0a\x0a\x09self size < aNumber ifTrue: [ self error: 'Invalid number of elements' ].\x0a\x0a\x09^ self copyFrom: self size - aNumber + 1 to: self size",
  2859. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"],
  2860. referencedClasses: []
  2861. }),
  2862. globals.SequenceableCollection);
  2863. smalltalk.addMethod(
  2864. smalltalk.method({
  2865. selector: "newStream",
  2866. protocol: 'streaming',
  2867. fn: function (){
  2868. var self=this;
  2869. return smalltalk.withContext(function($ctx1) {
  2870. var $1;
  2871. $1=_st(self._streamClass())._on_(self);
  2872. return $1;
  2873. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)})},
  2874. args: [],
  2875. source: "newStream\x0a\x09^ self streamClass on: self",
  2876. messageSends: ["on:", "streamClass"],
  2877. referencedClasses: []
  2878. }),
  2879. globals.SequenceableCollection);
  2880. smalltalk.addMethod(
  2881. smalltalk.method({
  2882. selector: "numericallyIndexable",
  2883. protocol: 'private',
  2884. fn: function (){
  2885. var self=this;
  2886. return smalltalk.withContext(function($ctx1) {
  2887. self._subclassResponsibility();
  2888. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)})},
  2889. args: [],
  2890. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  2891. messageSends: ["subclassResponsibility"],
  2892. referencedClasses: []
  2893. }),
  2894. globals.SequenceableCollection);
  2895. smalltalk.addMethod(
  2896. smalltalk.method({
  2897. selector: "readStream",
  2898. protocol: 'streaming',
  2899. fn: function (){
  2900. var self=this;
  2901. return smalltalk.withContext(function($ctx1) {
  2902. var $1;
  2903. $1=self._stream();
  2904. return $1;
  2905. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)})},
  2906. args: [],
  2907. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  2908. messageSends: ["stream"],
  2909. referencedClasses: []
  2910. }),
  2911. globals.SequenceableCollection);
  2912. smalltalk.addMethod(
  2913. smalltalk.method({
  2914. selector: "removeLast",
  2915. protocol: 'adding/removing',
  2916. fn: function (){
  2917. var self=this;
  2918. return smalltalk.withContext(function($ctx1) {
  2919. var $1;
  2920. $1=self._remove_(self._last());
  2921. return $1;
  2922. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)})},
  2923. args: [],
  2924. source: "removeLast\x0a\x09^ self remove: self last",
  2925. messageSends: ["remove:", "last"],
  2926. referencedClasses: []
  2927. }),
  2928. globals.SequenceableCollection);
  2929. smalltalk.addMethod(
  2930. smalltalk.method({
  2931. selector: "reversed",
  2932. protocol: 'converting',
  2933. fn: function (){
  2934. var self=this;
  2935. return smalltalk.withContext(function($ctx1) {
  2936. self._subclassResponsibility();
  2937. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)})},
  2938. args: [],
  2939. source: "reversed\x0a\x09self subclassResponsibility",
  2940. messageSends: ["subclassResponsibility"],
  2941. referencedClasses: []
  2942. }),
  2943. globals.SequenceableCollection);
  2944. smalltalk.addMethod(
  2945. smalltalk.method({
  2946. selector: "second",
  2947. protocol: 'accessing',
  2948. fn: function (){
  2949. var self=this;
  2950. return smalltalk.withContext(function($ctx1) {
  2951. var $1;
  2952. $1=self._at_((2));
  2953. return $1;
  2954. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)})},
  2955. args: [],
  2956. source: "second\x0a\x09^ self at: 2",
  2957. messageSends: ["at:"],
  2958. referencedClasses: []
  2959. }),
  2960. globals.SequenceableCollection);
  2961. smalltalk.addMethod(
  2962. smalltalk.method({
  2963. selector: "shallowCopy",
  2964. protocol: 'copying',
  2965. fn: function (){
  2966. var self=this;
  2967. var newCollection;
  2968. return smalltalk.withContext(function($ctx1) {
  2969. var $1;
  2970. newCollection=_st(self._class())._new_(self._size());
  2971. self._withIndexDo_((function(each,index){
  2972. return smalltalk.withContext(function($ctx2) {
  2973. return _st(newCollection)._at_put_(index,each);
  2974. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2975. $1=newCollection;
  2976. return $1;
  2977. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)})},
  2978. args: [],
  2979. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  2980. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  2981. referencedClasses: []
  2982. }),
  2983. globals.SequenceableCollection);
  2984. smalltalk.addMethod(
  2985. smalltalk.method({
  2986. selector: "stream",
  2987. protocol: 'streaming',
  2988. fn: function (){
  2989. var self=this;
  2990. return smalltalk.withContext(function($ctx1) {
  2991. var $1;
  2992. $1=self._newStream();
  2993. return $1;
  2994. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)})},
  2995. args: [],
  2996. source: "stream\x0a\x09^ self newStream",
  2997. messageSends: ["newStream"],
  2998. referencedClasses: []
  2999. }),
  3000. globals.SequenceableCollection);
  3001. smalltalk.addMethod(
  3002. smalltalk.method({
  3003. selector: "streamClass",
  3004. protocol: 'streaming',
  3005. fn: function (){
  3006. var self=this;
  3007. return smalltalk.withContext(function($ctx1) {
  3008. var $1;
  3009. $1=_st(self._class())._streamClass();
  3010. return $1;
  3011. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)})},
  3012. args: [],
  3013. source: "streamClass\x0a\x09^ self class streamClass",
  3014. messageSends: ["streamClass", "class"],
  3015. referencedClasses: []
  3016. }),
  3017. globals.SequenceableCollection);
  3018. smalltalk.addMethod(
  3019. smalltalk.method({
  3020. selector: "third",
  3021. protocol: 'accessing',
  3022. fn: function (){
  3023. var self=this;
  3024. return smalltalk.withContext(function($ctx1) {
  3025. var $1;
  3026. $1=self._at_((3));
  3027. return $1;
  3028. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)})},
  3029. args: [],
  3030. source: "third\x0a\x09^ self at: 3",
  3031. messageSends: ["at:"],
  3032. referencedClasses: []
  3033. }),
  3034. globals.SequenceableCollection);
  3035. smalltalk.addMethod(
  3036. smalltalk.method({
  3037. selector: "with:do:",
  3038. protocol: 'enumerating',
  3039. fn: function (anotherCollection,aBlock){
  3040. var self=this;
  3041. return smalltalk.withContext(function($ctx1) {
  3042. self = self._numericallyIndexable();
  3043. anotherCollection = anotherCollection._numericallyIndexable();
  3044. for(var i=0; i<self.length; i++) {
  3045. aBlock._value_value_(self[i], anotherCollection[i]);
  3046. }
  3047. ;
  3048. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)})},
  3049. args: ["anotherCollection", "aBlock"],
  3050. source: "with: anotherCollection do: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09>",
  3051. messageSends: [],
  3052. referencedClasses: []
  3053. }),
  3054. globals.SequenceableCollection);
  3055. smalltalk.addMethod(
  3056. smalltalk.method({
  3057. selector: "withIndexDo:",
  3058. protocol: 'enumerating',
  3059. fn: function (aBlock){
  3060. var self=this;
  3061. return smalltalk.withContext(function($ctx1) {
  3062. self = self._numericallyIndexable();
  3063. for(var i=0; i < self.length; i++) {
  3064. aBlock._value_value_(self[i], i+1);
  3065. }
  3066. ;
  3067. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)})},
  3068. args: ["aBlock"],
  3069. source: "withIndexDo: aBlock\x0a\x09<\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09>",
  3070. messageSends: [],
  3071. referencedClasses: []
  3072. }),
  3073. globals.SequenceableCollection);
  3074. smalltalk.addMethod(
  3075. smalltalk.method({
  3076. selector: "writeStream",
  3077. protocol: 'streaming',
  3078. fn: function (){
  3079. var self=this;
  3080. return smalltalk.withContext(function($ctx1) {
  3081. var $1;
  3082. $1=self._stream();
  3083. return $1;
  3084. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)})},
  3085. args: [],
  3086. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3087. messageSends: ["stream"],
  3088. referencedClasses: []
  3089. }),
  3090. globals.SequenceableCollection);
  3091. smalltalk.addMethod(
  3092. smalltalk.method({
  3093. selector: "streamClass",
  3094. protocol: 'accessing',
  3095. fn: function (){
  3096. var self=this;
  3097. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  3098. return $Stream();
  3099. },
  3100. args: [],
  3101. source: "streamClass\x0a\x09\x09^ Stream",
  3102. messageSends: [],
  3103. referencedClasses: ["Stream"]
  3104. }),
  3105. globals.SequenceableCollection.klass);
  3106. smalltalk.addMethod(
  3107. smalltalk.method({
  3108. selector: "streamContents:",
  3109. protocol: 'streaming',
  3110. fn: function (aBlock){
  3111. var self=this;
  3112. var stream;
  3113. return smalltalk.withContext(function($ctx1) {
  3114. var $1;
  3115. stream=_st(self._streamClass())._on_(self._new());
  3116. _st(aBlock)._value_(stream);
  3117. $1=_st(stream)._contents();
  3118. return $1;
  3119. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)})},
  3120. args: ["aBlock"],
  3121. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  3122. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  3123. referencedClasses: []
  3124. }),
  3125. globals.SequenceableCollection.klass);
  3126. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  3127. globals.Array.comment="I represent a collection of objects ordered by the collector. The size of arrays is dynamic.\x0a\x0aI am directly mapped to JavaScript Number.\x0a\x0a*Note* In Amber, `OrderedCollection` is an alias for `Array`.";
  3128. smalltalk.addMethod(
  3129. smalltalk.method({
  3130. selector: "add:",
  3131. protocol: 'adding/removing',
  3132. fn: function (anObject){
  3133. var self=this;
  3134. return smalltalk.withContext(function($ctx1) {
  3135. self.push(anObject); return anObject;;
  3136. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)})},
  3137. args: ["anObject"],
  3138. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  3139. messageSends: [],
  3140. referencedClasses: []
  3141. }),
  3142. globals.Array);
  3143. smalltalk.addMethod(
  3144. smalltalk.method({
  3145. selector: "addFirst:",
  3146. protocol: 'adding/removing',
  3147. fn: function (anObject){
  3148. var self=this;
  3149. return smalltalk.withContext(function($ctx1) {
  3150. self.unshift(anObject); return anObject;;
  3151. return self}, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)})},
  3152. args: ["anObject"],
  3153. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  3154. messageSends: [],
  3155. referencedClasses: []
  3156. }),
  3157. globals.Array);
  3158. smalltalk.addMethod(
  3159. smalltalk.method({
  3160. selector: "asJavascript",
  3161. protocol: 'converting',
  3162. fn: function (){
  3163. var self=this;
  3164. return smalltalk.withContext(function($ctx1) {
  3165. var $1;
  3166. $1=_st("[".__comma(_st(self._collect_((function(each){
  3167. return smalltalk.withContext(function($ctx2) {
  3168. return _st(each)._asJavascript();
  3169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._join_(", "))).__comma("]");
  3170. $ctx1.sendIdx[","]=1;
  3171. return $1;
  3172. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)})},
  3173. args: [],
  3174. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  3175. messageSends: [",", "join:", "collect:", "asJavascript"],
  3176. referencedClasses: []
  3177. }),
  3178. globals.Array);
  3179. smalltalk.addMethod(
  3180. smalltalk.method({
  3181. selector: "at:ifAbsent:",
  3182. protocol: 'accessing',
  3183. fn: function (anIndex,aBlock){
  3184. var self=this;
  3185. return smalltalk.withContext(function($ctx1) {
  3186. return anIndex >= 1 && anIndex <= self.length
  3187. ? self[anIndex - 1]
  3188. : aBlock._value()
  3189. ;
  3190. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)})},
  3191. args: ["anIndex", "aBlock"],
  3192. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  3193. messageSends: [],
  3194. referencedClasses: []
  3195. }),
  3196. globals.Array);
  3197. smalltalk.addMethod(
  3198. smalltalk.method({
  3199. selector: "at:ifPresent:ifAbsent:",
  3200. protocol: 'accessing',
  3201. fn: function (anIndex,aBlock,anotherBlock){
  3202. var self=this;
  3203. return smalltalk.withContext(function($ctx1) {
  3204. return anIndex >= 1 && anIndex <= self.length
  3205. ? aBlock._value_(self[anIndex - 1])
  3206. : anotherBlock._value()
  3207. ;
  3208. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)})},
  3209. args: ["anIndex", "aBlock", "anotherBlock"],
  3210. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09>",
  3211. messageSends: [],
  3212. referencedClasses: []
  3213. }),
  3214. globals.Array);
  3215. smalltalk.addMethod(
  3216. smalltalk.method({
  3217. selector: "at:put:",
  3218. protocol: 'accessing',
  3219. fn: function (anIndex,anObject){
  3220. var self=this;
  3221. return smalltalk.withContext(function($ctx1) {
  3222. return self[anIndex - 1] = anObject;
  3223. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)})},
  3224. args: ["anIndex", "anObject"],
  3225. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  3226. messageSends: [],
  3227. referencedClasses: []
  3228. }),
  3229. globals.Array);
  3230. smalltalk.addMethod(
  3231. smalltalk.method({
  3232. selector: "collect:",
  3233. protocol: 'enumerating',
  3234. fn: function (aBlock){
  3235. var self=this;
  3236. return smalltalk.withContext(function($ctx1) {
  3237. return self.map(function(each) {return aBlock._value_(each)});
  3238. return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)})},
  3239. args: ["aBlock"],
  3240. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  3241. messageSends: [],
  3242. referencedClasses: []
  3243. }),
  3244. globals.Array);
  3245. smalltalk.addMethod(
  3246. smalltalk.method({
  3247. selector: "join:",
  3248. protocol: 'enumerating',
  3249. fn: function (aString){
  3250. var self=this;
  3251. return smalltalk.withContext(function($ctx1) {
  3252. return self.join(aString);
  3253. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)})},
  3254. args: ["aString"],
  3255. source: "join: aString\x0a\x09<return self.join(aString)>",
  3256. messageSends: [],
  3257. referencedClasses: []
  3258. }),
  3259. globals.Array);
  3260. smalltalk.addMethod(
  3261. smalltalk.method({
  3262. selector: "numericallyIndexable",
  3263. protocol: 'private',
  3264. fn: function (){
  3265. var self=this;
  3266. return self;
  3267. },
  3268. args: [],
  3269. source: "numericallyIndexable\x0a\x09^ self",
  3270. messageSends: [],
  3271. referencedClasses: []
  3272. }),
  3273. globals.Array);
  3274. smalltalk.addMethod(
  3275. smalltalk.method({
  3276. selector: "printOn:",
  3277. protocol: 'printing',
  3278. fn: function (aStream){
  3279. var self=this;
  3280. return smalltalk.withContext(function($ctx1) {
  3281. globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  3282. $ctx1.sendIdx["printOn:"]=1;
  3283. _st(aStream)._nextPutAll_(" (");
  3284. $ctx1.sendIdx["nextPutAll:"]=1;
  3285. self._do_separatedBy_((function(each){
  3286. return smalltalk.withContext(function($ctx2) {
  3287. return _st(each)._printOn_(aStream);
  3288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  3289. return smalltalk.withContext(function($ctx2) {
  3290. return _st(aStream)._nextPutAll_(" ");
  3291. $ctx2.sendIdx["nextPutAll:"]=2;
  3292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  3293. _st(aStream)._nextPutAll_(")");
  3294. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)})},
  3295. args: ["aStream"],
  3296. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  3297. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  3298. referencedClasses: []
  3299. }),
  3300. globals.Array);
  3301. smalltalk.addMethod(
  3302. smalltalk.method({
  3303. selector: "remove:ifAbsent:",
  3304. protocol: 'adding/removing',
  3305. fn: function (anObject,aBlock){
  3306. var self=this;
  3307. var index;
  3308. return smalltalk.withContext(function($ctx1) {
  3309. var $2,$1;
  3310. index=self._indexOf_ifAbsent_(anObject,(function(){
  3311. return (0);
  3312. }));
  3313. $2=_st(index).__eq((0));
  3314. if(smalltalk.assert($2)){
  3315. $1=_st(aBlock)._value();
  3316. } else {
  3317. self._removeIndex_(index);
  3318. $1=anObject;
  3319. };
  3320. return $1;
  3321. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)})},
  3322. args: ["anObject", "aBlock"],
  3323. source: "remove: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := self indexOf: anObject ifAbsent: [ 0 ].\x0a\x09^ index = 0\x0a\x09\x09ifFalse: [ self removeIndex: index. anObject ]\x0a\x09\x09ifTrue: [ aBlock value ]",
  3324. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"],
  3325. referencedClasses: []
  3326. }),
  3327. globals.Array);
  3328. smalltalk.addMethod(
  3329. smalltalk.method({
  3330. selector: "removeAll",
  3331. protocol: 'adding/removing',
  3332. fn: function (){
  3333. var self=this;
  3334. return smalltalk.withContext(function($ctx1) {
  3335. self.length = 0;
  3336. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)})},
  3337. args: [],
  3338. source: "removeAll\x0a\x09<self.length = 0>",
  3339. messageSends: [],
  3340. referencedClasses: []
  3341. }),
  3342. globals.Array);
  3343. smalltalk.addMethod(
  3344. smalltalk.method({
  3345. selector: "removeFrom:to:",
  3346. protocol: 'adding/removing',
  3347. fn: function (aNumber,anotherNumber){
  3348. var self=this;
  3349. return smalltalk.withContext(function($ctx1) {
  3350. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  3351. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)})},
  3352. args: ["aNumber", "anotherNumber"],
  3353. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  3354. messageSends: [],
  3355. referencedClasses: []
  3356. }),
  3357. globals.Array);
  3358. smalltalk.addMethod(
  3359. smalltalk.method({
  3360. selector: "removeIndex:",
  3361. protocol: 'adding/removing',
  3362. fn: function (anInteger){
  3363. var self=this;
  3364. return smalltalk.withContext(function($ctx1) {
  3365. self.splice(anInteger - 1, 1);
  3366. return self}, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)})},
  3367. args: ["anInteger"],
  3368. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  3369. messageSends: [],
  3370. referencedClasses: []
  3371. }),
  3372. globals.Array);
  3373. smalltalk.addMethod(
  3374. smalltalk.method({
  3375. selector: "removeLast",
  3376. protocol: 'adding/removing',
  3377. fn: function (){
  3378. var self=this;
  3379. return smalltalk.withContext(function($ctx1) {
  3380. return self.pop();;
  3381. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)})},
  3382. args: [],
  3383. source: "removeLast\x0a\x09<return self.pop();>",
  3384. messageSends: [],
  3385. referencedClasses: []
  3386. }),
  3387. globals.Array);
  3388. smalltalk.addMethod(
  3389. smalltalk.method({
  3390. selector: "reversed",
  3391. protocol: 'converting',
  3392. fn: function (){
  3393. var self=this;
  3394. return smalltalk.withContext(function($ctx1) {
  3395. return self._copy().reverse();
  3396. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)})},
  3397. args: [],
  3398. source: "reversed\x0a\x09<return self._copy().reverse()>",
  3399. messageSends: [],
  3400. referencedClasses: []
  3401. }),
  3402. globals.Array);
  3403. smalltalk.addMethod(
  3404. smalltalk.method({
  3405. selector: "select:",
  3406. protocol: 'enumerating',
  3407. fn: function (aBlock){
  3408. var self=this;
  3409. return smalltalk.withContext(function($ctx1) {
  3410. var result = self.klass._new();
  3411. for(var i=0; i<self.length; i++) {
  3412. if(aBlock._value_(self[i])) {
  3413. result.push(self[i]);
  3414. }
  3415. }
  3416. return result;
  3417. ;
  3418. return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)})},
  3419. args: ["aBlock"],
  3420. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  3421. messageSends: [],
  3422. referencedClasses: []
  3423. }),
  3424. globals.Array);
  3425. smalltalk.addMethod(
  3426. smalltalk.method({
  3427. selector: "size",
  3428. protocol: 'accessing',
  3429. fn: function (){
  3430. var self=this;
  3431. return smalltalk.withContext(function($ctx1) {
  3432. return self.length;
  3433. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)})},
  3434. args: [],
  3435. source: "size\x0a\x09<return self.length>",
  3436. messageSends: [],
  3437. referencedClasses: []
  3438. }),
  3439. globals.Array);
  3440. smalltalk.addMethod(
  3441. smalltalk.method({
  3442. selector: "sort",
  3443. protocol: 'enumerating',
  3444. fn: function (){
  3445. var self=this;
  3446. return smalltalk.withContext(function($ctx1) {
  3447. var $1;
  3448. $1=self._sort_((function(a,b){
  3449. return smalltalk.withContext(function($ctx2) {
  3450. return _st(a).__lt(b);
  3451. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)})}));
  3452. return $1;
  3453. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)})},
  3454. args: [],
  3455. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  3456. messageSends: ["sort:", "<"],
  3457. referencedClasses: []
  3458. }),
  3459. globals.Array);
  3460. smalltalk.addMethod(
  3461. smalltalk.method({
  3462. selector: "sort:",
  3463. protocol: 'enumerating',
  3464. fn: function (aBlock){
  3465. var self=this;
  3466. return smalltalk.withContext(function($ctx1) {
  3467. return self.sort(function(a, b) {
  3468. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  3469. })
  3470. ;
  3471. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)})},
  3472. args: ["aBlock"],
  3473. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  3474. messageSends: [],
  3475. referencedClasses: []
  3476. }),
  3477. globals.Array);
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "sorted",
  3481. protocol: 'enumerating',
  3482. fn: function (){
  3483. var self=this;
  3484. return smalltalk.withContext(function($ctx1) {
  3485. var $1;
  3486. $1=_st(self._copy())._sort();
  3487. return $1;
  3488. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)})},
  3489. args: [],
  3490. source: "sorted\x0a\x09^ self copy sort",
  3491. messageSends: ["sort", "copy"],
  3492. referencedClasses: []
  3493. }),
  3494. globals.Array);
  3495. smalltalk.addMethod(
  3496. smalltalk.method({
  3497. selector: "sorted:",
  3498. protocol: 'enumerating',
  3499. fn: function (aBlock){
  3500. var self=this;
  3501. return smalltalk.withContext(function($ctx1) {
  3502. var $1;
  3503. $1=_st(self._copy())._sort_(aBlock);
  3504. return $1;
  3505. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)})},
  3506. args: ["aBlock"],
  3507. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  3508. messageSends: ["sort:", "copy"],
  3509. referencedClasses: []
  3510. }),
  3511. globals.Array);
  3512. smalltalk.addMethod(
  3513. smalltalk.method({
  3514. selector: "new:",
  3515. protocol: 'instance creation',
  3516. fn: function (anInteger){
  3517. var self=this;
  3518. return smalltalk.withContext(function($ctx1) {
  3519. return new Array(anInteger);
  3520. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)})},
  3521. args: ["anInteger"],
  3522. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  3523. messageSends: [],
  3524. referencedClasses: []
  3525. }),
  3526. globals.Array.klass);
  3527. smalltalk.addMethod(
  3528. smalltalk.method({
  3529. selector: "with:",
  3530. protocol: 'instance creation',
  3531. fn: function (anObject){
  3532. var self=this;
  3533. return smalltalk.withContext(function($ctx1) {
  3534. var $2,$3,$1;
  3535. $2=self._new_((1));
  3536. _st($2)._at_put_((1),anObject);
  3537. $3=_st($2)._yourself();
  3538. $1=$3;
  3539. return $1;
  3540. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)})},
  3541. args: ["anObject"],
  3542. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  3543. messageSends: ["at:put:", "new:", "yourself"],
  3544. referencedClasses: []
  3545. }),
  3546. globals.Array.klass);
  3547. smalltalk.addMethod(
  3548. smalltalk.method({
  3549. selector: "with:with:",
  3550. protocol: 'instance creation',
  3551. fn: function (anObject,anObject2){
  3552. var self=this;
  3553. return smalltalk.withContext(function($ctx1) {
  3554. var $2,$3,$1;
  3555. $2=self._new_((2));
  3556. _st($2)._at_put_((1),anObject);
  3557. $ctx1.sendIdx["at:put:"]=1;
  3558. _st($2)._at_put_((2),anObject2);
  3559. $3=_st($2)._yourself();
  3560. $1=$3;
  3561. return $1;
  3562. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)})},
  3563. args: ["anObject", "anObject2"],
  3564. source: "with: anObject with: anObject2\x0a\x09\x09^ (self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  3565. messageSends: ["at:put:", "new:", "yourself"],
  3566. referencedClasses: []
  3567. }),
  3568. globals.Array.klass);
  3569. smalltalk.addMethod(
  3570. smalltalk.method({
  3571. selector: "with:with:with:",
  3572. protocol: 'instance creation',
  3573. fn: function (anObject,anObject2,anObject3){
  3574. var self=this;
  3575. return smalltalk.withContext(function($ctx1) {
  3576. var $2,$3,$1;
  3577. $2=self._new_((3));
  3578. _st($2)._at_put_((1),anObject);
  3579. $ctx1.sendIdx["at:put:"]=1;
  3580. _st($2)._at_put_((2),anObject2);
  3581. $ctx1.sendIdx["at:put:"]=2;
  3582. _st($2)._at_put_((3),anObject3);
  3583. $3=_st($2)._yourself();
  3584. $1=$3;
  3585. return $1;
  3586. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)})},
  3587. args: ["anObject", "anObject2", "anObject3"],
  3588. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  3589. messageSends: ["at:put:", "new:", "yourself"],
  3590. referencedClasses: []
  3591. }),
  3592. globals.Array.klass);
  3593. smalltalk.addMethod(
  3594. smalltalk.method({
  3595. selector: "withAll:",
  3596. protocol: 'instance creation',
  3597. fn: function (aCollection){
  3598. var self=this;
  3599. var instance,index;
  3600. return smalltalk.withContext(function($ctx1) {
  3601. var $1;
  3602. index=(1);
  3603. instance=self._new_(_st(aCollection)._size());
  3604. _st(aCollection)._do_((function(each){
  3605. return smalltalk.withContext(function($ctx2) {
  3606. _st(instance)._at_put_(index,each);
  3607. index=_st(index).__plus((1));
  3608. return index;
  3609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  3610. $1=instance;
  3611. return $1;
  3612. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)})},
  3613. args: ["aCollection"],
  3614. source: "withAll: aCollection\x0a\x09| instance index |\x0a\x09index := 1.\x0a\x09instance := self new: aCollection size.\x0a\x09aCollection do: [ :each |\x0a\x09\x09instance at: index put: each.\x0a\x09\x09index := index + 1 ].\x0a\x09^ instance",
  3615. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  3616. referencedClasses: []
  3617. }),
  3618. globals.Array.klass);
  3619. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  3620. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  3621. smalltalk.addMethod(
  3622. smalltalk.method({
  3623. selector: ",",
  3624. protocol: 'copying',
  3625. fn: function (aString){
  3626. var self=this;
  3627. return smalltalk.withContext(function($ctx1) {
  3628. var $2,$1;
  3629. $2=self._asString();
  3630. $ctx1.sendIdx["asString"]=1;
  3631. $1=_st($2).__comma(_st(aString)._asString());
  3632. return $1;
  3633. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)})},
  3634. args: ["aString"],
  3635. source: ", aString\x0a\x09^ self asString, aString asString",
  3636. messageSends: [",", "asString"],
  3637. referencedClasses: []
  3638. }),
  3639. globals.CharacterArray);
  3640. smalltalk.addMethod(
  3641. smalltalk.method({
  3642. selector: "add:",
  3643. protocol: 'adding/removing',
  3644. fn: function (anObject){
  3645. var self=this;
  3646. return smalltalk.withContext(function($ctx1) {
  3647. self._errorReadOnly();
  3648. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)})},
  3649. args: ["anObject"],
  3650. source: "add: anObject\x0a\x09self errorReadOnly",
  3651. messageSends: ["errorReadOnly"],
  3652. referencedClasses: []
  3653. }),
  3654. globals.CharacterArray);
  3655. smalltalk.addMethod(
  3656. smalltalk.method({
  3657. selector: "asLowercase",
  3658. protocol: 'converting',
  3659. fn: function (){
  3660. var self=this;
  3661. return smalltalk.withContext(function($ctx1) {
  3662. var $1;
  3663. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  3664. return $1;
  3665. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)})},
  3666. args: [],
  3667. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  3668. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  3669. referencedClasses: []
  3670. }),
  3671. globals.CharacterArray);
  3672. smalltalk.addMethod(
  3673. smalltalk.method({
  3674. selector: "asNumber",
  3675. protocol: 'converting',
  3676. fn: function (){
  3677. var self=this;
  3678. return smalltalk.withContext(function($ctx1) {
  3679. var $1;
  3680. $1=_st(self._asString())._asNumber();
  3681. return $1;
  3682. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)})},
  3683. args: [],
  3684. source: "asNumber\x0a\x09^ self asString asNumber",
  3685. messageSends: ["asNumber", "asString"],
  3686. referencedClasses: []
  3687. }),
  3688. globals.CharacterArray);
  3689. smalltalk.addMethod(
  3690. smalltalk.method({
  3691. selector: "asString",
  3692. protocol: 'converting',
  3693. fn: function (){
  3694. var self=this;
  3695. return smalltalk.withContext(function($ctx1) {
  3696. var $1;
  3697. $1=self._subclassResponsibility();
  3698. return $1;
  3699. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)})},
  3700. args: [],
  3701. source: "asString\x0a\x09^ self subclassResponsibility",
  3702. messageSends: ["subclassResponsibility"],
  3703. referencedClasses: []
  3704. }),
  3705. globals.CharacterArray);
  3706. smalltalk.addMethod(
  3707. smalltalk.method({
  3708. selector: "asSymbol",
  3709. protocol: 'converting',
  3710. fn: function (){
  3711. var self=this;
  3712. return smalltalk.withContext(function($ctx1) {
  3713. var $1;
  3714. $1=self._asString();
  3715. return $1;
  3716. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)})},
  3717. args: [],
  3718. source: "asSymbol\x0a\x09^ self asString",
  3719. messageSends: ["asString"],
  3720. referencedClasses: []
  3721. }),
  3722. globals.CharacterArray);
  3723. smalltalk.addMethod(
  3724. smalltalk.method({
  3725. selector: "asUppercase",
  3726. protocol: 'converting',
  3727. fn: function (){
  3728. var self=this;
  3729. return smalltalk.withContext(function($ctx1) {
  3730. var $1;
  3731. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  3732. return $1;
  3733. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)})},
  3734. args: [],
  3735. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  3736. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  3737. referencedClasses: []
  3738. }),
  3739. globals.CharacterArray);
  3740. smalltalk.addMethod(
  3741. smalltalk.method({
  3742. selector: "at:put:",
  3743. protocol: 'accessing',
  3744. fn: function (anIndex,anObject){
  3745. var self=this;
  3746. return smalltalk.withContext(function($ctx1) {
  3747. self._errorReadOnly();
  3748. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)})},
  3749. args: ["anIndex", "anObject"],
  3750. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  3751. messageSends: ["errorReadOnly"],
  3752. referencedClasses: []
  3753. }),
  3754. globals.CharacterArray);
  3755. smalltalk.addMethod(
  3756. smalltalk.method({
  3757. selector: "errorReadOnly",
  3758. protocol: 'error handling',
  3759. fn: function (){
  3760. var self=this;
  3761. return smalltalk.withContext(function($ctx1) {
  3762. self._error_("Object is read-only");
  3763. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)})},
  3764. args: [],
  3765. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  3766. messageSends: ["error:"],
  3767. referencedClasses: []
  3768. }),
  3769. globals.CharacterArray);
  3770. smalltalk.addMethod(
  3771. smalltalk.method({
  3772. selector: "printOn:",
  3773. protocol: 'printing',
  3774. fn: function (aStream){
  3775. var self=this;
  3776. return smalltalk.withContext(function($ctx1) {
  3777. _st(self._asString())._printOn_(aStream);
  3778. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)})},
  3779. args: ["aStream"],
  3780. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  3781. messageSends: ["printOn:", "asString"],
  3782. referencedClasses: []
  3783. }),
  3784. globals.CharacterArray);
  3785. smalltalk.addMethod(
  3786. smalltalk.method({
  3787. selector: "putOn:",
  3788. protocol: 'streaming',
  3789. fn: function (aStream){
  3790. var self=this;
  3791. return smalltalk.withContext(function($ctx1) {
  3792. _st(aStream)._nextPutString_(self);
  3793. return self}, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)})},
  3794. args: ["aStream"],
  3795. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  3796. messageSends: ["nextPutString:"],
  3797. referencedClasses: []
  3798. }),
  3799. globals.CharacterArray);
  3800. smalltalk.addMethod(
  3801. smalltalk.method({
  3802. selector: "remove:",
  3803. protocol: 'adding/removing',
  3804. fn: function (anObject){
  3805. var self=this;
  3806. return smalltalk.withContext(function($ctx1) {
  3807. self._errorReadOnly();
  3808. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)})},
  3809. args: ["anObject"],
  3810. source: "remove: anObject\x0a\x09self errorReadOnly",
  3811. messageSends: ["errorReadOnly"],
  3812. referencedClasses: []
  3813. }),
  3814. globals.CharacterArray);
  3815. smalltalk.addMethod(
  3816. smalltalk.method({
  3817. selector: "fromString:",
  3818. protocol: 'instance creation',
  3819. fn: function (aString){
  3820. var self=this;
  3821. return smalltalk.withContext(function($ctx1) {
  3822. self._subclassResponsibility();
  3823. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)})},
  3824. args: ["aString"],
  3825. source: "fromString: aString\x0a\x09self subclassResponsibility",
  3826. messageSends: ["subclassResponsibility"],
  3827. referencedClasses: []
  3828. }),
  3829. globals.CharacterArray.klass);
  3830. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  3831. globals.String.comment="I am an indexed collection of Characters. Unlike most Smalltalk dialects, Amber doesn't provide the Character class. Instead, elements of a String are single character strings.\x0a\x0aString inherits many useful methods from its hierarchy, such as\x0a\x09`Collection >> #,`";
  3832. smalltalk.addMethod(
  3833. smalltalk.method({
  3834. selector: ",",
  3835. protocol: 'copying',
  3836. fn: function (aString){
  3837. var self=this;
  3838. return smalltalk.withContext(function($ctx1) {
  3839. return String(self) + aString;
  3840. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)})},
  3841. args: ["aString"],
  3842. source: ", aString\x0a\x09<return String(self) + aString>",
  3843. messageSends: [],
  3844. referencedClasses: []
  3845. }),
  3846. globals.String);
  3847. smalltalk.addMethod(
  3848. smalltalk.method({
  3849. selector: "<",
  3850. protocol: 'comparing',
  3851. fn: function (aString){
  3852. var self=this;
  3853. return smalltalk.withContext(function($ctx1) {
  3854. return String(self) < aString._asString();
  3855. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)})},
  3856. args: ["aString"],
  3857. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  3858. messageSends: [],
  3859. referencedClasses: []
  3860. }),
  3861. globals.String);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "<=",
  3865. protocol: 'comparing',
  3866. fn: function (aString){
  3867. var self=this;
  3868. return smalltalk.withContext(function($ctx1) {
  3869. return String(self) <= aString._asString();
  3870. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)})},
  3871. args: ["aString"],
  3872. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  3873. messageSends: [],
  3874. referencedClasses: []
  3875. }),
  3876. globals.String);
  3877. smalltalk.addMethod(
  3878. smalltalk.method({
  3879. selector: "=",
  3880. protocol: 'comparing',
  3881. fn: function (aString){
  3882. var self=this;
  3883. return smalltalk.withContext(function($ctx1) {
  3884. return aString != null &&
  3885. typeof aString._isString === "function" &&
  3886. aString._isString() &&
  3887. String(self) === String(aString)
  3888. ;
  3889. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)})},
  3890. args: ["aString"],
  3891. source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
  3892. messageSends: [],
  3893. referencedClasses: []
  3894. }),
  3895. globals.String);
  3896. smalltalk.addMethod(
  3897. smalltalk.method({
  3898. selector: "==",
  3899. protocol: 'comparing',
  3900. fn: function (aString){
  3901. var self=this;
  3902. return smalltalk.withContext(function($ctx1) {
  3903. var $1;
  3904. $1=self.__eq(aString);
  3905. return $1;
  3906. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)})},
  3907. args: ["aString"],
  3908. source: "== aString\x0a\x09^ self = aString",
  3909. messageSends: ["="],
  3910. referencedClasses: []
  3911. }),
  3912. globals.String);
  3913. smalltalk.addMethod(
  3914. smalltalk.method({
  3915. selector: ">",
  3916. protocol: 'comparing',
  3917. fn: function (aString){
  3918. var self=this;
  3919. return smalltalk.withContext(function($ctx1) {
  3920. return String(self) > aString._asString();
  3921. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)})},
  3922. args: ["aString"],
  3923. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  3924. messageSends: [],
  3925. referencedClasses: []
  3926. }),
  3927. globals.String);
  3928. smalltalk.addMethod(
  3929. smalltalk.method({
  3930. selector: ">=",
  3931. protocol: 'comparing',
  3932. fn: function (aString){
  3933. var self=this;
  3934. return smalltalk.withContext(function($ctx1) {
  3935. return String(self) >= aString._asString();
  3936. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)})},
  3937. args: ["aString"],
  3938. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  3939. messageSends: [],
  3940. referencedClasses: []
  3941. }),
  3942. globals.String);
  3943. smalltalk.addMethod(
  3944. smalltalk.method({
  3945. selector: "asJSON",
  3946. protocol: 'converting',
  3947. fn: function (){
  3948. var self=this;
  3949. return self;
  3950. },
  3951. args: [],
  3952. source: "asJSON\x0a\x09^ self",
  3953. messageSends: [],
  3954. referencedClasses: []
  3955. }),
  3956. globals.String);
  3957. smalltalk.addMethod(
  3958. smalltalk.method({
  3959. selector: "asJavascript",
  3960. protocol: 'converting',
  3961. fn: function (){
  3962. var self=this;
  3963. return smalltalk.withContext(function($ctx1) {
  3964. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  3965. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  3966. else
  3967. return "\"" + self + "\"";
  3968. ;
  3969. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)})},
  3970. args: [],
  3971. source: "asJavascript\x0a\x09<\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09>",
  3972. messageSends: [],
  3973. referencedClasses: []
  3974. }),
  3975. globals.String);
  3976. smalltalk.addMethod(
  3977. smalltalk.method({
  3978. selector: "asLowercase",
  3979. protocol: 'converting',
  3980. fn: function (){
  3981. var self=this;
  3982. return smalltalk.withContext(function($ctx1) {
  3983. return self.toLowerCase();
  3984. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)})},
  3985. args: [],
  3986. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  3987. messageSends: [],
  3988. referencedClasses: []
  3989. }),
  3990. globals.String);
  3991. smalltalk.addMethod(
  3992. smalltalk.method({
  3993. selector: "asMutator",
  3994. protocol: 'converting',
  3995. fn: function (){
  3996. var self=this;
  3997. return smalltalk.withContext(function($ctx1) {
  3998. var $1,$2;
  3999. $1=_st(self._last()).__eq(":");
  4000. if(! smalltalk.assert($1)){
  4001. $2=self.__comma(":");
  4002. return $2;
  4003. };
  4004. return self;
  4005. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)})},
  4006. args: [],
  4007. source: "asMutator\x0a\x09\x22Answer a setter selector. For example,\x0a\x09#name asMutator returns #name:\x22\x0a\x0a\x09self last = ':' ifFalse: [ ^ self, ':' ].\x0a\x09^ self",
  4008. messageSends: ["ifFalse:", "=", "last", ","],
  4009. referencedClasses: []
  4010. }),
  4011. globals.String);
  4012. smalltalk.addMethod(
  4013. smalltalk.method({
  4014. selector: "asNumber",
  4015. protocol: 'converting',
  4016. fn: function (){
  4017. var self=this;
  4018. return smalltalk.withContext(function($ctx1) {
  4019. return Number(self);
  4020. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)})},
  4021. args: [],
  4022. source: "asNumber\x0a\x09<return Number(self)>",
  4023. messageSends: [],
  4024. referencedClasses: []
  4025. }),
  4026. globals.String);
  4027. smalltalk.addMethod(
  4028. smalltalk.method({
  4029. selector: "asRegexp",
  4030. protocol: 'converting',
  4031. fn: function (){
  4032. var self=this;
  4033. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  4034. return smalltalk.withContext(function($ctx1) {
  4035. var $1;
  4036. $1=_st($RegularExpression())._fromString_(self);
  4037. return $1;
  4038. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)})},
  4039. args: [],
  4040. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  4041. messageSends: ["fromString:"],
  4042. referencedClasses: ["RegularExpression"]
  4043. }),
  4044. globals.String);
  4045. smalltalk.addMethod(
  4046. smalltalk.method({
  4047. selector: "asSelector",
  4048. protocol: 'converting',
  4049. fn: function (){
  4050. var self=this;
  4051. return smalltalk.withContext(function($ctx1) {
  4052. return smalltalk.selector(self);
  4053. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)})},
  4054. args: [],
  4055. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  4056. messageSends: [],
  4057. referencedClasses: []
  4058. }),
  4059. globals.String);
  4060. smalltalk.addMethod(
  4061. smalltalk.method({
  4062. selector: "asString",
  4063. protocol: 'converting',
  4064. fn: function (){
  4065. var self=this;
  4066. return self;
  4067. },
  4068. args: [],
  4069. source: "asString\x0a\x09^ self",
  4070. messageSends: [],
  4071. referencedClasses: []
  4072. }),
  4073. globals.String);
  4074. smalltalk.addMethod(
  4075. smalltalk.method({
  4076. selector: "asSymbol",
  4077. protocol: 'converting',
  4078. fn: function (){
  4079. var self=this;
  4080. return self;
  4081. },
  4082. args: [],
  4083. source: "asSymbol\x0a\x09^ self",
  4084. messageSends: [],
  4085. referencedClasses: []
  4086. }),
  4087. globals.String);
  4088. smalltalk.addMethod(
  4089. smalltalk.method({
  4090. selector: "asUppercase",
  4091. protocol: 'converting',
  4092. fn: function (){
  4093. var self=this;
  4094. return smalltalk.withContext(function($ctx1) {
  4095. return self.toUpperCase();
  4096. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)})},
  4097. args: [],
  4098. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  4099. messageSends: [],
  4100. referencedClasses: []
  4101. }),
  4102. globals.String);
  4103. smalltalk.addMethod(
  4104. smalltalk.method({
  4105. selector: "asciiValue",
  4106. protocol: 'accessing',
  4107. fn: function (){
  4108. var self=this;
  4109. return smalltalk.withContext(function($ctx1) {
  4110. return self.charCodeAt(0);;
  4111. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)})},
  4112. args: [],
  4113. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  4114. messageSends: [],
  4115. referencedClasses: []
  4116. }),
  4117. globals.String);
  4118. smalltalk.addMethod(
  4119. smalltalk.method({
  4120. selector: "at:ifAbsent:",
  4121. protocol: 'accessing',
  4122. fn: function (anIndex,aBlock){
  4123. var self=this;
  4124. return smalltalk.withContext(function($ctx1) {
  4125. return String(self)[anIndex - 1] || aBlock._value();
  4126. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)})},
  4127. args: ["anIndex", "aBlock"],
  4128. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  4129. messageSends: [],
  4130. referencedClasses: []
  4131. }),
  4132. globals.String);
  4133. smalltalk.addMethod(
  4134. smalltalk.method({
  4135. selector: "at:ifPresent:ifAbsent:",
  4136. protocol: 'accessing',
  4137. fn: function (anIndex,aBlock,anotherBlock){
  4138. var self=this;
  4139. return smalltalk.withContext(function($ctx1) {
  4140. var result = String(self)[anIndex - 1];
  4141. return result ? aBlock._value_(result) : anotherBlock._value();
  4142. ;
  4143. return self}, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)})},
  4144. args: ["anIndex", "aBlock", "anotherBlock"],
  4145. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  4146. messageSends: [],
  4147. referencedClasses: []
  4148. }),
  4149. globals.String);
  4150. smalltalk.addMethod(
  4151. smalltalk.method({
  4152. selector: "capitalized",
  4153. protocol: 'converting',
  4154. fn: function (){
  4155. var self=this;
  4156. return smalltalk.withContext(function($ctx1) {
  4157. var $2,$1;
  4158. $2=self._isEmpty();
  4159. if(smalltalk.assert($2)){
  4160. $1=self;
  4161. } else {
  4162. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  4163. };
  4164. return $1;
  4165. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)})},
  4166. args: [],
  4167. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  4168. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"],
  4169. referencedClasses: []
  4170. }),
  4171. globals.String);
  4172. smalltalk.addMethod(
  4173. smalltalk.method({
  4174. selector: "charCodeAt:",
  4175. protocol: 'accessing',
  4176. fn: function (anInteger){
  4177. var self=this;
  4178. return smalltalk.withContext(function($ctx1) {
  4179. return self.charCodeAt(anInteger - 1);
  4180. return self}, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)})},
  4181. args: ["anInteger"],
  4182. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  4183. messageSends: [],
  4184. referencedClasses: []
  4185. }),
  4186. globals.String);
  4187. smalltalk.addMethod(
  4188. smalltalk.method({
  4189. selector: "copyFrom:to:",
  4190. protocol: 'copying',
  4191. fn: function (anIndex,anotherIndex){
  4192. var self=this;
  4193. return smalltalk.withContext(function($ctx1) {
  4194. return self.substring(anIndex - 1, anotherIndex);
  4195. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)})},
  4196. args: ["anIndex", "anotherIndex"],
  4197. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  4198. messageSends: [],
  4199. referencedClasses: []
  4200. }),
  4201. globals.String);
  4202. smalltalk.addMethod(
  4203. smalltalk.method({
  4204. selector: "crlfSanitized",
  4205. protocol: 'converting',
  4206. fn: function (){
  4207. var self=this;
  4208. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4209. return smalltalk.withContext(function($ctx1) {
  4210. var $1;
  4211. $1=_st(self._lines())._join_(_st($String())._lf());
  4212. return $1;
  4213. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)})},
  4214. args: [],
  4215. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  4216. messageSends: ["join:", "lines", "lf"],
  4217. referencedClasses: ["String"]
  4218. }),
  4219. globals.String);
  4220. smalltalk.addMethod(
  4221. smalltalk.method({
  4222. selector: "deepCopy",
  4223. protocol: 'copying',
  4224. fn: function (){
  4225. var self=this;
  4226. return smalltalk.withContext(function($ctx1) {
  4227. var $1;
  4228. $1=self._shallowCopy();
  4229. return $1;
  4230. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)})},
  4231. args: [],
  4232. source: "deepCopy\x0a\x09^ self shallowCopy",
  4233. messageSends: ["shallowCopy"],
  4234. referencedClasses: []
  4235. }),
  4236. globals.String);
  4237. smalltalk.addMethod(
  4238. smalltalk.method({
  4239. selector: "escaped",
  4240. protocol: 'converting',
  4241. fn: function (){
  4242. var self=this;
  4243. return smalltalk.withContext(function($ctx1) {
  4244. return escape(self);
  4245. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)})},
  4246. args: [],
  4247. source: "escaped\x0a\x09<return escape(self)>",
  4248. messageSends: [],
  4249. referencedClasses: []
  4250. }),
  4251. globals.String);
  4252. smalltalk.addMethod(
  4253. smalltalk.method({
  4254. selector: "identityHash",
  4255. protocol: 'accessing',
  4256. fn: function (){
  4257. var self=this;
  4258. return smalltalk.withContext(function($ctx1) {
  4259. var $1;
  4260. $1=self.__comma("s");
  4261. return $1;
  4262. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)})},
  4263. args: [],
  4264. source: "identityHash\x0a\x09^ self, 's'",
  4265. messageSends: [","],
  4266. referencedClasses: []
  4267. }),
  4268. globals.String);
  4269. smalltalk.addMethod(
  4270. smalltalk.method({
  4271. selector: "includesSubString:",
  4272. protocol: 'testing',
  4273. fn: function (subString){
  4274. var self=this;
  4275. return smalltalk.withContext(function($ctx1) {
  4276. return self.indexOf(subString) != -1;
  4277. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)})},
  4278. args: ["subString"],
  4279. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  4280. messageSends: [],
  4281. referencedClasses: []
  4282. }),
  4283. globals.String);
  4284. smalltalk.addMethod(
  4285. smalltalk.method({
  4286. selector: "isCapitalized",
  4287. protocol: 'testing',
  4288. fn: function (){
  4289. var self=this;
  4290. return smalltalk.withContext(function($ctx1) {
  4291. var $3,$2,$1;
  4292. $3=self._first();
  4293. $ctx1.sendIdx["first"]=1;
  4294. $2=_st($3)._asUppercase();
  4295. $1=_st($2).__eq_eq(self._first());
  4296. return $1;
  4297. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)})},
  4298. args: [],
  4299. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  4300. messageSends: ["==", "asUppercase", "first"],
  4301. referencedClasses: []
  4302. }),
  4303. globals.String);
  4304. smalltalk.addMethod(
  4305. smalltalk.method({
  4306. selector: "isImmutable",
  4307. protocol: 'testing',
  4308. fn: function (){
  4309. var self=this;
  4310. return true;
  4311. },
  4312. args: [],
  4313. source: "isImmutable\x0a\x09^ true",
  4314. messageSends: [],
  4315. referencedClasses: []
  4316. }),
  4317. globals.String);
  4318. smalltalk.addMethod(
  4319. smalltalk.method({
  4320. selector: "isString",
  4321. protocol: 'testing',
  4322. fn: function (){
  4323. var self=this;
  4324. return true;
  4325. },
  4326. args: [],
  4327. source: "isString\x0a\x09^ true",
  4328. messageSends: [],
  4329. referencedClasses: []
  4330. }),
  4331. globals.String);
  4332. smalltalk.addMethod(
  4333. smalltalk.method({
  4334. selector: "isVowel",
  4335. protocol: 'testing',
  4336. fn: function (){
  4337. var self=this;
  4338. return smalltalk.withContext(function($ctx1) {
  4339. var $1;
  4340. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  4341. return smalltalk.withContext(function($ctx2) {
  4342. return "aeiou"._includes_(self._asLowercase());
  4343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4344. return $1;
  4345. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)})},
  4346. args: [],
  4347. source: "isVowel\x0a\x09\x22Answer true if the receiver is a one character string containing a voyel\x22\x0a\x09\x0a\x09^ self size = 1 and: [ 'aeiou' includes: self asLowercase ]",
  4348. messageSends: ["and:", "=", "size", "includes:", "asLowercase"],
  4349. referencedClasses: []
  4350. }),
  4351. globals.String);
  4352. smalltalk.addMethod(
  4353. smalltalk.method({
  4354. selector: "join:",
  4355. protocol: 'split join',
  4356. fn: function (aCollection){
  4357. var self=this;
  4358. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4359. return smalltalk.withContext(function($ctx1) {
  4360. var $1;
  4361. $1=_st($String())._streamContents_((function(stream){
  4362. return smalltalk.withContext(function($ctx2) {
  4363. return _st(aCollection)._do_separatedBy_((function(each){
  4364. return smalltalk.withContext(function($ctx3) {
  4365. return _st(stream)._nextPutAll_(_st(each)._asString());
  4366. $ctx3.sendIdx["nextPutAll:"]=1;
  4367. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}),(function(){
  4368. return smalltalk.withContext(function($ctx3) {
  4369. return _st(stream)._nextPutAll_(self);
  4370. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  4371. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  4372. return $1;
  4373. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)})},
  4374. args: ["aCollection"],
  4375. source: "join: aCollection\x0a\x09^ String\x0a\x09\x09streamContents: [ :stream | aCollection\x0a\x09\x09\x09\x09do: [ :each | stream nextPutAll: each asString ]\x0a\x09\x09\x09\x09separatedBy: [ stream nextPutAll: self ]]",
  4376. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  4377. referencedClasses: ["String"]
  4378. }),
  4379. globals.String);
  4380. smalltalk.addMethod(
  4381. smalltalk.method({
  4382. selector: "lineIndicesDo:",
  4383. protocol: 'split join',
  4384. fn: function (aBlock){
  4385. var self=this;
  4386. var cr,lf,start,sz,nextLF,nextCR;
  4387. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4388. return smalltalk.withContext(function($ctx1) {
  4389. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  4390. var $early={};
  4391. try {
  4392. start=(1);
  4393. sz=self._size();
  4394. cr=_st($String())._cr();
  4395. nextCR=self._indexOf_startingAt_(cr,(1));
  4396. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  4397. lf=_st($String())._lf();
  4398. nextLF=self._indexOf_startingAt_(lf,(1));
  4399. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  4400. _st((function(){
  4401. return smalltalk.withContext(function($ctx2) {
  4402. return _st(start).__lt_eq(sz);
  4403. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  4404. return smalltalk.withContext(function($ctx2) {
  4405. $2=_st(nextLF).__eq((0));
  4406. $ctx2.sendIdx["="]=1;
  4407. $1=_st($2)._and_((function(){
  4408. return smalltalk.withContext(function($ctx3) {
  4409. return _st(nextCR).__eq((0));
  4410. $ctx3.sendIdx["="]=2;
  4411. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  4412. $ctx2.sendIdx["and:"]=1;
  4413. if(smalltalk.assert($1)){
  4414. _st(aBlock)._value_value_value_(start,sz,sz);
  4415. $ctx2.sendIdx["value:value:value:"]=1;
  4416. throw $early=[self];
  4417. };
  4418. $4=_st(nextCR).__eq((0));
  4419. $ctx2.sendIdx["="]=3;
  4420. $3=_st($4)._or_((function(){
  4421. return smalltalk.withContext(function($ctx3) {
  4422. $5=(0).__lt(nextLF);
  4423. $ctx3.sendIdx["<"]=1;
  4424. return _st($5)._and_((function(){
  4425. return smalltalk.withContext(function($ctx4) {
  4426. return _st(nextLF).__lt(nextCR);
  4427. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)})}));
  4428. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
  4429. if(smalltalk.assert($3)){
  4430. $6=start;
  4431. $7=_st(nextLF).__minus((1));
  4432. $ctx2.sendIdx["-"]=1;
  4433. _st(aBlock)._value_value_value_($6,$7,nextLF);
  4434. $ctx2.sendIdx["value:value:value:"]=2;
  4435. start=(1).__plus(nextLF);
  4436. $ctx2.sendIdx["+"]=1;
  4437. start;
  4438. nextLF=self._indexOf_startingAt_(lf,start);
  4439. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  4440. return nextLF;
  4441. } else {
  4442. $9=(1).__plus(nextCR);
  4443. $ctx2.sendIdx["+"]=2;
  4444. $8=_st($9).__eq(nextLF);
  4445. if(smalltalk.assert($8)){
  4446. $10=start;
  4447. $11=_st(nextCR).__minus((1));
  4448. $ctx2.sendIdx["-"]=2;
  4449. _st(aBlock)._value_value_value_($10,$11,nextLF);
  4450. $ctx2.sendIdx["value:value:value:"]=3;
  4451. start=(1).__plus(nextLF);
  4452. $ctx2.sendIdx["+"]=3;
  4453. start;
  4454. nextCR=self._indexOf_startingAt_(cr,start);
  4455. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  4456. nextCR;
  4457. nextLF=self._indexOf_startingAt_(lf,start);
  4458. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  4459. return nextLF;
  4460. } else {
  4461. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  4462. start=(1).__plus(nextCR);
  4463. start;
  4464. nextCR=self._indexOf_startingAt_(cr,start);
  4465. return nextCR;
  4466. };
  4467. };
  4468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4469. return self}
  4470. catch(e) {if(e===$early)return e[0]; throw e}
  4471. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)})},
  4472. args: ["aBlock"],
  4473. source: "lineIndicesDo: aBlock\x0a\x09\x22execute aBlock with 3 arguments for each line:\x0a\x09- start index of line\x0a\x09- end index of line without line delimiter\x0a\x09- end index of line including line delimiter(s) CR, LF or CRLF\x22\x0a\x09\x0a\x09| cr lf start sz nextLF nextCR |\x0a\x09start := 1.\x0a\x09sz := self size.\x0a\x09cr := String cr.\x0a\x09nextCR := self indexOf: cr startingAt: 1.\x0a\x09lf := String lf.\x0a\x09nextLF := self indexOf: lf startingAt: 1.\x0a\x09[ start <= sz ] whileTrue: [ \x0a\x09\x09(nextLF = 0 and: [ nextCR = 0 ])\x0a\x09\x09\x09ifTrue: [ \x22No more CR, nor LF, the string is over\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: sz value: sz.\x0a\x09\x09\x09\x09\x09^ self ].\x0a\x09\x09(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])\x0a\x09\x09\x09ifTrue: [ \x22Found a LF\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextLF - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09ifFalse: [ 1 + nextCR = nextLF\x0a\x09\x09\x09\x09ifTrue: [ \x22Found a CR-LF pair\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextLF.\x0a\x09\x09\x09\x09\x09start := 1 + nextLF.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start.\x0a\x09\x09\x09\x09\x09nextLF := self indexOf: lf startingAt: start ]\x0a\x09\x09\x09\x09ifFalse: [ \x22Found a CR\x22\x0a\x09\x09\x09\x09\x09aBlock value: start value: nextCR - 1 value: nextCR.\x0a\x09\x09\x09\x09\x09start := 1 + nextCR.\x0a\x09\x09\x09\x09\x09nextCR := self indexOf: cr startingAt: start ] ]]",
  4474. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  4475. referencedClasses: ["String"]
  4476. }),
  4477. globals.String);
  4478. smalltalk.addMethod(
  4479. smalltalk.method({
  4480. selector: "lineNumber:",
  4481. protocol: 'split join',
  4482. fn: function (anIndex){
  4483. var self=this;
  4484. var lineCount;
  4485. return smalltalk.withContext(function($ctx1) {
  4486. var $2,$1,$3;
  4487. var $early={};
  4488. try {
  4489. lineCount=(0);
  4490. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  4491. return smalltalk.withContext(function($ctx2) {
  4492. lineCount=_st(lineCount).__plus((1));
  4493. $2=lineCount;
  4494. $1=_st($2).__eq(anIndex);
  4495. if(smalltalk.assert($1)){
  4496. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  4497. throw $early=[$3];
  4498. };
  4499. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  4500. return nil;
  4501. }
  4502. catch(e) {if(e===$early)return e[0]; throw e}
  4503. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)})},
  4504. args: ["anIndex"],
  4505. source: "lineNumber: anIndex\x0a\x09\x22Answer a string containing the characters in the given line number.\x22\x0a\x0a\x09| lineCount |\x0a\x09lineCount := 0.\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09(lineCount := lineCount + 1) = anIndex ifTrue: [ ^ self copyFrom: start to: endWithoutDelimiters ]].\x0a\x09^ nil",
  4506. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  4507. referencedClasses: []
  4508. }),
  4509. globals.String);
  4510. smalltalk.addMethod(
  4511. smalltalk.method({
  4512. selector: "lines",
  4513. protocol: 'split join',
  4514. fn: function (){
  4515. var self=this;
  4516. var lines;
  4517. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4518. return smalltalk.withContext(function($ctx1) {
  4519. var $1;
  4520. lines=_st($Array())._new();
  4521. self._linesDo_((function(aLine){
  4522. return smalltalk.withContext(function($ctx2) {
  4523. return _st(lines)._add_(aLine);
  4524. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)})}));
  4525. $1=lines;
  4526. return $1;
  4527. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)})},
  4528. args: [],
  4529. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  4530. messageSends: ["new", "linesDo:", "add:"],
  4531. referencedClasses: ["Array"]
  4532. }),
  4533. globals.String);
  4534. smalltalk.addMethod(
  4535. smalltalk.method({
  4536. selector: "linesDo:",
  4537. protocol: 'split join',
  4538. fn: function (aBlock){
  4539. var self=this;
  4540. return smalltalk.withContext(function($ctx1) {
  4541. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  4542. return smalltalk.withContext(function($ctx2) {
  4543. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  4544. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)})}));
  4545. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)})},
  4546. args: ["aBlock"],
  4547. source: "linesDo: aBlock\x0a\x09\x22Execute aBlock with each line in this string. The terminating line\x0a\x09delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock\x22\x0a\x0a\x09self lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  4548. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  4549. referencedClasses: []
  4550. }),
  4551. globals.String);
  4552. smalltalk.addMethod(
  4553. smalltalk.method({
  4554. selector: "match:",
  4555. protocol: 'regular expressions',
  4556. fn: function (aRegexp){
  4557. var self=this;
  4558. return smalltalk.withContext(function($ctx1) {
  4559. return self.search(aRegexp) != -1;
  4560. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)})},
  4561. args: ["aRegexp"],
  4562. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  4563. messageSends: [],
  4564. referencedClasses: []
  4565. }),
  4566. globals.String);
  4567. smalltalk.addMethod(
  4568. smalltalk.method({
  4569. selector: "matchesOf:",
  4570. protocol: 'regular expressions',
  4571. fn: function (aRegularExpression){
  4572. var self=this;
  4573. return smalltalk.withContext(function($ctx1) {
  4574. return self.match(aRegularExpression);
  4575. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)})},
  4576. args: ["aRegularExpression"],
  4577. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  4578. messageSends: [],
  4579. referencedClasses: []
  4580. }),
  4581. globals.String);
  4582. smalltalk.addMethod(
  4583. smalltalk.method({
  4584. selector: "numericallyIndexable",
  4585. protocol: 'private',
  4586. fn: function (){
  4587. var self=this;
  4588. return smalltalk.withContext(function($ctx1) {
  4589. return String(self);
  4590. return self}, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)})},
  4591. args: [],
  4592. source: "numericallyIndexable\x0a\x09<return String(self)>",
  4593. messageSends: [],
  4594. referencedClasses: []
  4595. }),
  4596. globals.String);
  4597. smalltalk.addMethod(
  4598. smalltalk.method({
  4599. selector: "printNl",
  4600. protocol: 'printing',
  4601. fn: function (){
  4602. var self=this;
  4603. return smalltalk.withContext(function($ctx1) {
  4604. console.log(self);
  4605. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)})},
  4606. args: [],
  4607. source: "printNl\x0a\x09<console.log(self)>",
  4608. messageSends: [],
  4609. referencedClasses: []
  4610. }),
  4611. globals.String);
  4612. smalltalk.addMethod(
  4613. smalltalk.method({
  4614. selector: "printOn:",
  4615. protocol: 'printing',
  4616. fn: function (aStream){
  4617. var self=this;
  4618. return smalltalk.withContext(function($ctx1) {
  4619. var $1;
  4620. _st(aStream)._nextPutAll_("'");
  4621. $ctx1.sendIdx["nextPutAll:"]=1;
  4622. _st(aStream)._nextPutAll_(self);
  4623. $ctx1.sendIdx["nextPutAll:"]=2;
  4624. $1=_st(aStream)._nextPutAll_("'");
  4625. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)})},
  4626. args: ["aStream"],
  4627. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  4628. messageSends: ["nextPutAll:"],
  4629. referencedClasses: []
  4630. }),
  4631. globals.String);
  4632. smalltalk.addMethod(
  4633. smalltalk.method({
  4634. selector: "replace:with:",
  4635. protocol: 'regular expressions',
  4636. fn: function (aString,anotherString){
  4637. var self=this;
  4638. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  4639. return smalltalk.withContext(function($ctx1) {
  4640. var $1;
  4641. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  4642. return $1;
  4643. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)})},
  4644. args: ["aString", "anotherString"],
  4645. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  4646. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  4647. referencedClasses: ["RegularExpression"]
  4648. }),
  4649. globals.String);
  4650. smalltalk.addMethod(
  4651. smalltalk.method({
  4652. selector: "replaceRegexp:with:",
  4653. protocol: 'regular expressions',
  4654. fn: function (aRegexp,aString){
  4655. var self=this;
  4656. return smalltalk.withContext(function($ctx1) {
  4657. return self.replace(aRegexp, aString);
  4658. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)})},
  4659. args: ["aRegexp", "aString"],
  4660. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  4661. messageSends: [],
  4662. referencedClasses: []
  4663. }),
  4664. globals.String);
  4665. smalltalk.addMethod(
  4666. smalltalk.method({
  4667. selector: "reversed",
  4668. protocol: 'converting',
  4669. fn: function (){
  4670. var self=this;
  4671. return smalltalk.withContext(function($ctx1) {
  4672. return self.split("").reverse().join("");
  4673. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)})},
  4674. args: [],
  4675. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  4676. messageSends: [],
  4677. referencedClasses: []
  4678. }),
  4679. globals.String);
  4680. smalltalk.addMethod(
  4681. smalltalk.method({
  4682. selector: "shallowCopy",
  4683. protocol: 'copying',
  4684. fn: function (){
  4685. var self=this;
  4686. return smalltalk.withContext(function($ctx1) {
  4687. var $1;
  4688. $1=_st(self._class())._fromString_(self);
  4689. return $1;
  4690. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)})},
  4691. args: [],
  4692. source: "shallowCopy\x0a\x09^ self class fromString: self",
  4693. messageSends: ["fromString:", "class"],
  4694. referencedClasses: []
  4695. }),
  4696. globals.String);
  4697. smalltalk.addMethod(
  4698. smalltalk.method({
  4699. selector: "size",
  4700. protocol: 'accessing',
  4701. fn: function (){
  4702. var self=this;
  4703. return smalltalk.withContext(function($ctx1) {
  4704. return self.length;
  4705. return self}, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)})},
  4706. args: [],
  4707. source: "size\x0a\x09<return self.length>",
  4708. messageSends: [],
  4709. referencedClasses: []
  4710. }),
  4711. globals.String);
  4712. smalltalk.addMethod(
  4713. smalltalk.method({
  4714. selector: "subStrings:",
  4715. protocol: 'split join',
  4716. fn: function (aString){
  4717. var self=this;
  4718. return smalltalk.withContext(function($ctx1) {
  4719. var $1;
  4720. $1=self._tokenize_(aString);
  4721. return $1;
  4722. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)})},
  4723. args: ["aString"],
  4724. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  4725. messageSends: ["tokenize:"],
  4726. referencedClasses: []
  4727. }),
  4728. globals.String);
  4729. smalltalk.addMethod(
  4730. smalltalk.method({
  4731. selector: "tokenize:",
  4732. protocol: 'split join',
  4733. fn: function (aString){
  4734. var self=this;
  4735. return smalltalk.withContext(function($ctx1) {
  4736. return self.split(aString);
  4737. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)})},
  4738. args: ["aString"],
  4739. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  4740. messageSends: [],
  4741. referencedClasses: []
  4742. }),
  4743. globals.String);
  4744. smalltalk.addMethod(
  4745. smalltalk.method({
  4746. selector: "trimBoth",
  4747. protocol: 'regular expressions',
  4748. fn: function (){
  4749. var self=this;
  4750. return smalltalk.withContext(function($ctx1) {
  4751. var $1;
  4752. $1=self._trimBoth_("\x5cs");
  4753. return $1;
  4754. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)})},
  4755. args: [],
  4756. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  4757. messageSends: ["trimBoth:"],
  4758. referencedClasses: []
  4759. }),
  4760. globals.String);
  4761. smalltalk.addMethod(
  4762. smalltalk.method({
  4763. selector: "trimBoth:",
  4764. protocol: 'regular expressions',
  4765. fn: function (separators){
  4766. var self=this;
  4767. return smalltalk.withContext(function($ctx1) {
  4768. var $1;
  4769. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  4770. return $1;
  4771. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)})},
  4772. args: ["separators"],
  4773. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  4774. messageSends: ["trimRight:", "trimLeft:"],
  4775. referencedClasses: []
  4776. }),
  4777. globals.String);
  4778. smalltalk.addMethod(
  4779. smalltalk.method({
  4780. selector: "trimLeft",
  4781. protocol: 'regular expressions',
  4782. fn: function (){
  4783. var self=this;
  4784. return smalltalk.withContext(function($ctx1) {
  4785. var $1;
  4786. $1=self._trimLeft_("\x5cs");
  4787. return $1;
  4788. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)})},
  4789. args: [],
  4790. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  4791. messageSends: ["trimLeft:"],
  4792. referencedClasses: []
  4793. }),
  4794. globals.String);
  4795. smalltalk.addMethod(
  4796. smalltalk.method({
  4797. selector: "trimLeft:",
  4798. protocol: 'regular expressions',
  4799. fn: function (separators){
  4800. var self=this;
  4801. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  4802. return smalltalk.withContext(function($ctx1) {
  4803. var $3,$2,$1;
  4804. $3=_st("^[".__comma(separators)).__comma("]+");
  4805. $ctx1.sendIdx[","]=1;
  4806. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  4807. $1=self._replaceRegexp_with_($2,"");
  4808. return $1;
  4809. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)})},
  4810. args: ["separators"],
  4811. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  4812. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  4813. referencedClasses: ["RegularExpression"]
  4814. }),
  4815. globals.String);
  4816. smalltalk.addMethod(
  4817. smalltalk.method({
  4818. selector: "trimRight",
  4819. protocol: 'regular expressions',
  4820. fn: function (){
  4821. var self=this;
  4822. return smalltalk.withContext(function($ctx1) {
  4823. var $1;
  4824. $1=self._trimRight_("\x5cs");
  4825. return $1;
  4826. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)})},
  4827. args: [],
  4828. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  4829. messageSends: ["trimRight:"],
  4830. referencedClasses: []
  4831. }),
  4832. globals.String);
  4833. smalltalk.addMethod(
  4834. smalltalk.method({
  4835. selector: "trimRight:",
  4836. protocol: 'regular expressions',
  4837. fn: function (separators){
  4838. var self=this;
  4839. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  4840. return smalltalk.withContext(function($ctx1) {
  4841. var $3,$2,$1;
  4842. $3=_st("[".__comma(separators)).__comma("]+$");
  4843. $ctx1.sendIdx[","]=1;
  4844. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  4845. $1=self._replaceRegexp_with_($2,"");
  4846. return $1;
  4847. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)})},
  4848. args: ["separators"],
  4849. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  4850. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  4851. referencedClasses: ["RegularExpression"]
  4852. }),
  4853. globals.String);
  4854. smalltalk.addMethod(
  4855. smalltalk.method({
  4856. selector: "unescaped",
  4857. protocol: 'converting',
  4858. fn: function (){
  4859. var self=this;
  4860. return smalltalk.withContext(function($ctx1) {
  4861. return unescape(self);
  4862. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)})},
  4863. args: [],
  4864. source: "unescaped\x0a\x09<return unescape(self)>",
  4865. messageSends: [],
  4866. referencedClasses: []
  4867. }),
  4868. globals.String);
  4869. smalltalk.addMethod(
  4870. smalltalk.method({
  4871. selector: "uriComponentDecoded",
  4872. protocol: 'converting',
  4873. fn: function (){
  4874. var self=this;
  4875. return smalltalk.withContext(function($ctx1) {
  4876. return decodeURIComponent(self);
  4877. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)})},
  4878. args: [],
  4879. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  4880. messageSends: [],
  4881. referencedClasses: []
  4882. }),
  4883. globals.String);
  4884. smalltalk.addMethod(
  4885. smalltalk.method({
  4886. selector: "uriComponentEncoded",
  4887. protocol: 'converting',
  4888. fn: function (){
  4889. var self=this;
  4890. return smalltalk.withContext(function($ctx1) {
  4891. return encodeURIComponent(self);
  4892. return self}, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)})},
  4893. args: [],
  4894. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  4895. messageSends: [],
  4896. referencedClasses: []
  4897. }),
  4898. globals.String);
  4899. smalltalk.addMethod(
  4900. smalltalk.method({
  4901. selector: "uriDecoded",
  4902. protocol: 'converting',
  4903. fn: function (){
  4904. var self=this;
  4905. return smalltalk.withContext(function($ctx1) {
  4906. return decodeURI(self);
  4907. return self}, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)})},
  4908. args: [],
  4909. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  4910. messageSends: [],
  4911. referencedClasses: []
  4912. }),
  4913. globals.String);
  4914. smalltalk.addMethod(
  4915. smalltalk.method({
  4916. selector: "uriEncoded",
  4917. protocol: 'converting',
  4918. fn: function (){
  4919. var self=this;
  4920. return smalltalk.withContext(function($ctx1) {
  4921. return encodeURI(self);
  4922. return self}, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)})},
  4923. args: [],
  4924. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  4925. messageSends: [],
  4926. referencedClasses: []
  4927. }),
  4928. globals.String);
  4929. smalltalk.addMethod(
  4930. smalltalk.method({
  4931. selector: "cr",
  4932. protocol: 'accessing',
  4933. fn: function (){
  4934. var self=this;
  4935. return smalltalk.withContext(function($ctx1) {
  4936. return '\r';
  4937. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)})},
  4938. args: [],
  4939. source: "cr\x0a\x09<return '\x5cr'>",
  4940. messageSends: [],
  4941. referencedClasses: []
  4942. }),
  4943. globals.String.klass);
  4944. smalltalk.addMethod(
  4945. smalltalk.method({
  4946. selector: "crlf",
  4947. protocol: 'accessing',
  4948. fn: function (){
  4949. var self=this;
  4950. return smalltalk.withContext(function($ctx1) {
  4951. return '\r\n';
  4952. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)})},
  4953. args: [],
  4954. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  4955. messageSends: [],
  4956. referencedClasses: []
  4957. }),
  4958. globals.String.klass);
  4959. smalltalk.addMethod(
  4960. smalltalk.method({
  4961. selector: "esc",
  4962. protocol: 'accessing',
  4963. fn: function (){
  4964. var self=this;
  4965. return smalltalk.withContext(function($ctx1) {
  4966. var $1;
  4967. $1=self._fromCharCode_((27));
  4968. return $1;
  4969. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)})},
  4970. args: [],
  4971. source: "esc\x0a\x09^ self fromCharCode: 27",
  4972. messageSends: ["fromCharCode:"],
  4973. referencedClasses: []
  4974. }),
  4975. globals.String.klass);
  4976. smalltalk.addMethod(
  4977. smalltalk.method({
  4978. selector: "fromCharCode:",
  4979. protocol: 'instance creation',
  4980. fn: function (anInteger){
  4981. var self=this;
  4982. return smalltalk.withContext(function($ctx1) {
  4983. return String.fromCharCode(anInteger);
  4984. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)})},
  4985. args: ["anInteger"],
  4986. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  4987. messageSends: [],
  4988. referencedClasses: []
  4989. }),
  4990. globals.String.klass);
  4991. smalltalk.addMethod(
  4992. smalltalk.method({
  4993. selector: "fromString:",
  4994. protocol: 'instance creation',
  4995. fn: function (aString){
  4996. var self=this;
  4997. return smalltalk.withContext(function($ctx1) {
  4998. return String(aString);
  4999. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)})},
  5000. args: ["aString"],
  5001. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  5002. messageSends: [],
  5003. referencedClasses: []
  5004. }),
  5005. globals.String.klass);
  5006. smalltalk.addMethod(
  5007. smalltalk.method({
  5008. selector: "lf",
  5009. protocol: 'accessing',
  5010. fn: function (){
  5011. var self=this;
  5012. return smalltalk.withContext(function($ctx1) {
  5013. return '\n';
  5014. return self}, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)})},
  5015. args: [],
  5016. source: "lf\x0a\x09<return '\x5cn'>",
  5017. messageSends: [],
  5018. referencedClasses: []
  5019. }),
  5020. globals.String.klass);
  5021. smalltalk.addMethod(
  5022. smalltalk.method({
  5023. selector: "random",
  5024. protocol: 'random',
  5025. fn: function (){
  5026. var self=this;
  5027. return smalltalk.withContext(function($ctx1) {
  5028. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  5029. return self}, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)})},
  5030. args: [],
  5031. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  5032. messageSends: [],
  5033. referencedClasses: []
  5034. }),
  5035. globals.String.klass);
  5036. smalltalk.addMethod(
  5037. smalltalk.method({
  5038. selector: "randomNotIn:",
  5039. protocol: 'random',
  5040. fn: function (aString){
  5041. var self=this;
  5042. var result;
  5043. return smalltalk.withContext(function($ctx1) {
  5044. var $1;
  5045. _st((function(){
  5046. return smalltalk.withContext(function($ctx2) {
  5047. result=self._random();
  5048. result;
  5049. return _st(aString)._includesSubString_(result);
  5050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue();
  5051. $1=result;
  5052. return $1;
  5053. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)})},
  5054. args: ["aString"],
  5055. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  5056. messageSends: ["whileTrue", "random", "includesSubString:"],
  5057. referencedClasses: []
  5058. }),
  5059. globals.String.klass);
  5060. smalltalk.addMethod(
  5061. smalltalk.method({
  5062. selector: "space",
  5063. protocol: 'accessing',
  5064. fn: function (){
  5065. var self=this;
  5066. return smalltalk.withContext(function($ctx1) {
  5067. return ' ';
  5068. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)})},
  5069. args: [],
  5070. source: "space\x0a\x09<return ' '>",
  5071. messageSends: [],
  5072. referencedClasses: []
  5073. }),
  5074. globals.String.klass);
  5075. smalltalk.addMethod(
  5076. smalltalk.method({
  5077. selector: "streamClass",
  5078. protocol: 'accessing',
  5079. fn: function (){
  5080. var self=this;
  5081. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  5082. return $StringStream();
  5083. },
  5084. args: [],
  5085. source: "streamClass\x0a\x09\x09^ StringStream",
  5086. messageSends: [],
  5087. referencedClasses: ["StringStream"]
  5088. }),
  5089. globals.String.klass);
  5090. smalltalk.addMethod(
  5091. smalltalk.method({
  5092. selector: "tab",
  5093. protocol: 'accessing',
  5094. fn: function (){
  5095. var self=this;
  5096. return smalltalk.withContext(function($ctx1) {
  5097. return '\t';
  5098. return self}, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)})},
  5099. args: [],
  5100. source: "tab\x0a\x09<return '\x5ct'>",
  5101. messageSends: [],
  5102. referencedClasses: []
  5103. }),
  5104. globals.String.klass);
  5105. smalltalk.addMethod(
  5106. smalltalk.method({
  5107. selector: "value:",
  5108. protocol: 'instance creation',
  5109. fn: function (aUTFCharCode){
  5110. var self=this;
  5111. return smalltalk.withContext(function($ctx1) {
  5112. return String.fromCharCode(aUTFCharCode);;
  5113. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)})},
  5114. args: ["aUTFCharCode"],
  5115. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  5116. messageSends: [],
  5117. referencedClasses: []
  5118. }),
  5119. globals.String.klass);
  5120. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  5121. globals.Set.comment="I represent an unordered set of objects without duplicates.\x0a\x0a## Implementation notes\x0a\x0aI put elements into different stores based on their type.\x0aThe goal is to store some elements into native JS object property names to be fast.\x0a\x0aIf an unboxed element has typeof 'string', 'boolean' or 'number', or an element is nil, null or undefined,\x0aI store it as a property name in an empty (== Object.create(null)) JS object, different for each type\x0a(for simplicity, nil/null/undefined is treated as one and included with the two booleans).\x0a\x0aIf element happen to be an object, I try to store them in `ArrayBucketStore`. I have two of them by default,\x0aone hashed using the Smalltalk class name, the other one using the JS constructor name. It is possible to have more or less\x0ainstances of `ArrayBucketStores`, see `#initializeSlowBucketStores`.\x0a\x0aAs a last resort, if none of the `ArrayBucketStore` instances can find a suitable bucket, the `defaultBucket` is used,\x0awhich is an `Array`.";
  5122. smalltalk.addMethod(
  5123. smalltalk.method({
  5124. selector: "=",
  5125. protocol: 'comparing',
  5126. fn: function (aCollection){
  5127. var self=this;
  5128. return smalltalk.withContext(function($ctx1) {
  5129. var $2,$1,$4,$3,$5;
  5130. var $early={};
  5131. try {
  5132. $2=self._class();
  5133. $ctx1.sendIdx["class"]=1;
  5134. $1=_st($2).__eq(_st(aCollection)._class());
  5135. $ctx1.sendIdx["="]=1;
  5136. if(! smalltalk.assert($1)){
  5137. return false;
  5138. };
  5139. $4=self._size();
  5140. $ctx1.sendIdx["size"]=1;
  5141. $3=_st($4).__eq(_st(aCollection)._size());
  5142. if(! smalltalk.assert($3)){
  5143. return false;
  5144. };
  5145. self._do_((function(each){
  5146. return smalltalk.withContext(function($ctx2) {
  5147. $5=_st(aCollection)._includes_(each);
  5148. if(! smalltalk.assert($5)){
  5149. throw $early=[false];
  5150. };
  5151. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  5152. return true;
  5153. }
  5154. catch(e) {if(e===$early)return e[0]; throw e}
  5155. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)})},
  5156. args: ["aCollection"],
  5157. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a\x09self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [ :each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  5158. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  5159. referencedClasses: []
  5160. }),
  5161. globals.Set);
  5162. smalltalk.addMethod(
  5163. smalltalk.method({
  5164. selector: "add:",
  5165. protocol: 'adding/removing',
  5166. fn: function (anObject){
  5167. var self=this;
  5168. var bucket;
  5169. return smalltalk.withContext(function($ctx1) {
  5170. var $2,$1;
  5171. bucket=self._bucketsOfElement_(anObject);
  5172. $2=_st(bucket)._second();
  5173. if(($receiver = $2) == nil || $receiver == null){
  5174. var object,slowBucket;
  5175. object=_st(bucket)._first();
  5176. $ctx1.sendIdx["first"]=1;
  5177. object;
  5178. slowBucket=_st(bucket)._third();
  5179. slowBucket;
  5180. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  5181. return smalltalk.withContext(function($ctx2) {
  5182. _st(slowBucket)._add_(object);
  5183. self["@size"]=_st(self["@size"]).__plus((1));
  5184. return self["@size"];
  5185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5186. $1=object;
  5187. } else {
  5188. var primitiveBucket;
  5189. primitiveBucket=$receiver;
  5190. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  5191. };
  5192. return $1;
  5193. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)})},
  5194. args: ["anObject"],
  5195. source: "add: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [\x0a\x09\x09\x09| object slowBucket |\x0a\x09\x09\x09object := bucket first.\x0a\x09\x09\x09slowBucket := bucket third.\x0a\x09\x09\x09slowBucket \x0a\x09\x09\x09\x09indexOf: object \x0a\x09\x09\x09\x09ifAbsent: [ \x0a\x09\x09\x09\x09\x09slowBucket add: object. \x0a\x09\x09\x09\x09\x09size := size + 1 ].\x0a\x09\x09\x09object ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | \x0a\x09\x09\x09self \x0a\x09\x09\x09\x09add: bucket first \x0a\x09\x09\x09\x09in: primitiveBucket ]",
  5196. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"],
  5197. referencedClasses: []
  5198. }),
  5199. globals.Set);
  5200. smalltalk.addMethod(
  5201. smalltalk.method({
  5202. selector: "add:in:",
  5203. protocol: 'private',
  5204. fn: function (anObject,anotherObject){
  5205. var self=this;
  5206. return smalltalk.withContext(function($ctx1) {
  5207. if (anObject in anotherObject.store) { return false; }
  5208. self['@size']++;
  5209. return anotherObject.store[anObject] = true;
  5210. ;
  5211. return self}, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  5212. args: ["anObject", "anotherObject"],
  5213. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  5214. messageSends: [],
  5215. referencedClasses: []
  5216. }),
  5217. globals.Set);
  5218. smalltalk.addMethod(
  5219. smalltalk.method({
  5220. selector: "bucketsOfElement:",
  5221. protocol: 'private',
  5222. fn: function (anObject){
  5223. var self=this;
  5224. return smalltalk.withContext(function($ctx1) {
  5225. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  5226. if ((type = typeof prim) === "object") {
  5227. if (anObject !== nil) {
  5228. bucket = null;
  5229. self['@slowBucketStores'].some(function (store) {
  5230. return bucket = store._bucketOfElement_(anObject);
  5231. });
  5232. return [ anObject, null, bucket || self['@defaultBucket'] ];
  5233. }
  5234. // include nil to well-known objects under 'boolean' fastBucket
  5235. prim = null;
  5236. type = 'boolean';
  5237. }
  5238. return [ prim, self['@fastBuckets'][type] ];
  5239. ;
  5240. return self}, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)})},
  5241. args: ["anObject"],
  5242. source: "bucketsOfElement: anObject\x0a\x09\x22Find the appropriate bucket for `anObject`.\x0a\x09For optimization purposes, directly answer an array with: \x0a\x09- the object to be store\x0a\x09- the primitive bucket\x0a\x09- the slow bucket\x22\x0a\x09\x0a\x09<\x0a\x09\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  5243. messageSends: [],
  5244. referencedClasses: []
  5245. }),
  5246. globals.Set);
  5247. smalltalk.addMethod(
  5248. smalltalk.method({
  5249. selector: "classNameOf:",
  5250. protocol: 'private',
  5251. fn: function (anObject){
  5252. var self=this;
  5253. return smalltalk.withContext(function($ctx1) {
  5254. return anObject.klass && anObject.klass.className;
  5255. return self}, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)})},
  5256. args: ["anObject"],
  5257. source: "classNameOf: anObject\x0a\x09\x22Answer the class name of `anObject`, or `undefined` \x0a\x09if `anObject` is not an Smalltalk object\x22\x0a\x09\x0a\x09<return anObject.klass && anObject.klass.className>",
  5258. messageSends: [],
  5259. referencedClasses: []
  5260. }),
  5261. globals.Set);
  5262. smalltalk.addMethod(
  5263. smalltalk.method({
  5264. selector: "collect:",
  5265. protocol: 'enumerating',
  5266. fn: function (aBlock){
  5267. var self=this;
  5268. var collection;
  5269. return smalltalk.withContext(function($ctx1) {
  5270. var $1;
  5271. collection=_st(self._class())._new();
  5272. self._do_((function(each){
  5273. return smalltalk.withContext(function($ctx2) {
  5274. return _st(collection)._add_(_st(aBlock)._value_(each));
  5275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5276. $1=collection;
  5277. return $1;
  5278. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)})},
  5279. args: ["aBlock"],
  5280. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  5281. messageSends: ["new", "class", "do:", "add:", "value:"],
  5282. referencedClasses: []
  5283. }),
  5284. globals.Set);
  5285. smalltalk.addMethod(
  5286. smalltalk.method({
  5287. selector: "detect:ifNone:",
  5288. protocol: 'enumerating',
  5289. fn: function (aBlock,anotherBlock){
  5290. var self=this;
  5291. return smalltalk.withContext(function($ctx1) {
  5292. var $1,$2;
  5293. var $early={};
  5294. try {
  5295. self._do_((function(each){
  5296. return smalltalk.withContext(function($ctx2) {
  5297. $1=_st(aBlock)._value_(each);
  5298. if(smalltalk.assert($1)){
  5299. throw $early=[each];
  5300. };
  5301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5302. $2=_st(anotherBlock)._value();
  5303. return $2;
  5304. }
  5305. catch(e) {if(e===$early)return e[0]; throw e}
  5306. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)})},
  5307. args: ["aBlock", "anotherBlock"],
  5308. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  5309. messageSends: ["do:", "ifTrue:", "value:", "value"],
  5310. referencedClasses: []
  5311. }),
  5312. globals.Set);
  5313. smalltalk.addMethod(
  5314. smalltalk.method({
  5315. selector: "do:",
  5316. protocol: 'enumerating',
  5317. fn: function (aBlock){
  5318. var self=this;
  5319. return smalltalk.withContext(function($ctx1) {
  5320. var el, keys, i;
  5321. el = self['@fastBuckets'];
  5322. keys = Object.keys(el);
  5323. for (i = 0; i < keys.length; ++i) {
  5324. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  5325. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  5326. else { store._do_(aBlock); }
  5327. }
  5328. el = self['@slowBucketStores'];
  5329. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  5330. self['@defaultBucket']._do_(aBlock);
  5331. ;
  5332. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)})},
  5333. args: ["aBlock"],
  5334. source: "do: aBlock\x0a\x09<\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = self['@fastBuckets'];\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = self['@slowBucketStores'];\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09self['@defaultBucket']._do_(aBlock);\x0a\x09>",
  5335. messageSends: [],
  5336. referencedClasses: []
  5337. }),
  5338. globals.Set);
  5339. smalltalk.addMethod(
  5340. smalltalk.method({
  5341. selector: "includes:",
  5342. protocol: 'testing',
  5343. fn: function (anObject){
  5344. var self=this;
  5345. var bucket;
  5346. return smalltalk.withContext(function($ctx1) {
  5347. var $2,$3,$4,$1;
  5348. bucket=self._bucketsOfElement_(anObject);
  5349. $2=_st(bucket)._second();
  5350. if(($receiver = $2) == nil || $receiver == null){
  5351. $3=_st(bucket)._third();
  5352. $4=_st(bucket)._first();
  5353. $ctx1.sendIdx["first"]=1;
  5354. $1=_st($3)._includes_($4);
  5355. } else {
  5356. var primitiveBucket;
  5357. primitiveBucket=$receiver;
  5358. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  5359. };
  5360. return $1;
  5361. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)})},
  5362. args: ["anObject"],
  5363. source: "includes: anObject\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third includes: bucket first ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self includes: bucket first in: primitiveBucket ]",
  5364. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"],
  5365. referencedClasses: []
  5366. }),
  5367. globals.Set);
  5368. smalltalk.addMethod(
  5369. smalltalk.method({
  5370. selector: "includes:in:",
  5371. protocol: 'private',
  5372. fn: function (anObject,anotherObject){
  5373. var self=this;
  5374. return smalltalk.withContext(function($ctx1) {
  5375. return anObject in anotherObject.store;
  5376. return self}, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  5377. args: ["anObject", "anotherObject"],
  5378. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  5379. messageSends: [],
  5380. referencedClasses: []
  5381. }),
  5382. globals.Set);
  5383. smalltalk.addMethod(
  5384. smalltalk.method({
  5385. selector: "initialize",
  5386. protocol: 'initialization',
  5387. fn: function (){
  5388. var self=this;
  5389. return smalltalk.withContext(function($ctx1) {
  5390. var $1;
  5391. globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []);
  5392. self["@defaultBucket"]=[];
  5393. self._initializeSlowBucketStores();
  5394. $1=self._removeAll();
  5395. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)})},
  5396. args: [],
  5397. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  5398. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"],
  5399. referencedClasses: []
  5400. }),
  5401. globals.Set);
  5402. smalltalk.addMethod(
  5403. smalltalk.method({
  5404. selector: "initializeSlowBucketStores",
  5405. protocol: 'initialization',
  5406. fn: function (){
  5407. var self=this;
  5408. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  5409. return smalltalk.withContext(function($ctx1) {
  5410. var $1;
  5411. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  5412. return smalltalk.withContext(function($ctx2) {
  5413. return self._classNameOf_(x);
  5414. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5415. $ctx1.sendIdx["hashBlock:"]=1;
  5416. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  5417. return smalltalk.withContext(function($ctx2) {
  5418. return self._jsConstructorNameOf_(x);
  5419. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))];
  5420. return self}, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)})},
  5421. args: [],
  5422. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  5423. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"],
  5424. referencedClasses: ["ArrayBucketStore"]
  5425. }),
  5426. globals.Set);
  5427. smalltalk.addMethod(
  5428. smalltalk.method({
  5429. selector: "jsConstructorNameOf:",
  5430. protocol: 'private',
  5431. fn: function (anObject){
  5432. var self=this;
  5433. return smalltalk.withContext(function($ctx1) {
  5434. return anObject.constructor && anObject.constructor.name;
  5435. return self}, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)})},
  5436. args: ["anObject"],
  5437. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  5438. messageSends: [],
  5439. referencedClasses: []
  5440. }),
  5441. globals.Set);
  5442. smalltalk.addMethod(
  5443. smalltalk.method({
  5444. selector: "printOn:",
  5445. protocol: 'printing',
  5446. fn: function (aStream){
  5447. var self=this;
  5448. return smalltalk.withContext(function($ctx1) {
  5449. globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]);
  5450. $ctx1.sendIdx["printOn:"]=1;
  5451. _st(aStream)._nextPutAll_(" (");
  5452. $ctx1.sendIdx["nextPutAll:"]=1;
  5453. self._do_separatedBy_((function(each){
  5454. return smalltalk.withContext(function($ctx2) {
  5455. return _st(each)._printOn_(aStream);
  5456. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  5457. return smalltalk.withContext(function($ctx2) {
  5458. return _st(aStream)._nextPutAll_(" ");
  5459. $ctx2.sendIdx["nextPutAll:"]=2;
  5460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5461. _st(aStream)._nextPutAll_(")");
  5462. return self}, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)})},
  5463. args: ["aStream"],
  5464. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self \x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09aStream nextPutAll: ')'",
  5465. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"],
  5466. referencedClasses: []
  5467. }),
  5468. globals.Set);
  5469. smalltalk.addMethod(
  5470. smalltalk.method({
  5471. selector: "remove:ifAbsent:",
  5472. protocol: 'adding/removing',
  5473. fn: function (anObject,aBlock){
  5474. var self=this;
  5475. var bucket;
  5476. return smalltalk.withContext(function($ctx1) {
  5477. var $2,$3,$4,$5,$1;
  5478. var $early={};
  5479. try {
  5480. bucket=self._bucketsOfElement_(anObject);
  5481. $2=_st(bucket)._second();
  5482. if(($receiver = $2) == nil || $receiver == null){
  5483. $3=_st(bucket)._third();
  5484. $4=_st(bucket)._first();
  5485. $ctx1.sendIdx["first"]=1;
  5486. _st($3)._remove_ifAbsent_($4,(function(){
  5487. return smalltalk.withContext(function($ctx2) {
  5488. $5=_st(aBlock)._value();
  5489. throw $early=[$5];
  5490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5491. self["@size"]=_st(self["@size"]).__minus((1));
  5492. $1=self["@size"];
  5493. } else {
  5494. var primitiveBucket;
  5495. primitiveBucket=$receiver;
  5496. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  5497. };
  5498. return $1;
  5499. }
  5500. catch(e) {if(e===$early)return e[0]; throw e}
  5501. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)})},
  5502. args: ["anObject", "aBlock"],
  5503. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  5504. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"],
  5505. referencedClasses: []
  5506. }),
  5507. globals.Set);
  5508. smalltalk.addMethod(
  5509. smalltalk.method({
  5510. selector: "remove:in:",
  5511. protocol: 'private',
  5512. fn: function (anObject,anotherObject){
  5513. var self=this;
  5514. return smalltalk.withContext(function($ctx1) {
  5515. if (delete anotherObject.store[anObject]) self['@size']--;
  5516. return self}, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)})},
  5517. args: ["anObject", "anotherObject"],
  5518. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  5519. messageSends: [],
  5520. referencedClasses: []
  5521. }),
  5522. globals.Set);
  5523. smalltalk.addMethod(
  5524. smalltalk.method({
  5525. selector: "removeAll",
  5526. protocol: 'adding/removing',
  5527. fn: function (){
  5528. var self=this;
  5529. return smalltalk.withContext(function($ctx1) {
  5530. self['@fastBuckets'] = {
  5531. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  5532. 'number': { store: Object.create(null), fn: Number },
  5533. 'string': { store: Object.create(null) }
  5534. };
  5535. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  5536. self['@defaultBucket']._removeAll();
  5537. self['@size'] = 0;
  5538. ;
  5539. return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)})},
  5540. args: [],
  5541. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self['@defaultBucket']._removeAll();\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
  5542. messageSends: [],
  5543. referencedClasses: []
  5544. }),
  5545. globals.Set);
  5546. smalltalk.addMethod(
  5547. smalltalk.method({
  5548. selector: "select:",
  5549. protocol: 'enumerating',
  5550. fn: function (aBlock){
  5551. var self=this;
  5552. var collection;
  5553. return smalltalk.withContext(function($ctx1) {
  5554. var $1,$2;
  5555. collection=_st(self._class())._new();
  5556. self._do_((function(each){
  5557. return smalltalk.withContext(function($ctx2) {
  5558. $1=_st(aBlock)._value_(each);
  5559. if(smalltalk.assert($1)){
  5560. return _st(collection)._add_(each);
  5561. };
  5562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  5563. $2=collection;
  5564. return $2;
  5565. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)})},
  5566. args: ["aBlock"],
  5567. source: "select: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: each ] ].\x0a\x09^ collection",
  5568. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  5569. referencedClasses: []
  5570. }),
  5571. globals.Set);
  5572. smalltalk.addMethod(
  5573. smalltalk.method({
  5574. selector: "size",
  5575. protocol: 'accessing',
  5576. fn: function (){
  5577. var self=this;
  5578. var $1;
  5579. $1=self["@size"];
  5580. return $1;
  5581. },
  5582. args: [],
  5583. source: "size\x0a\x09^ size",
  5584. messageSends: [],
  5585. referencedClasses: []
  5586. }),
  5587. globals.Set);
  5588. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  5589. globals.Queue.comment="I am a one-sided queue.\x0a\x0a## Usage\x0a\x0aUse `#nextPut:` to add items to the queue.\x0aUse `#next` or `#nextIfAbsent:` to get (and remove) the next item in the queue.\x0a\x0a## Implementation notes\x0a\x0aA Queue uses two OrderedCollections inside,\x0a`read` is at the front, is not modified and only read using `readIndex`.\x0a`write` is at the back and is appended new items.\x0aWhen `read` is exhausted, `write` is promoted to `read` and new `write` is created.\x0a\x0aAs a consequence, no data moving is done by me, write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to.";
  5590. smalltalk.addMethod(
  5591. smalltalk.method({
  5592. selector: "initialize",
  5593. protocol: 'initialization',
  5594. fn: function (){
  5595. var self=this;
  5596. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5597. return smalltalk.withContext(function($ctx1) {
  5598. globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []);
  5599. self["@read"]=_st($OrderedCollection())._new();
  5600. $ctx1.sendIdx["new"]=1;
  5601. self["@write"]=_st($OrderedCollection())._new();
  5602. self["@readIndex"]=(1);
  5603. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)})},
  5604. args: [],
  5605. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  5606. messageSends: ["initialize", "new"],
  5607. referencedClasses: ["OrderedCollection"]
  5608. }),
  5609. globals.Queue);
  5610. smalltalk.addMethod(
  5611. smalltalk.method({
  5612. selector: "next",
  5613. protocol: 'accessing',
  5614. fn: function (){
  5615. var self=this;
  5616. return smalltalk.withContext(function($ctx1) {
  5617. var $1;
  5618. $1=self._nextIfAbsent_((function(){
  5619. return smalltalk.withContext(function($ctx2) {
  5620. return self._error_("Cannot read from empty Queue.");
  5621. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5622. return $1;
  5623. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)})},
  5624. args: [],
  5625. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  5626. messageSends: ["nextIfAbsent:", "error:"],
  5627. referencedClasses: []
  5628. }),
  5629. globals.Queue);
  5630. smalltalk.addMethod(
  5631. smalltalk.method({
  5632. selector: "nextIfAbsent:",
  5633. protocol: 'accessing',
  5634. fn: function (aBlock){
  5635. var self=this;
  5636. var result;
  5637. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  5638. return smalltalk.withContext(function($ctx1) {
  5639. var $1,$2,$3,$4;
  5640. var $early={};
  5641. try {
  5642. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  5643. return smalltalk.withContext(function($ctx2) {
  5644. $1=_st(self["@write"])._isEmpty();
  5645. if(smalltalk.assert($1)){
  5646. $2=_st(self["@readIndex"]).__gt((1));
  5647. if(smalltalk.assert($2)){
  5648. self["@read"]=[];
  5649. self["@read"];
  5650. self["@readIndex"]=(1);
  5651. self["@readIndex"];
  5652. };
  5653. $3=_st(aBlock)._value();
  5654. throw $early=[$3];
  5655. };
  5656. self["@read"]=self["@write"];
  5657. self["@read"];
  5658. self["@readIndex"]=(1);
  5659. self["@readIndex"];
  5660. self["@write"]=_st($OrderedCollection())._new();
  5661. self["@write"];
  5662. return _st(self["@read"])._first();
  5663. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5664. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  5665. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  5666. $4=result;
  5667. return $4;
  5668. }
  5669. catch(e) {if(e===$early)return e[0]; throw e}
  5670. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)})},
  5671. args: ["aBlock"],
  5672. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\x0a\x09\x09\x09readIndex > 1 ifTrue: [ read := #(). readIndex := 1 ].\x0a\x09\x09\x09^ aBlock value ].\x0a\x09\x09read := write.\x0a\x09\x09readIndex := 1.\x0a\x09\x09write := OrderedCollection new.\x0a\x09\x09read first ].\x0a\x09read at: readIndex put: nil.\x0a\x09readIndex := readIndex + 1.\x0a\x09^ result",
  5673. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"],
  5674. referencedClasses: ["OrderedCollection"]
  5675. }),
  5676. globals.Queue);
  5677. smalltalk.addMethod(
  5678. smalltalk.method({
  5679. selector: "nextPut:",
  5680. protocol: 'accessing',
  5681. fn: function (anObject){
  5682. var self=this;
  5683. return smalltalk.withContext(function($ctx1) {
  5684. _st(self["@write"])._add_(anObject);
  5685. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)})},
  5686. args: ["anObject"],
  5687. source: "nextPut: anObject\x0a\x09write add: anObject",
  5688. messageSends: ["add:"],
  5689. referencedClasses: []
  5690. }),
  5691. globals.Queue);
  5692. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  5693. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  5694. smalltalk.addMethod(
  5695. smalltalk.method({
  5696. selector: "compile:",
  5697. protocol: 'evaluating',
  5698. fn: function (aString){
  5699. var self=this;
  5700. return smalltalk.withContext(function($ctx1) {
  5701. return self.compile(aString);
  5702. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)})},
  5703. args: ["aString"],
  5704. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  5705. messageSends: [],
  5706. referencedClasses: []
  5707. }),
  5708. globals.RegularExpression);
  5709. smalltalk.addMethod(
  5710. smalltalk.method({
  5711. selector: "exec:",
  5712. protocol: 'evaluating',
  5713. fn: function (aString){
  5714. var self=this;
  5715. return smalltalk.withContext(function($ctx1) {
  5716. return self.exec(aString) || nil;
  5717. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)})},
  5718. args: ["aString"],
  5719. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  5720. messageSends: [],
  5721. referencedClasses: []
  5722. }),
  5723. globals.RegularExpression);
  5724. smalltalk.addMethod(
  5725. smalltalk.method({
  5726. selector: "test:",
  5727. protocol: 'evaluating',
  5728. fn: function (aString){
  5729. var self=this;
  5730. return smalltalk.withContext(function($ctx1) {
  5731. return self.test(aString);
  5732. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)})},
  5733. args: ["aString"],
  5734. source: "test: aString\x0a\x09<return self.test(aString)>",
  5735. messageSends: [],
  5736. referencedClasses: []
  5737. }),
  5738. globals.RegularExpression);
  5739. smalltalk.addMethod(
  5740. smalltalk.method({
  5741. selector: "fromString:",
  5742. protocol: 'instance creation',
  5743. fn: function (aString){
  5744. var self=this;
  5745. return smalltalk.withContext(function($ctx1) {
  5746. var $1;
  5747. $1=self._fromString_flag_(aString,"");
  5748. return $1;
  5749. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)})},
  5750. args: ["aString"],
  5751. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  5752. messageSends: ["fromString:flag:"],
  5753. referencedClasses: []
  5754. }),
  5755. globals.RegularExpression.klass);
  5756. smalltalk.addMethod(
  5757. smalltalk.method({
  5758. selector: "fromString:flag:",
  5759. protocol: 'instance creation',
  5760. fn: function (aString,anotherString){
  5761. var self=this;
  5762. return smalltalk.withContext(function($ctx1) {
  5763. return new RegExp(aString, anotherString);
  5764. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)})},
  5765. args: ["aString", "anotherString"],
  5766. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  5767. messageSends: [],
  5768. referencedClasses: []
  5769. }),
  5770. globals.RegularExpression.klass);
  5771. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  5772. globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  5773. smalltalk.addMethod(
  5774. smalltalk.method({
  5775. selector: "<<",
  5776. protocol: 'writing',
  5777. fn: function (anObject){
  5778. var self=this;
  5779. return smalltalk.withContext(function($ctx1) {
  5780. self._write_(anObject);
  5781. return self}, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)})},
  5782. args: ["anObject"],
  5783. source: "<< anObject\x0a\x09self write: anObject",
  5784. messageSends: ["write:"],
  5785. referencedClasses: []
  5786. }),
  5787. globals.Stream);
  5788. smalltalk.addMethod(
  5789. smalltalk.method({
  5790. selector: "atEnd",
  5791. protocol: 'testing',
  5792. fn: function (){
  5793. var self=this;
  5794. return smalltalk.withContext(function($ctx1) {
  5795. var $1;
  5796. $1=_st(self._position()).__eq(self._size());
  5797. return $1;
  5798. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)})},
  5799. args: [],
  5800. source: "atEnd\x0a\x09^ self position = self size",
  5801. messageSends: ["=", "position", "size"],
  5802. referencedClasses: []
  5803. }),
  5804. globals.Stream);
  5805. smalltalk.addMethod(
  5806. smalltalk.method({
  5807. selector: "atStart",
  5808. protocol: 'testing',
  5809. fn: function (){
  5810. var self=this;
  5811. return smalltalk.withContext(function($ctx1) {
  5812. var $1;
  5813. $1=_st(self._position()).__eq((0));
  5814. return $1;
  5815. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)})},
  5816. args: [],
  5817. source: "atStart\x0a\x09^ self position = 0",
  5818. messageSends: ["=", "position"],
  5819. referencedClasses: []
  5820. }),
  5821. globals.Stream);
  5822. smalltalk.addMethod(
  5823. smalltalk.method({
  5824. selector: "close",
  5825. protocol: 'actions',
  5826. fn: function (){
  5827. var self=this;
  5828. return self},
  5829. args: [],
  5830. source: "close",
  5831. messageSends: [],
  5832. referencedClasses: []
  5833. }),
  5834. globals.Stream);
  5835. smalltalk.addMethod(
  5836. smalltalk.method({
  5837. selector: "collection",
  5838. protocol: 'accessing',
  5839. fn: function (){
  5840. var self=this;
  5841. var $1;
  5842. $1=self["@collection"];
  5843. return $1;
  5844. },
  5845. args: [],
  5846. source: "collection\x0a\x09^ collection",
  5847. messageSends: [],
  5848. referencedClasses: []
  5849. }),
  5850. globals.Stream);
  5851. smalltalk.addMethod(
  5852. smalltalk.method({
  5853. selector: "contents",
  5854. protocol: 'accessing',
  5855. fn: function (){
  5856. var self=this;
  5857. return smalltalk.withContext(function($ctx1) {
  5858. var $1;
  5859. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  5860. return $1;
  5861. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)})},
  5862. args: [],
  5863. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  5864. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  5865. referencedClasses: []
  5866. }),
  5867. globals.Stream);
  5868. smalltalk.addMethod(
  5869. smalltalk.method({
  5870. selector: "do:",
  5871. protocol: 'enumerating',
  5872. fn: function (aBlock){
  5873. var self=this;
  5874. return smalltalk.withContext(function($ctx1) {
  5875. _st((function(){
  5876. return smalltalk.withContext(function($ctx2) {
  5877. return self._atEnd();
  5878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  5879. return smalltalk.withContext(function($ctx2) {
  5880. return _st(aBlock)._value_(self._next());
  5881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5882. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)})},
  5883. args: ["aBlock"],
  5884. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  5885. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  5886. referencedClasses: []
  5887. }),
  5888. globals.Stream);
  5889. smalltalk.addMethod(
  5890. smalltalk.method({
  5891. selector: "flush",
  5892. protocol: 'actions',
  5893. fn: function (){
  5894. var self=this;
  5895. return self},
  5896. args: [],
  5897. source: "flush",
  5898. messageSends: [],
  5899. referencedClasses: []
  5900. }),
  5901. globals.Stream);
  5902. smalltalk.addMethod(
  5903. smalltalk.method({
  5904. selector: "isEmpty",
  5905. protocol: 'testing',
  5906. fn: function (){
  5907. var self=this;
  5908. return smalltalk.withContext(function($ctx1) {
  5909. var $1;
  5910. $1=_st(self._size()).__eq((0));
  5911. return $1;
  5912. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)})},
  5913. args: [],
  5914. source: "isEmpty\x0a\x09^ self size = 0",
  5915. messageSends: ["=", "size"],
  5916. referencedClasses: []
  5917. }),
  5918. globals.Stream);
  5919. smalltalk.addMethod(
  5920. smalltalk.method({
  5921. selector: "next",
  5922. protocol: 'reading',
  5923. fn: function (){
  5924. var self=this;
  5925. return smalltalk.withContext(function($ctx1) {
  5926. var $2,$4,$3,$1;
  5927. $2=self._atEnd();
  5928. if(smalltalk.assert($2)){
  5929. $1=nil;
  5930. } else {
  5931. $4=self._position();
  5932. $ctx1.sendIdx["position"]=1;
  5933. $3=_st($4).__plus((1));
  5934. self._position_($3);
  5935. $1=_st(self["@collection"])._at_(self._position());
  5936. };
  5937. return $1;
  5938. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)})},
  5939. args: [],
  5940. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  5941. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  5942. referencedClasses: []
  5943. }),
  5944. globals.Stream);
  5945. smalltalk.addMethod(
  5946. smalltalk.method({
  5947. selector: "next:",
  5948. protocol: 'reading',
  5949. fn: function (anInteger){
  5950. var self=this;
  5951. var tempCollection;
  5952. return smalltalk.withContext(function($ctx1) {
  5953. var $1,$2;
  5954. tempCollection=_st(_st(self._collection())._class())._new();
  5955. _st(anInteger)._timesRepeat_((function(){
  5956. return smalltalk.withContext(function($ctx2) {
  5957. $1=self._atEnd();
  5958. if(! smalltalk.assert($1)){
  5959. return _st(tempCollection)._add_(self._next());
  5960. };
  5961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  5962. $2=tempCollection;
  5963. return $2;
  5964. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)})},
  5965. args: ["anInteger"],
  5966. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next ]].\x0a\x09^ tempCollection",
  5967. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  5968. referencedClasses: []
  5969. }),
  5970. globals.Stream);
  5971. smalltalk.addMethod(
  5972. smalltalk.method({
  5973. selector: "nextPut:",
  5974. protocol: 'writing',
  5975. fn: function (anObject){
  5976. var self=this;
  5977. return smalltalk.withContext(function($ctx1) {
  5978. var $2,$1,$3,$4;
  5979. $2=self._position();
  5980. $ctx1.sendIdx["position"]=1;
  5981. $1=_st($2).__plus((1));
  5982. self._position_($1);
  5983. $3=self._collection();
  5984. $4=self._position();
  5985. $ctx1.sendIdx["position"]=2;
  5986. _st($3)._at_put_($4,anObject);
  5987. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  5988. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)})},
  5989. args: ["anObject"],
  5990. source: "nextPut: anObject\x0a\x09self position: self position + 1.\x0a\x09self collection at: self position put: anObject.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  5991. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  5992. referencedClasses: []
  5993. }),
  5994. globals.Stream);
  5995. smalltalk.addMethod(
  5996. smalltalk.method({
  5997. selector: "nextPutAll:",
  5998. protocol: 'writing',
  5999. fn: function (aCollection){
  6000. var self=this;
  6001. return smalltalk.withContext(function($ctx1) {
  6002. _st(aCollection)._do_((function(each){
  6003. return smalltalk.withContext(function($ctx2) {
  6004. return self._nextPut_(each);
  6005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  6006. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)})},
  6007. args: ["aCollection"],
  6008. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  6009. messageSends: ["do:", "nextPut:"],
  6010. referencedClasses: []
  6011. }),
  6012. globals.Stream);
  6013. smalltalk.addMethod(
  6014. smalltalk.method({
  6015. selector: "nextPutString:",
  6016. protocol: 'writing',
  6017. fn: function (aString){
  6018. var self=this;
  6019. return smalltalk.withContext(function($ctx1) {
  6020. self._nextPut_(aString);
  6021. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)})},
  6022. args: ["aString"],
  6023. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  6024. messageSends: ["nextPut:"],
  6025. referencedClasses: []
  6026. }),
  6027. globals.Stream);
  6028. smalltalk.addMethod(
  6029. smalltalk.method({
  6030. selector: "peek",
  6031. protocol: 'reading',
  6032. fn: function (){
  6033. var self=this;
  6034. return smalltalk.withContext(function($ctx1) {
  6035. var $2,$1;
  6036. $2=self._atEnd();
  6037. if(! smalltalk.assert($2)){
  6038. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  6039. };
  6040. return $1;
  6041. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)})},
  6042. args: [],
  6043. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  6044. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  6045. referencedClasses: []
  6046. }),
  6047. globals.Stream);
  6048. smalltalk.addMethod(
  6049. smalltalk.method({
  6050. selector: "position",
  6051. protocol: 'accessing',
  6052. fn: function (){
  6053. var self=this;
  6054. return smalltalk.withContext(function($ctx1) {
  6055. var $2,$1;
  6056. $2=self["@position"];
  6057. if(($receiver = $2) == nil || $receiver == null){
  6058. self["@position"]=(0);
  6059. $1=self["@position"];
  6060. } else {
  6061. $1=$2;
  6062. };
  6063. return $1;
  6064. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)})},
  6065. args: [],
  6066. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  6067. messageSends: ["ifNil:"],
  6068. referencedClasses: []
  6069. }),
  6070. globals.Stream);
  6071. smalltalk.addMethod(
  6072. smalltalk.method({
  6073. selector: "position:",
  6074. protocol: 'accessing',
  6075. fn: function (anInteger){
  6076. var self=this;
  6077. self["@position"]=anInteger;
  6078. return self},
  6079. args: ["anInteger"],
  6080. source: "position: anInteger\x0a\x09position := anInteger",
  6081. messageSends: [],
  6082. referencedClasses: []
  6083. }),
  6084. globals.Stream);
  6085. smalltalk.addMethod(
  6086. smalltalk.method({
  6087. selector: "reset",
  6088. protocol: 'actions',
  6089. fn: function (){
  6090. var self=this;
  6091. return smalltalk.withContext(function($ctx1) {
  6092. self._position_((0));
  6093. return self}, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)})},
  6094. args: [],
  6095. source: "reset\x0a\x09self position: 0",
  6096. messageSends: ["position:"],
  6097. referencedClasses: []
  6098. }),
  6099. globals.Stream);
  6100. smalltalk.addMethod(
  6101. smalltalk.method({
  6102. selector: "resetContents",
  6103. protocol: 'actions',
  6104. fn: function (){
  6105. var self=this;
  6106. return smalltalk.withContext(function($ctx1) {
  6107. self._reset();
  6108. self._setStreamSize_((0));
  6109. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)})},
  6110. args: [],
  6111. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  6112. messageSends: ["reset", "setStreamSize:"],
  6113. referencedClasses: []
  6114. }),
  6115. globals.Stream);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "setCollection:",
  6119. protocol: 'accessing',
  6120. fn: function (aCollection){
  6121. var self=this;
  6122. self["@collection"]=aCollection;
  6123. return self},
  6124. args: ["aCollection"],
  6125. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  6126. messageSends: [],
  6127. referencedClasses: []
  6128. }),
  6129. globals.Stream);
  6130. smalltalk.addMethod(
  6131. smalltalk.method({
  6132. selector: "setStreamSize:",
  6133. protocol: 'accessing',
  6134. fn: function (anInteger){
  6135. var self=this;
  6136. self["@streamSize"]=anInteger;
  6137. return self},
  6138. args: ["anInteger"],
  6139. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  6140. messageSends: [],
  6141. referencedClasses: []
  6142. }),
  6143. globals.Stream);
  6144. smalltalk.addMethod(
  6145. smalltalk.method({
  6146. selector: "setToEnd",
  6147. protocol: 'positioning',
  6148. fn: function (){
  6149. var self=this;
  6150. return smalltalk.withContext(function($ctx1) {
  6151. self._position_(self._size());
  6152. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)})},
  6153. args: [],
  6154. source: "setToEnd\x0a\x09self position: self size",
  6155. messageSends: ["position:", "size"],
  6156. referencedClasses: []
  6157. }),
  6158. globals.Stream);
  6159. smalltalk.addMethod(
  6160. smalltalk.method({
  6161. selector: "size",
  6162. protocol: 'accessing',
  6163. fn: function (){
  6164. var self=this;
  6165. return smalltalk.withContext(function($ctx1) {
  6166. var $1;
  6167. $1=self._streamSize();
  6168. return $1;
  6169. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)})},
  6170. args: [],
  6171. source: "size\x0a\x09^ self streamSize",
  6172. messageSends: ["streamSize"],
  6173. referencedClasses: []
  6174. }),
  6175. globals.Stream);
  6176. smalltalk.addMethod(
  6177. smalltalk.method({
  6178. selector: "skip:",
  6179. protocol: 'positioning',
  6180. fn: function (anInteger){
  6181. var self=this;
  6182. return smalltalk.withContext(function($ctx1) {
  6183. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  6184. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)})},
  6185. args: ["anInteger"],
  6186. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  6187. messageSends: ["position:", "min:max:", "+", "position", "size"],
  6188. referencedClasses: []
  6189. }),
  6190. globals.Stream);
  6191. smalltalk.addMethod(
  6192. smalltalk.method({
  6193. selector: "streamSize",
  6194. protocol: 'accessing',
  6195. fn: function (){
  6196. var self=this;
  6197. var $1;
  6198. $1=self["@streamSize"];
  6199. return $1;
  6200. },
  6201. args: [],
  6202. source: "streamSize\x0a\x09^ streamSize",
  6203. messageSends: [],
  6204. referencedClasses: []
  6205. }),
  6206. globals.Stream);
  6207. smalltalk.addMethod(
  6208. smalltalk.method({
  6209. selector: "write:",
  6210. protocol: 'writing',
  6211. fn: function (anObject){
  6212. var self=this;
  6213. return smalltalk.withContext(function($ctx1) {
  6214. _st(anObject)._putOn_(self);
  6215. return self}, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)})},
  6216. args: ["anObject"],
  6217. source: "write: anObject\x0a\x09anObject putOn: self",
  6218. messageSends: ["putOn:"],
  6219. referencedClasses: []
  6220. }),
  6221. globals.Stream);
  6222. smalltalk.addMethod(
  6223. smalltalk.method({
  6224. selector: "on:",
  6225. protocol: 'instance creation',
  6226. fn: function (aCollection){
  6227. var self=this;
  6228. return smalltalk.withContext(function($ctx1) {
  6229. var $2,$3,$1;
  6230. $2=self._new();
  6231. _st($2)._setCollection_(aCollection);
  6232. _st($2)._setStreamSize_(_st(aCollection)._size());
  6233. $3=_st($2)._yourself();
  6234. $1=$3;
  6235. return $1;
  6236. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)})},
  6237. args: ["aCollection"],
  6238. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  6239. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  6240. referencedClasses: []
  6241. }),
  6242. globals.Stream.klass);
  6243. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  6244. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  6245. smalltalk.addMethod(
  6246. smalltalk.method({
  6247. selector: "cr",
  6248. protocol: 'writing',
  6249. fn: function (){
  6250. var self=this;
  6251. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6252. return smalltalk.withContext(function($ctx1) {
  6253. var $1;
  6254. $1=self._nextPutAll_(_st($String())._cr());
  6255. return $1;
  6256. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)})},
  6257. args: [],
  6258. source: "cr\x0a\x09^ self nextPutAll: String cr",
  6259. messageSends: ["nextPutAll:", "cr"],
  6260. referencedClasses: ["String"]
  6261. }),
  6262. globals.StringStream);
  6263. smalltalk.addMethod(
  6264. smalltalk.method({
  6265. selector: "crlf",
  6266. protocol: 'writing',
  6267. fn: function (){
  6268. var self=this;
  6269. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6270. return smalltalk.withContext(function($ctx1) {
  6271. var $1;
  6272. $1=self._nextPutAll_(_st($String())._crlf());
  6273. return $1;
  6274. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)})},
  6275. args: [],
  6276. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  6277. messageSends: ["nextPutAll:", "crlf"],
  6278. referencedClasses: ["String"]
  6279. }),
  6280. globals.StringStream);
  6281. smalltalk.addMethod(
  6282. smalltalk.method({
  6283. selector: "lf",
  6284. protocol: 'writing',
  6285. fn: function (){
  6286. var self=this;
  6287. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6288. return smalltalk.withContext(function($ctx1) {
  6289. var $1;
  6290. $1=self._nextPutAll_(_st($String())._lf());
  6291. return $1;
  6292. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)})},
  6293. args: [],
  6294. source: "lf\x0a\x09^ self nextPutAll: String lf",
  6295. messageSends: ["nextPutAll:", "lf"],
  6296. referencedClasses: ["String"]
  6297. }),
  6298. globals.StringStream);
  6299. smalltalk.addMethod(
  6300. smalltalk.method({
  6301. selector: "next:",
  6302. protocol: 'reading',
  6303. fn: function (anInteger){
  6304. var self=this;
  6305. var tempCollection;
  6306. return smalltalk.withContext(function($ctx1) {
  6307. var $1,$2;
  6308. tempCollection=_st(_st(self._collection())._class())._new();
  6309. _st(anInteger)._timesRepeat_((function(){
  6310. return smalltalk.withContext(function($ctx2) {
  6311. $1=self._atEnd();
  6312. if(! smalltalk.assert($1)){
  6313. tempCollection=_st(tempCollection).__comma(self._next());
  6314. return tempCollection;
  6315. };
  6316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6317. $2=tempCollection;
  6318. return $2;
  6319. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)})},
  6320. args: ["anInteger"],
  6321. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09\x09self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next ]].\x0a\x09^ tempCollection",
  6322. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  6323. referencedClasses: []
  6324. }),
  6325. globals.StringStream);
  6326. smalltalk.addMethod(
  6327. smalltalk.method({
  6328. selector: "nextPut:",
  6329. protocol: 'writing',
  6330. fn: function (aString){
  6331. var self=this;
  6332. return smalltalk.withContext(function($ctx1) {
  6333. self._nextPutAll_(aString);
  6334. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)})},
  6335. args: ["aString"],
  6336. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  6337. messageSends: ["nextPutAll:"],
  6338. referencedClasses: []
  6339. }),
  6340. globals.StringStream);
  6341. smalltalk.addMethod(
  6342. smalltalk.method({
  6343. selector: "nextPutAll:",
  6344. protocol: 'writing',
  6345. fn: function (aString){
  6346. var self=this;
  6347. var pre,post;
  6348. return smalltalk.withContext(function($ctx1) {
  6349. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  6350. $1=self._atEnd();
  6351. if(smalltalk.assert($1)){
  6352. $3=self._collection();
  6353. $ctx1.sendIdx["collection"]=1;
  6354. $2=_st($3).__comma(aString);
  6355. $ctx1.sendIdx[","]=1;
  6356. self._setCollection_($2);
  6357. $ctx1.sendIdx["setCollection:"]=1;
  6358. } else {
  6359. $4=self._collection();
  6360. $ctx1.sendIdx["collection"]=2;
  6361. $5=self._position();
  6362. $ctx1.sendIdx["position"]=1;
  6363. pre=_st($4)._copyFrom_to_((1),$5);
  6364. $ctx1.sendIdx["copyFrom:to:"]=1;
  6365. pre;
  6366. $6=self._collection();
  6367. $ctx1.sendIdx["collection"]=3;
  6368. $9=self._position();
  6369. $ctx1.sendIdx["position"]=2;
  6370. $8=_st($9).__plus((1));
  6371. $ctx1.sendIdx["+"]=2;
  6372. $10=_st(aString)._size();
  6373. $ctx1.sendIdx["size"]=1;
  6374. $7=_st($8).__plus($10);
  6375. $ctx1.sendIdx["+"]=1;
  6376. $11=_st(self._collection())._size();
  6377. $ctx1.sendIdx["size"]=2;
  6378. post=_st($6)._copyFrom_to_($7,$11);
  6379. post;
  6380. $12=_st(_st(pre).__comma(aString)).__comma(post);
  6381. $ctx1.sendIdx[","]=2;
  6382. self._setCollection_($12);
  6383. };
  6384. $14=self._position();
  6385. $ctx1.sendIdx["position"]=3;
  6386. $13=_st($14).__plus(_st(aString)._size());
  6387. self._position_($13);
  6388. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  6389. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)})},
  6390. args: ["aString"],
  6391. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  6392. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  6393. referencedClasses: []
  6394. }),
  6395. globals.StringStream);
  6396. smalltalk.addMethod(
  6397. smalltalk.method({
  6398. selector: "nextPutString:",
  6399. protocol: 'writing',
  6400. fn: function (aString){
  6401. var self=this;
  6402. return smalltalk.withContext(function($ctx1) {
  6403. self._nextPutAll_(aString);
  6404. return self}, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)})},
  6405. args: ["aString"],
  6406. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  6407. messageSends: ["nextPutAll:"],
  6408. referencedClasses: []
  6409. }),
  6410. globals.StringStream);
  6411. smalltalk.addMethod(
  6412. smalltalk.method({
  6413. selector: "space",
  6414. protocol: 'writing',
  6415. fn: function (){
  6416. var self=this;
  6417. return smalltalk.withContext(function($ctx1) {
  6418. self._nextPut_(" ");
  6419. return self}, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)})},
  6420. args: [],
  6421. source: "space\x0a\x09self nextPut: ' '",
  6422. messageSends: ["nextPut:"],
  6423. referencedClasses: []
  6424. }),
  6425. globals.StringStream);
  6426. smalltalk.addMethod(
  6427. smalltalk.method({
  6428. selector: "tab",
  6429. protocol: 'writing',
  6430. fn: function (){
  6431. var self=this;
  6432. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6433. return smalltalk.withContext(function($ctx1) {
  6434. var $1;
  6435. $1=self._nextPutAll_(_st($String())._tab());
  6436. return $1;
  6437. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)})},
  6438. args: [],
  6439. source: "tab\x0a\x09^ self nextPutAll: String tab",
  6440. messageSends: ["nextPutAll:", "tab"],
  6441. referencedClasses: ["String"]
  6442. }),
  6443. globals.StringStream);
  6444. });