Kernel-Collections.js 319 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025
  1. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Kernel-Collections');
  4. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $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:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: 'comparing',
  14. fn: function (anAssociation){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $3,$2,$5,$4,$6,$1;
  20. $3=self._class();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["class"]=1;
  23. //>>excludeEnd("ctx");
  24. $2=$recv($3).__eq($recv(anAssociation)._class());
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. $ctx1.sendIdx["="]=1;
  27. //>>excludeEnd("ctx");
  28. $1=$recv($2)._and_((function(){
  29. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30. return $core.withContext(function($ctx2) {
  31. //>>excludeEnd("ctx");
  32. $5=self._key();
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. $ctx2.sendIdx["key"]=1;
  35. //>>excludeEnd("ctx");
  36. $4=$recv($5).__eq($recv(anAssociation)._key());
  37. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38. $ctx2.sendIdx["="]=2;
  39. //>>excludeEnd("ctx");
  40. return $recv($4)._and_((function(){
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx3) {
  43. //>>excludeEnd("ctx");
  44. $6=self._value();
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. $ctx3.sendIdx["value"]=1;
  47. //>>excludeEnd("ctx");
  48. return $recv($6).__eq($recv(anAssociation)._value());
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51. //>>excludeEnd("ctx");
  52. }));
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55. //>>excludeEnd("ctx");
  56. }));
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. $ctx1.sendIdx["and:"]=1;
  59. //>>excludeEnd("ctx");
  60. return $1;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  63. //>>excludeEnd("ctx");
  64. },
  65. //>>excludeStart("ide", pragmas.excludeIdeData);
  66. args: ["anAssociation"],
  67. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  68. referencedClasses: [],
  69. //>>excludeEnd("ide");
  70. messageSends: ["and:", "=", "class", "key", "value"]
  71. }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: 'accessing',
  77. fn: function (){
  78. var self=this;
  79. return self["@key"];
  80. },
  81. //>>excludeStart("ide", pragmas.excludeIdeData);
  82. args: [],
  83. source: "key\x0a\x09^ key",
  84. referencedClasses: [],
  85. //>>excludeEnd("ide");
  86. messageSends: []
  87. }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: 'accessing',
  93. fn: function (aKey){
  94. var self=this;
  95. self["@key"]=aKey;
  96. return self;
  97. },
  98. //>>excludeStart("ide", pragmas.excludeIdeData);
  99. args: ["aKey"],
  100. source: "key: aKey\x0a\x09key := aKey",
  101. referencedClasses: [],
  102. //>>excludeEnd("ide");
  103. messageSends: []
  104. }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: 'printing',
  110. fn: function (aStream){
  111. var self=this;
  112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  113. return $core.withContext(function($ctx1) {
  114. //>>excludeEnd("ctx");
  115. $recv(self._key())._printOn_(aStream);
  116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  117. $ctx1.sendIdx["printOn:"]=1;
  118. //>>excludeEnd("ctx");
  119. $recv(aStream)._nextPutAll_(" -> ");
  120. $recv(self._value())._printOn_(aStream);
  121. return self;
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  124. //>>excludeEnd("ctx");
  125. },
  126. //>>excludeStart("ide", pragmas.excludeIdeData);
  127. args: ["aStream"],
  128. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  129. referencedClasses: [],
  130. //>>excludeEnd("ide");
  131. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  132. }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: 'accessing',
  138. fn: function (){
  139. var self=this;
  140. return self["@value"];
  141. },
  142. //>>excludeStart("ide", pragmas.excludeIdeData);
  143. args: [],
  144. source: "value\x0a\x09^ value",
  145. referencedClasses: [],
  146. //>>excludeEnd("ide");
  147. messageSends: []
  148. }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: 'accessing',
  154. fn: function (aValue){
  155. var self=this;
  156. self["@value"]=aValue;
  157. return self;
  158. },
  159. //>>excludeStart("ide", pragmas.excludeIdeData);
  160. args: ["aValue"],
  161. source: "value: aValue\x0a\x09value := aValue",
  162. referencedClasses: [],
  163. //>>excludeEnd("ide");
  164. messageSends: []
  165. }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: 'instance creation',
  171. fn: function (aKey,aValue){
  172. var self=this;
  173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  174. return $core.withContext(function($ctx1) {
  175. //>>excludeEnd("ctx");
  176. var $1;
  177. $1=self._new();
  178. $recv($1)._key_(aKey);
  179. $recv($1)._value_(aValue);
  180. return $recv($1)._yourself();
  181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  182. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  183. //>>excludeEnd("ctx");
  184. },
  185. //>>excludeStart("ide", pragmas.excludeIdeData);
  186. args: ["aKey", "aValue"],
  187. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  188. referencedClasses: [],
  189. //>>excludeEnd("ide");
  190. messageSends: ["key:", "new", "value:", "yourself"]
  191. }),
  192. $globals.Association.klass);
  193. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $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`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: 'accessing',
  201. fn: function (anObject){
  202. var self=this;
  203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  204. return $core.withContext(function($ctx1) {
  205. //>>excludeEnd("ctx");
  206. var hash = self['@hashBlock'](anObject);
  207. if (!hash) return null;
  208. var buckets = self['@buckets'],
  209. bucket = buckets[hash];
  210. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  211. return bucket;
  212. ;
  213. return self;
  214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  215. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  216. //>>excludeEnd("ctx");
  217. },
  218. //>>excludeStart("ide", pragmas.excludeIdeData);
  219. args: ["anObject"],
  220. 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>",
  221. referencedClasses: [],
  222. //>>excludeEnd("ide");
  223. messageSends: []
  224. }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: 'enumerating',
  230. fn: function (aBlock){
  231. var self=this;
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. return $core.withContext(function($ctx1) {
  234. //>>excludeEnd("ctx");
  235. var buckets = self['@buckets'];
  236. var keys = Object.keys(buckets);
  237. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  238. ;
  239. return self;
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  242. //>>excludeEnd("ctx");
  243. },
  244. //>>excludeStart("ide", pragmas.excludeIdeData);
  245. args: ["aBlock"],
  246. 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>",
  247. referencedClasses: [],
  248. //>>excludeEnd("ide");
  249. messageSends: []
  250. }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: 'accessing',
  256. fn: function (aBlock){
  257. var self=this;
  258. self["@hashBlock"]=aBlock;
  259. return self;
  260. },
  261. //>>excludeStart("ide", pragmas.excludeIdeData);
  262. args: ["aBlock"],
  263. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  264. referencedClasses: [],
  265. //>>excludeEnd("ide");
  266. messageSends: []
  267. }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: 'initialization',
  273. fn: function (){
  274. var self=this;
  275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  276. return $core.withContext(function($ctx1) {
  277. //>>excludeEnd("ctx");
  278. (
  279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  280. $ctx1.supercall = true,
  281. //>>excludeEnd("ctx");
  282. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. $ctx1.supercall = false;
  285. //>>excludeEnd("ctx");;
  286. self._removeAll();
  287. return self;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  290. //>>excludeEnd("ctx");
  291. },
  292. //>>excludeStart("ide", pragmas.excludeIdeData);
  293. args: [],
  294. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  295. referencedClasses: [],
  296. //>>excludeEnd("ide");
  297. messageSends: ["initialize", "removeAll"]
  298. }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: 'private',
  304. fn: function (){
  305. var self=this;
  306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  307. return $core.withContext(function($ctx1) {
  308. //>>excludeEnd("ctx");
  309. self._subclassResponsibility();
  310. return self;
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  313. //>>excludeEnd("ctx");
  314. },
  315. //>>excludeStart("ide", pragmas.excludeIdeData);
  316. args: [],
  317. source: "newBucket\x0a\x09self subclassResponsibility",
  318. referencedClasses: [],
  319. //>>excludeEnd("ide");
  320. messageSends: ["subclassResponsibility"]
  321. }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: 'adding/removing',
  327. fn: function (){
  328. var self=this;
  329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  330. return $core.withContext(function($ctx1) {
  331. //>>excludeEnd("ctx");
  332. self['@buckets'] = Object.create(null);;
  333. return self;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  336. //>>excludeEnd("ctx");
  337. },
  338. //>>excludeStart("ide", pragmas.excludeIdeData);
  339. args: [],
  340. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  341. referencedClasses: [],
  342. //>>excludeEnd("ide");
  343. messageSends: []
  344. }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: 'instance creation',
  350. fn: function (aBlock){
  351. var self=this;
  352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  353. return $core.withContext(function($ctx1) {
  354. //>>excludeEnd("ctx");
  355. var $1;
  356. $1=self._new();
  357. $recv($1)._hashBlock_(aBlock);
  358. return $recv($1)._yourself();
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  361. //>>excludeEnd("ctx");
  362. },
  363. //>>excludeStart("ide", pragmas.excludeIdeData);
  364. args: ["aBlock"],
  365. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  366. referencedClasses: [],
  367. //>>excludeEnd("ide");
  368. messageSends: ["hashBlock:", "new", "yourself"]
  369. }),
  370. $globals.BucketStore.klass);
  371. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: 'private',
  379. fn: function (){
  380. var self=this;
  381. return [];
  382. },
  383. //>>excludeStart("ide", pragmas.excludeIdeData);
  384. args: [],
  385. source: "newBucket\x0a\x09^ #()",
  386. referencedClasses: [],
  387. //>>excludeEnd("ide");
  388. messageSends: []
  389. }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $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.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: 'copying',
  399. fn: function (aCollection){
  400. var self=this;
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. return $core.withContext(function($ctx1) {
  403. //>>excludeEnd("ctx");
  404. var $1;
  405. $1=self._copy();
  406. $recv($1)._addAll_(aCollection);
  407. return $recv($1)._yourself();
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  410. //>>excludeEnd("ctx");
  411. },
  412. //>>excludeStart("ide", pragmas.excludeIdeData);
  413. args: ["aCollection"],
  414. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  415. referencedClasses: [],
  416. //>>excludeEnd("ide");
  417. messageSends: ["addAll:", "copy", "yourself"]
  418. }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: 'adding/removing',
  424. fn: function (anObject){
  425. var self=this;
  426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  427. return $core.withContext(function($ctx1) {
  428. //>>excludeEnd("ctx");
  429. self._subclassResponsibility();
  430. return self;
  431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  432. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  433. //>>excludeEnd("ctx");
  434. },
  435. //>>excludeStart("ide", pragmas.excludeIdeData);
  436. args: ["anObject"],
  437. source: "add: anObject\x0a\x09self subclassResponsibility",
  438. referencedClasses: [],
  439. //>>excludeEnd("ide");
  440. messageSends: ["subclassResponsibility"]
  441. }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: 'adding/removing',
  447. fn: function (aCollection){
  448. var self=this;
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. return $core.withContext(function($ctx1) {
  451. //>>excludeEnd("ctx");
  452. $recv(aCollection)._do_((function(each){
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. return $core.withContext(function($ctx2) {
  455. //>>excludeEnd("ctx");
  456. return self._add_(each);
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  459. //>>excludeEnd("ctx");
  460. }));
  461. return aCollection;
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  464. //>>excludeEnd("ctx");
  465. },
  466. //>>excludeStart("ide", pragmas.excludeIdeData);
  467. args: ["aCollection"],
  468. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  469. referencedClasses: [],
  470. //>>excludeEnd("ide");
  471. messageSends: ["do:", "add:"]
  472. }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: 'enumerating',
  478. fn: function (aBlock){
  479. var self=this;
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. return $core.withContext(function($ctx1) {
  482. //>>excludeEnd("ctx");
  483. var $1;
  484. var $early={};
  485. try {
  486. self._do_((function(each){
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx2) {
  489. //>>excludeEnd("ctx");
  490. $1=$recv(aBlock)._value_(each);
  491. if(!$core.assert($1)){
  492. throw $early=[false];
  493. };
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  496. //>>excludeEnd("ctx");
  497. }));
  498. return true;
  499. }
  500. catch(e) {if(e===$early)return e[0]; throw e}
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  503. //>>excludeEnd("ctx");
  504. },
  505. //>>excludeStart("ide", pragmas.excludeIdeData);
  506. args: ["aBlock"],
  507. 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",
  508. referencedClasses: [],
  509. //>>excludeEnd("ide");
  510. messageSends: ["do:", "ifFalse:", "value:"]
  511. }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: 'adding/removing',
  517. fn: function (){
  518. var self=this;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. return $core.withContext(function($ctx1) {
  521. //>>excludeEnd("ctx");
  522. var $early={};
  523. try {
  524. self._ifEmpty_((function(){
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx2) {
  527. //>>excludeEnd("ctx");
  528. return self._error_("Collection is empty");
  529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  531. //>>excludeEnd("ctx");
  532. }));
  533. self._do_((function(each){
  534. throw $early=[each];
  535. }));
  536. return self;
  537. }
  538. catch(e) {if(e===$early)return e[0]; throw e}
  539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  540. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  541. //>>excludeEnd("ctx");
  542. },
  543. //>>excludeStart("ide", pragmas.excludeIdeData);
  544. args: [],
  545. 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 ]",
  546. referencedClasses: [],
  547. //>>excludeEnd("ide");
  548. messageSends: ["ifEmpty:", "error:", "do:"]
  549. }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: 'enumerating',
  555. fn: function (aBlock){
  556. var self=this;
  557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  558. return $core.withContext(function($ctx1) {
  559. //>>excludeEnd("ctx");
  560. var $1;
  561. var $early={};
  562. try {
  563. self._do_((function(each){
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx2) {
  566. //>>excludeEnd("ctx");
  567. $1=$recv(aBlock)._value_(each);
  568. if($core.assert($1)){
  569. throw $early=[true];
  570. };
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  573. //>>excludeEnd("ctx");
  574. }));
  575. return false;
  576. }
  577. catch(e) {if(e===$early)return e[0]; throw e}
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  580. //>>excludeEnd("ctx");
  581. },
  582. //>>excludeStart("ide", pragmas.excludeIdeData);
  583. args: ["aBlock"],
  584. 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",
  585. referencedClasses: [],
  586. //>>excludeEnd("ide");
  587. messageSends: ["do:", "ifTrue:", "value:"]
  588. }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: 'converting',
  594. fn: function (){
  595. var self=this;
  596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  597. return $core.withContext(function($ctx1) {
  598. //>>excludeEnd("ctx");
  599. return $recv($globals.Array)._withAll_(self);
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  602. //>>excludeEnd("ctx");
  603. },
  604. //>>excludeStart("ide", pragmas.excludeIdeData);
  605. args: [],
  606. source: "asArray\x0a\x09^ Array withAll: self",
  607. referencedClasses: ["Array"],
  608. //>>excludeEnd("ide");
  609. messageSends: ["withAll:"]
  610. }),
  611. $globals.Collection);
  612. $core.addMethod(
  613. $core.method({
  614. selector: "asJSON",
  615. protocol: 'converting',
  616. fn: function (){
  617. var self=this;
  618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  619. return $core.withContext(function($ctx1) {
  620. //>>excludeEnd("ctx");
  621. return $recv(self._asArray())._collect_((function(each){
  622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  623. return $core.withContext(function($ctx2) {
  624. //>>excludeEnd("ctx");
  625. return $recv(each)._asJSON();
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  628. //>>excludeEnd("ctx");
  629. }));
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  632. //>>excludeEnd("ctx");
  633. },
  634. //>>excludeStart("ide", pragmas.excludeIdeData);
  635. args: [],
  636. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  637. referencedClasses: [],
  638. //>>excludeEnd("ide");
  639. messageSends: ["collect:", "asArray", "asJSON"]
  640. }),
  641. $globals.Collection);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "asOrderedCollection",
  645. protocol: 'converting',
  646. fn: function (){
  647. var self=this;
  648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  649. return $core.withContext(function($ctx1) {
  650. //>>excludeEnd("ctx");
  651. return self._asArray();
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  654. //>>excludeEnd("ctx");
  655. },
  656. //>>excludeStart("ide", pragmas.excludeIdeData);
  657. args: [],
  658. source: "asOrderedCollection\x0a\x09^ self asArray",
  659. referencedClasses: [],
  660. //>>excludeEnd("ide");
  661. messageSends: ["asArray"]
  662. }),
  663. $globals.Collection);
  664. $core.addMethod(
  665. $core.method({
  666. selector: "asSet",
  667. protocol: 'converting',
  668. fn: function (){
  669. var self=this;
  670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  671. return $core.withContext(function($ctx1) {
  672. //>>excludeEnd("ctx");
  673. return $recv($globals.Set)._withAll_(self);
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  676. //>>excludeEnd("ctx");
  677. },
  678. //>>excludeStart("ide", pragmas.excludeIdeData);
  679. args: [],
  680. source: "asSet\x0a\x09^ Set withAll: self",
  681. referencedClasses: ["Set"],
  682. //>>excludeEnd("ide");
  683. messageSends: ["withAll:"]
  684. }),
  685. $globals.Collection);
  686. $core.addMethod(
  687. $core.method({
  688. selector: "collect:",
  689. protocol: 'enumerating',
  690. fn: function (aBlock){
  691. var self=this;
  692. var stream;
  693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  694. return $core.withContext(function($ctx1) {
  695. //>>excludeEnd("ctx");
  696. stream=$recv($recv(self._class())._new())._writeStream();
  697. self._do_((function(each){
  698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  699. return $core.withContext(function($ctx2) {
  700. //>>excludeEnd("ctx");
  701. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  704. //>>excludeEnd("ctx");
  705. }));
  706. return $recv(stream)._contents();
  707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  708. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  709. //>>excludeEnd("ctx");
  710. },
  711. //>>excludeStart("ide", pragmas.excludeIdeData);
  712. args: ["aBlock"],
  713. 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",
  714. referencedClasses: [],
  715. //>>excludeEnd("ide");
  716. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  717. }),
  718. $globals.Collection);
  719. $core.addMethod(
  720. $core.method({
  721. selector: "copyWith:",
  722. protocol: 'copying',
  723. fn: function (anObject){
  724. var self=this;
  725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  726. return $core.withContext(function($ctx1) {
  727. //>>excludeEnd("ctx");
  728. var $1;
  729. $1=self._copy();
  730. $recv($1)._add_(anObject);
  731. return $recv($1)._yourself();
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  734. //>>excludeEnd("ctx");
  735. },
  736. //>>excludeStart("ide", pragmas.excludeIdeData);
  737. args: ["anObject"],
  738. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  739. referencedClasses: [],
  740. //>>excludeEnd("ide");
  741. messageSends: ["add:", "copy", "yourself"]
  742. }),
  743. $globals.Collection);
  744. $core.addMethod(
  745. $core.method({
  746. selector: "copyWithAll:",
  747. protocol: 'copying',
  748. fn: function (aCollection){
  749. var self=this;
  750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  751. return $core.withContext(function($ctx1) {
  752. //>>excludeEnd("ctx");
  753. var $1;
  754. $1=self._copy();
  755. $recv($1)._addAll_(aCollection);
  756. return $recv($1)._yourself();
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  759. //>>excludeEnd("ctx");
  760. },
  761. //>>excludeStart("ide", pragmas.excludeIdeData);
  762. args: ["aCollection"],
  763. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  764. referencedClasses: [],
  765. //>>excludeEnd("ide");
  766. messageSends: ["addAll:", "copy", "yourself"]
  767. }),
  768. $globals.Collection);
  769. $core.addMethod(
  770. $core.method({
  771. selector: "copyWithoutAll:",
  772. protocol: 'copying',
  773. fn: function (aCollection){
  774. var self=this;
  775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  776. return $core.withContext(function($ctx1) {
  777. //>>excludeEnd("ctx");
  778. return self._reject_((function(each){
  779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  780. return $core.withContext(function($ctx2) {
  781. //>>excludeEnd("ctx");
  782. return $recv(aCollection)._includes_(each);
  783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  785. //>>excludeEnd("ctx");
  786. }));
  787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  788. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  789. //>>excludeEnd("ctx");
  790. },
  791. //>>excludeStart("ide", pragmas.excludeIdeData);
  792. args: ["aCollection"],
  793. 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 ]",
  794. referencedClasses: [],
  795. //>>excludeEnd("ide");
  796. messageSends: ["reject:", "includes:"]
  797. }),
  798. $globals.Collection);
  799. $core.addMethod(
  800. $core.method({
  801. selector: "deepCopy",
  802. protocol: 'copying',
  803. fn: function (){
  804. var self=this;
  805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  806. return $core.withContext(function($ctx1) {
  807. //>>excludeEnd("ctx");
  808. return self._collect_((function(each){
  809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  810. return $core.withContext(function($ctx2) {
  811. //>>excludeEnd("ctx");
  812. return $recv(each)._deepCopy();
  813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  815. //>>excludeEnd("ctx");
  816. }));
  817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  818. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  819. //>>excludeEnd("ctx");
  820. },
  821. //>>excludeStart("ide", pragmas.excludeIdeData);
  822. args: [],
  823. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  824. referencedClasses: [],
  825. //>>excludeEnd("ide");
  826. messageSends: ["collect:", "deepCopy"]
  827. }),
  828. $globals.Collection);
  829. $core.addMethod(
  830. $core.method({
  831. selector: "detect:",
  832. protocol: 'enumerating',
  833. fn: function (aBlock){
  834. var self=this;
  835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  836. return $core.withContext(function($ctx1) {
  837. //>>excludeEnd("ctx");
  838. return self._detect_ifNone_(aBlock,(function(){
  839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  840. return $core.withContext(function($ctx2) {
  841. //>>excludeEnd("ctx");
  842. return self._errorNotFound();
  843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  844. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  845. //>>excludeEnd("ctx");
  846. }));
  847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  848. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  849. //>>excludeEnd("ctx");
  850. },
  851. //>>excludeStart("ide", pragmas.excludeIdeData);
  852. args: ["aBlock"],
  853. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  854. referencedClasses: [],
  855. //>>excludeEnd("ide");
  856. messageSends: ["detect:ifNone:", "errorNotFound"]
  857. }),
  858. $globals.Collection);
  859. $core.addMethod(
  860. $core.method({
  861. selector: "detect:ifNone:",
  862. protocol: 'enumerating',
  863. fn: function (aBlock,anotherBlock){
  864. var self=this;
  865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  866. return $core.withContext(function($ctx1) {
  867. //>>excludeEnd("ctx");
  868. self._subclassResponsibility();
  869. return self;
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  872. //>>excludeEnd("ctx");
  873. },
  874. //>>excludeStart("ide", pragmas.excludeIdeData);
  875. args: ["aBlock", "anotherBlock"],
  876. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  877. referencedClasses: [],
  878. //>>excludeEnd("ide");
  879. messageSends: ["subclassResponsibility"]
  880. }),
  881. $globals.Collection);
  882. $core.addMethod(
  883. $core.method({
  884. selector: "do:",
  885. protocol: 'enumerating',
  886. fn: function (aBlock){
  887. var self=this;
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. return $core.withContext(function($ctx1) {
  890. //>>excludeEnd("ctx");
  891. self._subclassResponsibility();
  892. return self;
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  895. //>>excludeEnd("ctx");
  896. },
  897. //>>excludeStart("ide", pragmas.excludeIdeData);
  898. args: ["aBlock"],
  899. source: "do: aBlock\x0a\x09self subclassResponsibility",
  900. referencedClasses: [],
  901. //>>excludeEnd("ide");
  902. messageSends: ["subclassResponsibility"]
  903. }),
  904. $globals.Collection);
  905. $core.addMethod(
  906. $core.method({
  907. selector: "do:separatedBy:",
  908. protocol: 'enumerating',
  909. fn: function (aBlock,anotherBlock){
  910. var self=this;
  911. var actionBeforeElement;
  912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  913. return $core.withContext(function($ctx1) {
  914. //>>excludeEnd("ctx");
  915. actionBeforeElement=(function(){
  916. actionBeforeElement=anotherBlock;
  917. return actionBeforeElement;
  918. });
  919. self._do_((function(each){
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. return $core.withContext(function($ctx2) {
  922. //>>excludeEnd("ctx");
  923. $recv(actionBeforeElement)._value();
  924. return $recv(aBlock)._value_(each);
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  927. //>>excludeEnd("ctx");
  928. }));
  929. return self;
  930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  931. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  932. //>>excludeEnd("ctx");
  933. },
  934. //>>excludeStart("ide", pragmas.excludeIdeData);
  935. args: ["aBlock", "anotherBlock"],
  936. 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 ]",
  937. referencedClasses: [],
  938. //>>excludeEnd("ide");
  939. messageSends: ["do:", "value", "value:"]
  940. }),
  941. $globals.Collection);
  942. $core.addMethod(
  943. $core.method({
  944. selector: "errorNotFound",
  945. protocol: 'error handling',
  946. fn: function (){
  947. var self=this;
  948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  949. return $core.withContext(function($ctx1) {
  950. //>>excludeEnd("ctx");
  951. self._error_("Object is not in the collection");
  952. return self;
  953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  954. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  955. //>>excludeEnd("ctx");
  956. },
  957. //>>excludeStart("ide", pragmas.excludeIdeData);
  958. args: [],
  959. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  960. referencedClasses: [],
  961. //>>excludeEnd("ide");
  962. messageSends: ["error:"]
  963. }),
  964. $globals.Collection);
  965. $core.addMethod(
  966. $core.method({
  967. selector: "ifEmpty:",
  968. protocol: 'testing',
  969. fn: function (aBlock){
  970. var self=this;
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx1) {
  973. //>>excludeEnd("ctx");
  974. var $1;
  975. $1=self._isEmpty();
  976. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  977. return self;
  978. }));
  979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  980. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  981. //>>excludeEnd("ctx");
  982. },
  983. //>>excludeStart("ide", pragmas.excludeIdeData);
  984. args: ["aBlock"],
  985. 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 ]",
  986. referencedClasses: [],
  987. //>>excludeEnd("ide");
  988. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  989. }),
  990. $globals.Collection);
  991. $core.addMethod(
  992. $core.method({
  993. selector: "ifEmpty:ifNotEmpty:",
  994. protocol: 'testing',
  995. fn: function (aBlock,anotherBlock){
  996. var self=this;
  997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  998. return $core.withContext(function($ctx1) {
  999. //>>excludeEnd("ctx");
  1000. var $1;
  1001. $1=self._isEmpty();
  1002. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  1003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1004. return $core.withContext(function($ctx2) {
  1005. //>>excludeEnd("ctx");
  1006. return $recv(anotherBlock)._value_(self);
  1007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1009. //>>excludeEnd("ctx");
  1010. }));
  1011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1012. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1013. //>>excludeEnd("ctx");
  1014. },
  1015. //>>excludeStart("ide", pragmas.excludeIdeData);
  1016. args: ["aBlock", "anotherBlock"],
  1017. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1018. referencedClasses: [],
  1019. //>>excludeEnd("ide");
  1020. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  1021. }),
  1022. $globals.Collection);
  1023. $core.addMethod(
  1024. $core.method({
  1025. selector: "ifNotEmpty:",
  1026. protocol: 'testing',
  1027. fn: function (aBlock){
  1028. var self=this;
  1029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1030. return $core.withContext(function($ctx1) {
  1031. //>>excludeEnd("ctx");
  1032. var $1;
  1033. $1=self._notEmpty();
  1034. if($core.assert($1)){
  1035. return $recv(aBlock)._value_(self);
  1036. } else {
  1037. return self;
  1038. };
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1041. //>>excludeEnd("ctx");
  1042. },
  1043. //>>excludeStart("ide", pragmas.excludeIdeData);
  1044. args: ["aBlock"],
  1045. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1046. referencedClasses: [],
  1047. //>>excludeEnd("ide");
  1048. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1049. }),
  1050. $globals.Collection);
  1051. $core.addMethod(
  1052. $core.method({
  1053. selector: "ifNotEmpty:ifEmpty:",
  1054. protocol: 'testing',
  1055. fn: function (aBlock,anotherBlock){
  1056. var self=this;
  1057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1058. return $core.withContext(function($ctx1) {
  1059. //>>excludeEnd("ctx");
  1060. var $1;
  1061. $1=self._notEmpty();
  1062. return $recv($1)._ifTrue_ifFalse_((function(){
  1063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1064. return $core.withContext(function($ctx2) {
  1065. //>>excludeEnd("ctx");
  1066. return $recv(aBlock)._value_(self);
  1067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1069. //>>excludeEnd("ctx");
  1070. }),anotherBlock);
  1071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1072. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1073. //>>excludeEnd("ctx");
  1074. },
  1075. //>>excludeStart("ide", pragmas.excludeIdeData);
  1076. args: ["aBlock", "anotherBlock"],
  1077. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  1078. referencedClasses: [],
  1079. //>>excludeEnd("ide");
  1080. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1081. }),
  1082. $globals.Collection);
  1083. $core.addMethod(
  1084. $core.method({
  1085. selector: "includes:",
  1086. protocol: 'testing',
  1087. fn: function (anObject){
  1088. var self=this;
  1089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1090. return $core.withContext(function($ctx1) {
  1091. //>>excludeEnd("ctx");
  1092. return self._anySatisfy_((function(each){
  1093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1094. return $core.withContext(function($ctx2) {
  1095. //>>excludeEnd("ctx");
  1096. return $recv(each).__eq(anObject);
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1099. //>>excludeEnd("ctx");
  1100. }));
  1101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1102. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1103. //>>excludeEnd("ctx");
  1104. },
  1105. //>>excludeStart("ide", pragmas.excludeIdeData);
  1106. args: ["anObject"],
  1107. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1108. referencedClasses: [],
  1109. //>>excludeEnd("ide");
  1110. messageSends: ["anySatisfy:", "="]
  1111. }),
  1112. $globals.Collection);
  1113. $core.addMethod(
  1114. $core.method({
  1115. selector: "inject:into:",
  1116. protocol: 'enumerating',
  1117. fn: function (anObject,aBlock){
  1118. var self=this;
  1119. var result;
  1120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1121. return $core.withContext(function($ctx1) {
  1122. //>>excludeEnd("ctx");
  1123. result=anObject;
  1124. self._do_((function(each){
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. return $core.withContext(function($ctx2) {
  1127. //>>excludeEnd("ctx");
  1128. result=$recv(aBlock)._value_value_(result,each);
  1129. return result;
  1130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1132. //>>excludeEnd("ctx");
  1133. }));
  1134. return result;
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1137. //>>excludeEnd("ctx");
  1138. },
  1139. //>>excludeStart("ide", pragmas.excludeIdeData);
  1140. args: ["anObject", "aBlock"],
  1141. 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",
  1142. referencedClasses: [],
  1143. //>>excludeEnd("ide");
  1144. messageSends: ["do:", "value:value:"]
  1145. }),
  1146. $globals.Collection);
  1147. $core.addMethod(
  1148. $core.method({
  1149. selector: "intersection:",
  1150. protocol: 'enumerating',
  1151. fn: function (aCollection){
  1152. var self=this;
  1153. var set,outputSet;
  1154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1155. return $core.withContext(function($ctx1) {
  1156. //>>excludeEnd("ctx");
  1157. var $2,$1;
  1158. set=self._asSet();
  1159. outputSet=$recv($globals.Set)._new();
  1160. $recv(aCollection)._do_((function(each){
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. return $core.withContext(function($ctx2) {
  1163. //>>excludeEnd("ctx");
  1164. $2=$recv(set)._includes_(each);
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. $ctx2.sendIdx["includes:"]=1;
  1167. //>>excludeEnd("ctx");
  1168. $1=$recv($2)._and_((function(){
  1169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1170. return $core.withContext(function($ctx3) {
  1171. //>>excludeEnd("ctx");
  1172. return $recv($recv(outputSet)._includes_(each))._not();
  1173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1174. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1175. //>>excludeEnd("ctx");
  1176. }));
  1177. if($core.assert($1)){
  1178. return $recv(outputSet)._add_(each);
  1179. };
  1180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1182. //>>excludeEnd("ctx");
  1183. }));
  1184. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  1185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1186. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1187. //>>excludeEnd("ctx");
  1188. },
  1189. //>>excludeStart("ide", pragmas.excludeIdeData);
  1190. args: ["aCollection"],
  1191. 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",
  1192. referencedClasses: ["Set"],
  1193. //>>excludeEnd("ide");
  1194. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1195. }),
  1196. $globals.Collection);
  1197. $core.addMethod(
  1198. $core.method({
  1199. selector: "isEmpty",
  1200. protocol: 'testing',
  1201. fn: function (){
  1202. var self=this;
  1203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1204. return $core.withContext(function($ctx1) {
  1205. //>>excludeEnd("ctx");
  1206. return $recv(self._size()).__eq((0));
  1207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1208. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1209. //>>excludeEnd("ctx");
  1210. },
  1211. //>>excludeStart("ide", pragmas.excludeIdeData);
  1212. args: [],
  1213. source: "isEmpty\x0a\x09^ self size = 0",
  1214. referencedClasses: [],
  1215. //>>excludeEnd("ide");
  1216. messageSends: ["=", "size"]
  1217. }),
  1218. $globals.Collection);
  1219. $core.addMethod(
  1220. $core.method({
  1221. selector: "noneSatisfy:",
  1222. protocol: 'enumerating',
  1223. fn: function (aBlock){
  1224. var self=this;
  1225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1226. return $core.withContext(function($ctx1) {
  1227. //>>excludeEnd("ctx");
  1228. var $1;
  1229. var $early={};
  1230. try {
  1231. self._do_((function(item){
  1232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1233. return $core.withContext(function($ctx2) {
  1234. //>>excludeEnd("ctx");
  1235. $1=$recv(aBlock)._value_(item);
  1236. if($core.assert($1)){
  1237. throw $early=[false];
  1238. };
  1239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1240. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1241. //>>excludeEnd("ctx");
  1242. }));
  1243. return true;
  1244. }
  1245. catch(e) {if(e===$early)return e[0]; throw e}
  1246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1247. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1248. //>>excludeEnd("ctx");
  1249. },
  1250. //>>excludeStart("ide", pragmas.excludeIdeData);
  1251. args: ["aBlock"],
  1252. 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",
  1253. referencedClasses: [],
  1254. //>>excludeEnd("ide");
  1255. messageSends: ["do:", "ifTrue:", "value:"]
  1256. }),
  1257. $globals.Collection);
  1258. $core.addMethod(
  1259. $core.method({
  1260. selector: "notEmpty",
  1261. protocol: 'testing',
  1262. fn: function (){
  1263. var self=this;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx1) {
  1266. //>>excludeEnd("ctx");
  1267. return $recv(self._isEmpty())._not();
  1268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1269. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1270. //>>excludeEnd("ctx");
  1271. },
  1272. //>>excludeStart("ide", pragmas.excludeIdeData);
  1273. args: [],
  1274. source: "notEmpty\x0a\x09^ self isEmpty not",
  1275. referencedClasses: [],
  1276. //>>excludeEnd("ide");
  1277. messageSends: ["not", "isEmpty"]
  1278. }),
  1279. $globals.Collection);
  1280. $core.addMethod(
  1281. $core.method({
  1282. selector: "occurrencesOf:",
  1283. protocol: 'accessing',
  1284. fn: function (anObject){
  1285. var self=this;
  1286. var tally;
  1287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1288. return $core.withContext(function($ctx1) {
  1289. //>>excludeEnd("ctx");
  1290. var $1;
  1291. tally=(0);
  1292. self._do_((function(each){
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. return $core.withContext(function($ctx2) {
  1295. //>>excludeEnd("ctx");
  1296. $1=$recv(anObject).__eq(each);
  1297. if($core.assert($1)){
  1298. tally=$recv(tally).__plus((1));
  1299. return tally;
  1300. };
  1301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1303. //>>excludeEnd("ctx");
  1304. }));
  1305. return tally;
  1306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1307. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1308. //>>excludeEnd("ctx");
  1309. },
  1310. //>>excludeStart("ide", pragmas.excludeIdeData);
  1311. args: ["anObject"],
  1312. 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",
  1313. referencedClasses: [],
  1314. //>>excludeEnd("ide");
  1315. messageSends: ["do:", "ifTrue:", "=", "+"]
  1316. }),
  1317. $globals.Collection);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "putOn:",
  1321. protocol: 'streaming',
  1322. fn: function (aStream){
  1323. var self=this;
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return $core.withContext(function($ctx1) {
  1326. //>>excludeEnd("ctx");
  1327. self._do_((function(each){
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. return $core.withContext(function($ctx2) {
  1330. //>>excludeEnd("ctx");
  1331. return $recv(each)._putOn_(aStream);
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1334. //>>excludeEnd("ctx");
  1335. }));
  1336. return self;
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1339. //>>excludeEnd("ctx");
  1340. },
  1341. //>>excludeStart("ide", pragmas.excludeIdeData);
  1342. args: ["aStream"],
  1343. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1344. referencedClasses: [],
  1345. //>>excludeEnd("ide");
  1346. messageSends: ["do:", "putOn:"]
  1347. }),
  1348. $globals.Collection);
  1349. $core.addMethod(
  1350. $core.method({
  1351. selector: "reject:",
  1352. protocol: 'enumerating',
  1353. fn: function (aBlock){
  1354. var self=this;
  1355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1356. return $core.withContext(function($ctx1) {
  1357. //>>excludeEnd("ctx");
  1358. return self._select_((function(each){
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. return $core.withContext(function($ctx2) {
  1361. //>>excludeEnd("ctx");
  1362. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1365. //>>excludeEnd("ctx");
  1366. }));
  1367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1368. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1369. //>>excludeEnd("ctx");
  1370. },
  1371. //>>excludeStart("ide", pragmas.excludeIdeData);
  1372. args: ["aBlock"],
  1373. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1374. referencedClasses: [],
  1375. //>>excludeEnd("ide");
  1376. messageSends: ["select:", "=", "value:"]
  1377. }),
  1378. $globals.Collection);
  1379. $core.addMethod(
  1380. $core.method({
  1381. selector: "remove:",
  1382. protocol: 'adding/removing',
  1383. fn: function (anObject){
  1384. var self=this;
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. return $core.withContext(function($ctx1) {
  1387. //>>excludeEnd("ctx");
  1388. return self._remove_ifAbsent_(anObject,(function(){
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. return $core.withContext(function($ctx2) {
  1391. //>>excludeEnd("ctx");
  1392. return self._errorNotFound();
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1395. //>>excludeEnd("ctx");
  1396. }));
  1397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1398. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1399. //>>excludeEnd("ctx");
  1400. },
  1401. //>>excludeStart("ide", pragmas.excludeIdeData);
  1402. args: ["anObject"],
  1403. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1404. referencedClasses: [],
  1405. //>>excludeEnd("ide");
  1406. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1407. }),
  1408. $globals.Collection);
  1409. $core.addMethod(
  1410. $core.method({
  1411. selector: "remove:ifAbsent:",
  1412. protocol: 'adding/removing',
  1413. fn: function (anObject,aBlock){
  1414. var self=this;
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. return $core.withContext(function($ctx1) {
  1417. //>>excludeEnd("ctx");
  1418. self._subclassResponsibility();
  1419. return self;
  1420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1421. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1422. //>>excludeEnd("ctx");
  1423. },
  1424. //>>excludeStart("ide", pragmas.excludeIdeData);
  1425. args: ["anObject", "aBlock"],
  1426. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1427. referencedClasses: [],
  1428. //>>excludeEnd("ide");
  1429. messageSends: ["subclassResponsibility"]
  1430. }),
  1431. $globals.Collection);
  1432. $core.addMethod(
  1433. $core.method({
  1434. selector: "removeAll",
  1435. protocol: 'adding/removing',
  1436. fn: function (){
  1437. var self=this;
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. return $core.withContext(function($ctx1) {
  1440. //>>excludeEnd("ctx");
  1441. self._subclassResponsibility();
  1442. return self;
  1443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1444. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1445. //>>excludeEnd("ctx");
  1446. },
  1447. //>>excludeStart("ide", pragmas.excludeIdeData);
  1448. args: [],
  1449. source: "removeAll\x0a\x09self subclassResponsibility",
  1450. referencedClasses: [],
  1451. //>>excludeEnd("ide");
  1452. messageSends: ["subclassResponsibility"]
  1453. }),
  1454. $globals.Collection);
  1455. $core.addMethod(
  1456. $core.method({
  1457. selector: "select:",
  1458. protocol: 'enumerating',
  1459. fn: function (aBlock){
  1460. var self=this;
  1461. var stream;
  1462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1463. return $core.withContext(function($ctx1) {
  1464. //>>excludeEnd("ctx");
  1465. var $1;
  1466. stream=$recv($recv(self._class())._new())._writeStream();
  1467. self._do_((function(each){
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. return $core.withContext(function($ctx2) {
  1470. //>>excludeEnd("ctx");
  1471. $1=$recv(aBlock)._value_(each);
  1472. if($core.assert($1)){
  1473. return $recv(stream)._nextPut_(each);
  1474. };
  1475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1477. //>>excludeEnd("ctx");
  1478. }));
  1479. return $recv(stream)._contents();
  1480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1481. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1482. //>>excludeEnd("ctx");
  1483. },
  1484. //>>excludeStart("ide", pragmas.excludeIdeData);
  1485. args: ["aBlock"],
  1486. 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",
  1487. referencedClasses: [],
  1488. //>>excludeEnd("ide");
  1489. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1490. }),
  1491. $globals.Collection);
  1492. $core.addMethod(
  1493. $core.method({
  1494. selector: "select:thenCollect:",
  1495. protocol: 'enumerating',
  1496. fn: function (selectBlock,collectBlock){
  1497. var self=this;
  1498. var stream;
  1499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1500. return $core.withContext(function($ctx1) {
  1501. //>>excludeEnd("ctx");
  1502. var $1;
  1503. stream=$recv($recv(self._class())._new())._writeStream();
  1504. self._do_((function(each){
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. return $core.withContext(function($ctx2) {
  1507. //>>excludeEnd("ctx");
  1508. $1=$recv(selectBlock)._value_(each);
  1509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1510. $ctx2.sendIdx["value:"]=1;
  1511. //>>excludeEnd("ctx");
  1512. if($core.assert($1)){
  1513. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1514. };
  1515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1517. //>>excludeEnd("ctx");
  1518. }));
  1519. return $recv(stream)._contents();
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1522. //>>excludeEnd("ctx");
  1523. },
  1524. //>>excludeStart("ide", pragmas.excludeIdeData);
  1525. args: ["selectBlock", "collectBlock"],
  1526. 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",
  1527. referencedClasses: [],
  1528. //>>excludeEnd("ide");
  1529. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1530. }),
  1531. $globals.Collection);
  1532. $core.addMethod(
  1533. $core.method({
  1534. selector: "shallowCopy",
  1535. protocol: 'copying',
  1536. fn: function (){
  1537. var self=this;
  1538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1539. return $core.withContext(function($ctx1) {
  1540. //>>excludeEnd("ctx");
  1541. return self._collect_((function(each){
  1542. return each;
  1543. }));
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1546. //>>excludeEnd("ctx");
  1547. },
  1548. //>>excludeStart("ide", pragmas.excludeIdeData);
  1549. args: [],
  1550. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1551. referencedClasses: [],
  1552. //>>excludeEnd("ide");
  1553. messageSends: ["collect:"]
  1554. }),
  1555. $globals.Collection);
  1556. $core.addMethod(
  1557. $core.method({
  1558. selector: "size",
  1559. protocol: 'accessing',
  1560. fn: function (){
  1561. var self=this;
  1562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1563. return $core.withContext(function($ctx1) {
  1564. //>>excludeEnd("ctx");
  1565. self._subclassResponsibility();
  1566. return self;
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1569. //>>excludeEnd("ctx");
  1570. },
  1571. //>>excludeStart("ide", pragmas.excludeIdeData);
  1572. args: [],
  1573. source: "size\x0a\x09self subclassResponsibility",
  1574. referencedClasses: [],
  1575. //>>excludeEnd("ide");
  1576. messageSends: ["subclassResponsibility"]
  1577. }),
  1578. $globals.Collection);
  1579. $core.addMethod(
  1580. $core.method({
  1581. selector: "classTag",
  1582. protocol: 'accessing',
  1583. fn: function (){
  1584. var self=this;
  1585. return "collection";
  1586. },
  1587. //>>excludeStart("ide", pragmas.excludeIdeData);
  1588. args: [],
  1589. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  1590. referencedClasses: [],
  1591. //>>excludeEnd("ide");
  1592. messageSends: []
  1593. }),
  1594. $globals.Collection.klass);
  1595. $core.addMethod(
  1596. $core.method({
  1597. selector: "new:",
  1598. protocol: 'instance creation',
  1599. fn: function (anInteger){
  1600. var self=this;
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. return $core.withContext(function($ctx1) {
  1603. //>>excludeEnd("ctx");
  1604. return self._new();
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  1607. //>>excludeEnd("ctx");
  1608. },
  1609. //>>excludeStart("ide", pragmas.excludeIdeData);
  1610. args: ["anInteger"],
  1611. source: "new: anInteger\x0a\x09^ self new",
  1612. referencedClasses: [],
  1613. //>>excludeEnd("ide");
  1614. messageSends: ["new"]
  1615. }),
  1616. $globals.Collection.klass);
  1617. $core.addMethod(
  1618. $core.method({
  1619. selector: "with:",
  1620. protocol: 'instance creation',
  1621. fn: function (anObject){
  1622. var self=this;
  1623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1624. return $core.withContext(function($ctx1) {
  1625. //>>excludeEnd("ctx");
  1626. var $1;
  1627. $1=self._new();
  1628. $recv($1)._add_(anObject);
  1629. return $recv($1)._yourself();
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  1632. //>>excludeEnd("ctx");
  1633. },
  1634. //>>excludeStart("ide", pragmas.excludeIdeData);
  1635. args: ["anObject"],
  1636. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1637. referencedClasses: [],
  1638. //>>excludeEnd("ide");
  1639. messageSends: ["add:", "new", "yourself"]
  1640. }),
  1641. $globals.Collection.klass);
  1642. $core.addMethod(
  1643. $core.method({
  1644. selector: "with:with:",
  1645. protocol: 'instance creation',
  1646. fn: function (anObject,anotherObject){
  1647. var self=this;
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. return $core.withContext(function($ctx1) {
  1650. //>>excludeEnd("ctx");
  1651. var $1;
  1652. $1=self._new();
  1653. $recv($1)._add_(anObject);
  1654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1655. $ctx1.sendIdx["add:"]=1;
  1656. //>>excludeEnd("ctx");
  1657. $recv($1)._add_(anotherObject);
  1658. return $recv($1)._yourself();
  1659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1660. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  1661. //>>excludeEnd("ctx");
  1662. },
  1663. //>>excludeStart("ide", pragmas.excludeIdeData);
  1664. args: ["anObject", "anotherObject"],
  1665. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1666. referencedClasses: [],
  1667. //>>excludeEnd("ide");
  1668. messageSends: ["add:", "new", "yourself"]
  1669. }),
  1670. $globals.Collection.klass);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "with:with:with:",
  1674. protocol: 'instance creation',
  1675. fn: function (firstObject,secondObject,thirdObject){
  1676. var self=this;
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. return $core.withContext(function($ctx1) {
  1679. //>>excludeEnd("ctx");
  1680. var $1;
  1681. $1=self._new();
  1682. $recv($1)._add_(firstObject);
  1683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1684. $ctx1.sendIdx["add:"]=1;
  1685. //>>excludeEnd("ctx");
  1686. $recv($1)._add_(secondObject);
  1687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1688. $ctx1.sendIdx["add:"]=2;
  1689. //>>excludeEnd("ctx");
  1690. $recv($1)._add_(thirdObject);
  1691. return $recv($1)._yourself();
  1692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1693. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  1694. //>>excludeEnd("ctx");
  1695. },
  1696. //>>excludeStart("ide", pragmas.excludeIdeData);
  1697. args: ["firstObject", "secondObject", "thirdObject"],
  1698. 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",
  1699. referencedClasses: [],
  1700. //>>excludeEnd("ide");
  1701. messageSends: ["add:", "new", "yourself"]
  1702. }),
  1703. $globals.Collection.klass);
  1704. $core.addMethod(
  1705. $core.method({
  1706. selector: "withAll:",
  1707. protocol: 'instance creation',
  1708. fn: function (aCollection){
  1709. var self=this;
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. return $core.withContext(function($ctx1) {
  1712. //>>excludeEnd("ctx");
  1713. var $1;
  1714. $1=self._new();
  1715. $recv($1)._addAll_(aCollection);
  1716. return $recv($1)._yourself();
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  1719. //>>excludeEnd("ctx");
  1720. },
  1721. //>>excludeStart("ide", pragmas.excludeIdeData);
  1722. args: ["aCollection"],
  1723. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1724. referencedClasses: [],
  1725. //>>excludeEnd("ide");
  1726. messageSends: ["addAll:", "new", "yourself"]
  1727. }),
  1728. $globals.Collection.klass);
  1729. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  1730. //>>excludeStart("ide", pragmas.excludeIdeData);
  1731. $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.";
  1732. //>>excludeEnd("ide");
  1733. $core.addMethod(
  1734. $core.method({
  1735. selector: "at:",
  1736. protocol: 'accessing',
  1737. fn: function (anIndex){
  1738. var self=this;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. return $core.withContext(function($ctx1) {
  1741. //>>excludeEnd("ctx");
  1742. return self._at_ifAbsent_(anIndex,(function(){
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. return $core.withContext(function($ctx2) {
  1745. //>>excludeEnd("ctx");
  1746. return self._errorNotFound();
  1747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1749. //>>excludeEnd("ctx");
  1750. }));
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1753. //>>excludeEnd("ctx");
  1754. },
  1755. //>>excludeStart("ide", pragmas.excludeIdeData);
  1756. args: ["anIndex"],
  1757. 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 ]",
  1758. referencedClasses: [],
  1759. //>>excludeEnd("ide");
  1760. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1761. }),
  1762. $globals.IndexableCollection);
  1763. $core.addMethod(
  1764. $core.method({
  1765. selector: "at:ifAbsent:",
  1766. protocol: 'accessing',
  1767. fn: function (anIndex,aBlock){
  1768. var self=this;
  1769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1770. return $core.withContext(function($ctx1) {
  1771. //>>excludeEnd("ctx");
  1772. self._subclassResponsibility();
  1773. return self;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1776. //>>excludeEnd("ctx");
  1777. },
  1778. //>>excludeStart("ide", pragmas.excludeIdeData);
  1779. args: ["anIndex", "aBlock"],
  1780. 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",
  1781. referencedClasses: [],
  1782. //>>excludeEnd("ide");
  1783. messageSends: ["subclassResponsibility"]
  1784. }),
  1785. $globals.IndexableCollection);
  1786. $core.addMethod(
  1787. $core.method({
  1788. selector: "at:ifAbsentPut:",
  1789. protocol: 'accessing',
  1790. fn: function (aKey,aBlock){
  1791. var self=this;
  1792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1793. return $core.withContext(function($ctx1) {
  1794. //>>excludeEnd("ctx");
  1795. return self._at_ifAbsent_(aKey,(function(){
  1796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1797. return $core.withContext(function($ctx2) {
  1798. //>>excludeEnd("ctx");
  1799. return self._at_put_(aKey,$recv(aBlock)._value());
  1800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1802. //>>excludeEnd("ctx");
  1803. }));
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1806. //>>excludeEnd("ctx");
  1807. },
  1808. //>>excludeStart("ide", pragmas.excludeIdeData);
  1809. args: ["aKey", "aBlock"],
  1810. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1811. referencedClasses: [],
  1812. //>>excludeEnd("ide");
  1813. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1814. }),
  1815. $globals.IndexableCollection);
  1816. $core.addMethod(
  1817. $core.method({
  1818. selector: "at:ifPresent:",
  1819. protocol: 'accessing',
  1820. fn: function (anIndex,aBlock){
  1821. var self=this;
  1822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1823. return $core.withContext(function($ctx1) {
  1824. //>>excludeEnd("ctx");
  1825. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1826. return nil;
  1827. }));
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1830. //>>excludeEnd("ctx");
  1831. },
  1832. //>>excludeStart("ide", pragmas.excludeIdeData);
  1833. args: ["anIndex", "aBlock"],
  1834. 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 ]",
  1835. referencedClasses: [],
  1836. //>>excludeEnd("ide");
  1837. messageSends: ["at:ifPresent:ifAbsent:"]
  1838. }),
  1839. $globals.IndexableCollection);
  1840. $core.addMethod(
  1841. $core.method({
  1842. selector: "at:ifPresent:ifAbsent:",
  1843. protocol: 'accessing',
  1844. fn: function (anIndex,aBlock,anotherBlock){
  1845. var self=this;
  1846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1847. return $core.withContext(function($ctx1) {
  1848. //>>excludeEnd("ctx");
  1849. self._subclassResponsibility();
  1850. return self;
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1853. //>>excludeEnd("ctx");
  1854. },
  1855. //>>excludeStart("ide", pragmas.excludeIdeData);
  1856. args: ["anIndex", "aBlock", "anotherBlock"],
  1857. 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",
  1858. referencedClasses: [],
  1859. //>>excludeEnd("ide");
  1860. messageSends: ["subclassResponsibility"]
  1861. }),
  1862. $globals.IndexableCollection);
  1863. $core.addMethod(
  1864. $core.method({
  1865. selector: "at:put:",
  1866. protocol: 'accessing',
  1867. fn: function (anIndex,anObject){
  1868. var self=this;
  1869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1870. return $core.withContext(function($ctx1) {
  1871. //>>excludeEnd("ctx");
  1872. self._subclassResponsibility();
  1873. return self;
  1874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1875. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1876. //>>excludeEnd("ctx");
  1877. },
  1878. //>>excludeStart("ide", pragmas.excludeIdeData);
  1879. args: ["anIndex", "anObject"],
  1880. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1881. referencedClasses: [],
  1882. //>>excludeEnd("ide");
  1883. messageSends: ["subclassResponsibility"]
  1884. }),
  1885. $globals.IndexableCollection);
  1886. $core.addMethod(
  1887. $core.method({
  1888. selector: "indexOf:",
  1889. protocol: 'accessing',
  1890. fn: function (anObject){
  1891. var self=this;
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. return $core.withContext(function($ctx1) {
  1894. //>>excludeEnd("ctx");
  1895. return self._indexOf_ifAbsent_(anObject,(function(){
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. return $core.withContext(function($ctx2) {
  1898. //>>excludeEnd("ctx");
  1899. return self._errorNotFound();
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1902. //>>excludeEnd("ctx");
  1903. }));
  1904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1905. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1906. //>>excludeEnd("ctx");
  1907. },
  1908. //>>excludeStart("ide", pragmas.excludeIdeData);
  1909. args: ["anObject"],
  1910. 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 ]",
  1911. referencedClasses: [],
  1912. //>>excludeEnd("ide");
  1913. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1914. }),
  1915. $globals.IndexableCollection);
  1916. $core.addMethod(
  1917. $core.method({
  1918. selector: "indexOf:ifAbsent:",
  1919. protocol: 'accessing',
  1920. fn: function (anObject,aBlock){
  1921. var self=this;
  1922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1923. return $core.withContext(function($ctx1) {
  1924. //>>excludeEnd("ctx");
  1925. self._subclassResponsibility();
  1926. return self;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1929. //>>excludeEnd("ctx");
  1930. },
  1931. //>>excludeStart("ide", pragmas.excludeIdeData);
  1932. args: ["anObject", "aBlock"],
  1933. 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",
  1934. referencedClasses: [],
  1935. //>>excludeEnd("ide");
  1936. messageSends: ["subclassResponsibility"]
  1937. }),
  1938. $globals.IndexableCollection);
  1939. $core.addMethod(
  1940. $core.method({
  1941. selector: "with:do:",
  1942. protocol: 'enumerating',
  1943. fn: function (anotherCollection,aBlock){
  1944. var self=this;
  1945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1946. return $core.withContext(function($ctx1) {
  1947. //>>excludeEnd("ctx");
  1948. self._withIndexDo_((function(each,index){
  1949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1950. return $core.withContext(function($ctx2) {
  1951. //>>excludeEnd("ctx");
  1952. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  1955. //>>excludeEnd("ctx");
  1956. }));
  1957. return self;
  1958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1959. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  1960. //>>excludeEnd("ctx");
  1961. },
  1962. //>>excludeStart("ide", pragmas.excludeIdeData);
  1963. args: ["anotherCollection", "aBlock"],
  1964. 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) ]",
  1965. referencedClasses: [],
  1966. //>>excludeEnd("ide");
  1967. messageSends: ["withIndexDo:", "value:value:", "at:"]
  1968. }),
  1969. $globals.IndexableCollection);
  1970. $core.addMethod(
  1971. $core.method({
  1972. selector: "withIndexDo:",
  1973. protocol: 'enumerating',
  1974. fn: function (aBlock){
  1975. var self=this;
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. return $core.withContext(function($ctx1) {
  1978. //>>excludeEnd("ctx");
  1979. self._subclassResponsibility();
  1980. return self;
  1981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1982. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  1983. //>>excludeEnd("ctx");
  1984. },
  1985. //>>excludeStart("ide", pragmas.excludeIdeData);
  1986. args: ["aBlock"],
  1987. 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",
  1988. referencedClasses: [],
  1989. //>>excludeEnd("ide");
  1990. messageSends: ["subclassResponsibility"]
  1991. }),
  1992. $globals.IndexableCollection);
  1993. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  1994. //>>excludeStart("ide", pragmas.excludeIdeData);
  1995. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1996. //>>excludeEnd("ide");
  1997. $core.addMethod(
  1998. $core.method({
  1999. selector: "=",
  2000. protocol: 'comparing',
  2001. fn: function (anAssocitativeCollection){
  2002. var self=this;
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx1) {
  2005. //>>excludeEnd("ctx");
  2006. var $2,$1,$4,$3,$5;
  2007. $2=self._class();
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. $ctx1.sendIdx["class"]=1;
  2010. //>>excludeEnd("ctx");
  2011. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. $ctx1.sendIdx["="]=1;
  2014. //>>excludeEnd("ctx");
  2015. if(!$core.assert($1)){
  2016. return false;
  2017. };
  2018. $4=self._size();
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. $ctx1.sendIdx["size"]=1;
  2021. //>>excludeEnd("ctx");
  2022. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. $ctx1.sendIdx["="]=2;
  2025. //>>excludeEnd("ctx");
  2026. if(!$core.assert($3)){
  2027. return false;
  2028. };
  2029. $5=self._associations();
  2030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2031. $ctx1.sendIdx["associations"]=1;
  2032. //>>excludeEnd("ctx");
  2033. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2035. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2036. //>>excludeEnd("ctx");
  2037. },
  2038. //>>excludeStart("ide", pragmas.excludeIdeData);
  2039. args: ["anAssocitativeCollection"],
  2040. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2041. referencedClasses: [],
  2042. //>>excludeEnd("ide");
  2043. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2044. }),
  2045. $globals.AssociativeCollection);
  2046. $core.addMethod(
  2047. $core.method({
  2048. selector: "add:",
  2049. protocol: 'adding/removing',
  2050. fn: function (anAssociation){
  2051. var self=this;
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. return $core.withContext(function($ctx1) {
  2054. //>>excludeEnd("ctx");
  2055. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2056. return self;
  2057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2058. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2059. //>>excludeEnd("ctx");
  2060. },
  2061. //>>excludeStart("ide", pragmas.excludeIdeData);
  2062. args: ["anAssociation"],
  2063. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2064. referencedClasses: [],
  2065. //>>excludeEnd("ide");
  2066. messageSends: ["at:put:", "key", "value"]
  2067. }),
  2068. $globals.AssociativeCollection);
  2069. $core.addMethod(
  2070. $core.method({
  2071. selector: "addAll:",
  2072. protocol: 'adding/removing',
  2073. fn: function (anAssociativeCollection){
  2074. var self=this;
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. return $core.withContext(function($ctx1) {
  2077. //>>excludeEnd("ctx");
  2078. (
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. $ctx1.supercall = true,
  2081. //>>excludeEnd("ctx");
  2082. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. $ctx1.supercall = false;
  2085. //>>excludeEnd("ctx");;
  2086. return anAssociativeCollection;
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2089. //>>excludeEnd("ctx");
  2090. },
  2091. //>>excludeStart("ide", pragmas.excludeIdeData);
  2092. args: ["anAssociativeCollection"],
  2093. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2094. referencedClasses: [],
  2095. //>>excludeEnd("ide");
  2096. messageSends: ["addAll:", "associations"]
  2097. }),
  2098. $globals.AssociativeCollection);
  2099. $core.addMethod(
  2100. $core.method({
  2101. selector: "asDictionary",
  2102. protocol: 'converting',
  2103. fn: function (){
  2104. var self=this;
  2105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2106. return $core.withContext(function($ctx1) {
  2107. //>>excludeEnd("ctx");
  2108. return $recv($globals.Dictionary)._from_(self._associations());
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2111. //>>excludeEnd("ctx");
  2112. },
  2113. //>>excludeStart("ide", pragmas.excludeIdeData);
  2114. args: [],
  2115. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2116. referencedClasses: ["Dictionary"],
  2117. //>>excludeEnd("ide");
  2118. messageSends: ["from:", "associations"]
  2119. }),
  2120. $globals.AssociativeCollection);
  2121. $core.addMethod(
  2122. $core.method({
  2123. selector: "asHashedCollection",
  2124. protocol: 'converting',
  2125. fn: function (){
  2126. var self=this;
  2127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2128. return $core.withContext(function($ctx1) {
  2129. //>>excludeEnd("ctx");
  2130. return $recv($globals.HashedCollection)._from_(self._associations());
  2131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2132. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2133. //>>excludeEnd("ctx");
  2134. },
  2135. //>>excludeStart("ide", pragmas.excludeIdeData);
  2136. args: [],
  2137. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2138. referencedClasses: ["HashedCollection"],
  2139. //>>excludeEnd("ide");
  2140. messageSends: ["from:", "associations"]
  2141. }),
  2142. $globals.AssociativeCollection);
  2143. $core.addMethod(
  2144. $core.method({
  2145. selector: "asJSON",
  2146. protocol: 'converting',
  2147. fn: function (){
  2148. var self=this;
  2149. var hash;
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. return $core.withContext(function($ctx1) {
  2152. //>>excludeEnd("ctx");
  2153. hash=$recv($globals.HashedCollection)._new();
  2154. self._keysAndValuesDo_((function(key,value){
  2155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2156. return $core.withContext(function($ctx2) {
  2157. //>>excludeEnd("ctx");
  2158. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  2159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2160. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2161. //>>excludeEnd("ctx");
  2162. }));
  2163. return hash;
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  2166. //>>excludeEnd("ctx");
  2167. },
  2168. //>>excludeStart("ide", pragmas.excludeIdeData);
  2169. args: [],
  2170. 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",
  2171. referencedClasses: ["HashedCollection"],
  2172. //>>excludeEnd("ide");
  2173. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  2174. }),
  2175. $globals.AssociativeCollection);
  2176. $core.addMethod(
  2177. $core.method({
  2178. selector: "associations",
  2179. protocol: 'accessing',
  2180. fn: function (){
  2181. var self=this;
  2182. var associations;
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. return $core.withContext(function($ctx1) {
  2185. //>>excludeEnd("ctx");
  2186. associations=[];
  2187. self._associationsDo_((function(each){
  2188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2189. return $core.withContext(function($ctx2) {
  2190. //>>excludeEnd("ctx");
  2191. return $recv(associations)._add_(each);
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2194. //>>excludeEnd("ctx");
  2195. }));
  2196. return associations;
  2197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2198. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2199. //>>excludeEnd("ctx");
  2200. },
  2201. //>>excludeStart("ide", pragmas.excludeIdeData);
  2202. args: [],
  2203. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2204. referencedClasses: [],
  2205. //>>excludeEnd("ide");
  2206. messageSends: ["associationsDo:", "add:"]
  2207. }),
  2208. $globals.AssociativeCollection);
  2209. $core.addMethod(
  2210. $core.method({
  2211. selector: "associationsDo:",
  2212. protocol: 'enumerating',
  2213. fn: function (aBlock){
  2214. var self=this;
  2215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2216. return $core.withContext(function($ctx1) {
  2217. //>>excludeEnd("ctx");
  2218. self._keysAndValuesDo_((function(key,value){
  2219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2220. return $core.withContext(function($ctx2) {
  2221. //>>excludeEnd("ctx");
  2222. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2225. //>>excludeEnd("ctx");
  2226. }));
  2227. return self;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2230. //>>excludeEnd("ctx");
  2231. },
  2232. //>>excludeStart("ide", pragmas.excludeIdeData);
  2233. args: ["aBlock"],
  2234. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2235. referencedClasses: ["Association"],
  2236. //>>excludeEnd("ide");
  2237. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2238. }),
  2239. $globals.AssociativeCollection);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "at:ifPresent:ifAbsent:",
  2243. protocol: 'accessing',
  2244. fn: function (aKey,aBlock,anotherBlock){
  2245. var self=this;
  2246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2247. return $core.withContext(function($ctx1) {
  2248. //>>excludeEnd("ctx");
  2249. var $1;
  2250. $1=self._includesKey_(aKey);
  2251. if($core.assert($1)){
  2252. return $recv(aBlock)._value_(self._at_(aKey));
  2253. } else {
  2254. return $recv(anotherBlock)._value();
  2255. };
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2258. //>>excludeEnd("ctx");
  2259. },
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["aKey", "aBlock", "anotherBlock"],
  2262. 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 ]",
  2263. referencedClasses: [],
  2264. //>>excludeEnd("ide");
  2265. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2266. }),
  2267. $globals.AssociativeCollection);
  2268. $core.addMethod(
  2269. $core.method({
  2270. selector: "collect:",
  2271. protocol: 'enumerating',
  2272. fn: function (aBlock){
  2273. var self=this;
  2274. var newDict;
  2275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2276. return $core.withContext(function($ctx1) {
  2277. //>>excludeEnd("ctx");
  2278. newDict=$recv(self._class())._new();
  2279. self._keysAndValuesDo_((function(key,value){
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx2) {
  2282. //>>excludeEnd("ctx");
  2283. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2286. //>>excludeEnd("ctx");
  2287. }));
  2288. return newDict;
  2289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2290. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2291. //>>excludeEnd("ctx");
  2292. },
  2293. //>>excludeStart("ide", pragmas.excludeIdeData);
  2294. args: ["aBlock"],
  2295. 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",
  2296. referencedClasses: [],
  2297. //>>excludeEnd("ide");
  2298. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2299. }),
  2300. $globals.AssociativeCollection);
  2301. $core.addMethod(
  2302. $core.method({
  2303. selector: "deepCopy",
  2304. protocol: 'copying',
  2305. fn: function (){
  2306. var self=this;
  2307. var copy;
  2308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2309. return $core.withContext(function($ctx1) {
  2310. //>>excludeEnd("ctx");
  2311. copy=$recv(self._class())._new();
  2312. self._keysAndValuesDo_((function(key,value){
  2313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2314. return $core.withContext(function($ctx2) {
  2315. //>>excludeEnd("ctx");
  2316. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2318. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2319. //>>excludeEnd("ctx");
  2320. }));
  2321. return copy;
  2322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2323. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2324. //>>excludeEnd("ctx");
  2325. },
  2326. //>>excludeStart("ide", pragmas.excludeIdeData);
  2327. args: [],
  2328. 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",
  2329. referencedClasses: [],
  2330. //>>excludeEnd("ide");
  2331. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2332. }),
  2333. $globals.AssociativeCollection);
  2334. $core.addMethod(
  2335. $core.method({
  2336. selector: "detect:ifNone:",
  2337. protocol: 'enumerating',
  2338. fn: function (aBlock,anotherBlock){
  2339. var self=this;
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. return $core.withContext(function($ctx1) {
  2342. //>>excludeEnd("ctx");
  2343. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2346. //>>excludeEnd("ctx");
  2347. },
  2348. //>>excludeStart("ide", pragmas.excludeIdeData);
  2349. args: ["aBlock", "anotherBlock"],
  2350. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2351. referencedClasses: [],
  2352. //>>excludeEnd("ide");
  2353. messageSends: ["detect:ifNone:", "values"]
  2354. }),
  2355. $globals.AssociativeCollection);
  2356. $core.addMethod(
  2357. $core.method({
  2358. selector: "do:",
  2359. protocol: 'enumerating',
  2360. fn: function (aBlock){
  2361. var self=this;
  2362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2363. return $core.withContext(function($ctx1) {
  2364. //>>excludeEnd("ctx");
  2365. self._valuesDo_(aBlock);
  2366. return self;
  2367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2368. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2369. //>>excludeEnd("ctx");
  2370. },
  2371. //>>excludeStart("ide", pragmas.excludeIdeData);
  2372. args: ["aBlock"],
  2373. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2374. referencedClasses: [],
  2375. //>>excludeEnd("ide");
  2376. messageSends: ["valuesDo:"]
  2377. }),
  2378. $globals.AssociativeCollection);
  2379. $core.addMethod(
  2380. $core.method({
  2381. selector: "includes:",
  2382. protocol: 'enumerating',
  2383. fn: function (anObject){
  2384. var self=this;
  2385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2386. return $core.withContext(function($ctx1) {
  2387. //>>excludeEnd("ctx");
  2388. return $recv(self._values())._includes_(anObject);
  2389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2390. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2391. //>>excludeEnd("ctx");
  2392. },
  2393. //>>excludeStart("ide", pragmas.excludeIdeData);
  2394. args: ["anObject"],
  2395. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2396. referencedClasses: [],
  2397. //>>excludeEnd("ide");
  2398. messageSends: ["includes:", "values"]
  2399. }),
  2400. $globals.AssociativeCollection);
  2401. $core.addMethod(
  2402. $core.method({
  2403. selector: "includesKey:",
  2404. protocol: 'testing',
  2405. fn: function (aKey){
  2406. var self=this;
  2407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2408. return $core.withContext(function($ctx1) {
  2409. //>>excludeEnd("ctx");
  2410. self._subclassResponsibility();
  2411. return self;
  2412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2413. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2414. //>>excludeEnd("ctx");
  2415. },
  2416. //>>excludeStart("ide", pragmas.excludeIdeData);
  2417. args: ["aKey"],
  2418. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2419. referencedClasses: [],
  2420. //>>excludeEnd("ide");
  2421. messageSends: ["subclassResponsibility"]
  2422. }),
  2423. $globals.AssociativeCollection);
  2424. $core.addMethod(
  2425. $core.method({
  2426. selector: "indexOf:ifAbsent:",
  2427. protocol: 'accessing',
  2428. fn: function (anObject,aBlock){
  2429. var self=this;
  2430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2431. return $core.withContext(function($ctx1) {
  2432. //>>excludeEnd("ctx");
  2433. return $recv(self._keys())._detect_ifNone_((function(each){
  2434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2435. return $core.withContext(function($ctx2) {
  2436. //>>excludeEnd("ctx");
  2437. return $recv(self._at_(each)).__eq(anObject);
  2438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2439. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2440. //>>excludeEnd("ctx");
  2441. }),aBlock);
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2444. //>>excludeEnd("ctx");
  2445. },
  2446. //>>excludeStart("ide", pragmas.excludeIdeData);
  2447. args: ["anObject", "aBlock"],
  2448. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2449. referencedClasses: [],
  2450. //>>excludeEnd("ide");
  2451. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2452. }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "keyAtValue:",
  2457. protocol: 'accessing',
  2458. fn: function (anObject){
  2459. var self=this;
  2460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2461. return $core.withContext(function($ctx1) {
  2462. //>>excludeEnd("ctx");
  2463. return self._keyAtValue_ifAbsent_(anObject,(function(){
  2464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2465. return $core.withContext(function($ctx2) {
  2466. //>>excludeEnd("ctx");
  2467. return self._errorNotFound();
  2468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2470. //>>excludeEnd("ctx");
  2471. }));
  2472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2473. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2474. //>>excludeEnd("ctx");
  2475. },
  2476. //>>excludeStart("ide", pragmas.excludeIdeData);
  2477. args: ["anObject"],
  2478. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2479. referencedClasses: [],
  2480. //>>excludeEnd("ide");
  2481. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2482. }),
  2483. $globals.AssociativeCollection);
  2484. $core.addMethod(
  2485. $core.method({
  2486. selector: "keyAtValue:ifAbsent:",
  2487. protocol: 'accessing',
  2488. fn: function (anObject,aBlock){
  2489. var self=this;
  2490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2491. return $core.withContext(function($ctx1) {
  2492. //>>excludeEnd("ctx");
  2493. return self._indexOf_ifAbsent_(anObject,aBlock);
  2494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2495. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2496. //>>excludeEnd("ctx");
  2497. },
  2498. //>>excludeStart("ide", pragmas.excludeIdeData);
  2499. args: ["anObject", "aBlock"],
  2500. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2501. referencedClasses: [],
  2502. //>>excludeEnd("ide");
  2503. messageSends: ["indexOf:ifAbsent:"]
  2504. }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "keys",
  2509. protocol: 'accessing',
  2510. fn: function (){
  2511. var self=this;
  2512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2513. return $core.withContext(function($ctx1) {
  2514. //>>excludeEnd("ctx");
  2515. self._subclassResponsibility();
  2516. return self;
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2519. //>>excludeEnd("ctx");
  2520. },
  2521. //>>excludeStart("ide", pragmas.excludeIdeData);
  2522. args: [],
  2523. source: "keys\x0a\x09self subclassResponsibility",
  2524. referencedClasses: [],
  2525. //>>excludeEnd("ide");
  2526. messageSends: ["subclassResponsibility"]
  2527. }),
  2528. $globals.AssociativeCollection);
  2529. $core.addMethod(
  2530. $core.method({
  2531. selector: "keysAndValuesDo:",
  2532. protocol: 'enumerating',
  2533. fn: function (aBlock){
  2534. var self=this;
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. return $core.withContext(function($ctx1) {
  2537. //>>excludeEnd("ctx");
  2538. self._keysDo_((function(each){
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. return $core.withContext(function($ctx2) {
  2541. //>>excludeEnd("ctx");
  2542. return $recv(aBlock)._value_value_(each,self._at_(each));
  2543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2545. //>>excludeEnd("ctx");
  2546. }));
  2547. return self;
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2550. //>>excludeEnd("ctx");
  2551. },
  2552. //>>excludeStart("ide", pragmas.excludeIdeData);
  2553. args: ["aBlock"],
  2554. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2555. referencedClasses: [],
  2556. //>>excludeEnd("ide");
  2557. messageSends: ["keysDo:", "value:value:", "at:"]
  2558. }),
  2559. $globals.AssociativeCollection);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "keysDo:",
  2563. protocol: 'enumerating',
  2564. fn: function (aBlock){
  2565. var self=this;
  2566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2567. return $core.withContext(function($ctx1) {
  2568. //>>excludeEnd("ctx");
  2569. self._subclassResponsibility();
  2570. return self;
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2573. //>>excludeEnd("ctx");
  2574. },
  2575. //>>excludeStart("ide", pragmas.excludeIdeData);
  2576. args: ["aBlock"],
  2577. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2578. referencedClasses: [],
  2579. //>>excludeEnd("ide");
  2580. messageSends: ["subclassResponsibility"]
  2581. }),
  2582. $globals.AssociativeCollection);
  2583. $core.addMethod(
  2584. $core.method({
  2585. selector: "printOn:",
  2586. protocol: 'printing',
  2587. fn: function (aStream){
  2588. var self=this;
  2589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2590. return $core.withContext(function($ctx1) {
  2591. //>>excludeEnd("ctx");
  2592. (
  2593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2594. $ctx1.supercall = true,
  2595. //>>excludeEnd("ctx");
  2596. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  2597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2598. $ctx1.supercall = false;
  2599. //>>excludeEnd("ctx");;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. $ctx1.sendIdx["printOn:"]=1;
  2602. //>>excludeEnd("ctx");
  2603. $recv(aStream)._nextPutAll_(" (");
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. $ctx1.sendIdx["nextPutAll:"]=1;
  2606. //>>excludeEnd("ctx");
  2607. $recv(self._associations())._do_separatedBy_((function(each){
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. return $core.withContext(function($ctx2) {
  2610. //>>excludeEnd("ctx");
  2611. return $recv(each)._printOn_(aStream);
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2614. //>>excludeEnd("ctx");
  2615. }),(function(){
  2616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2617. return $core.withContext(function($ctx2) {
  2618. //>>excludeEnd("ctx");
  2619. return $recv(aStream)._nextPutAll_(" , ");
  2620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2621. $ctx2.sendIdx["nextPutAll:"]=2;
  2622. //>>excludeEnd("ctx");
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2625. //>>excludeEnd("ctx");
  2626. }));
  2627. $recv(aStream)._nextPutAll_(")");
  2628. return self;
  2629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2630. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2631. //>>excludeEnd("ctx");
  2632. },
  2633. //>>excludeStart("ide", pragmas.excludeIdeData);
  2634. args: ["aStream"],
  2635. 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: ')'",
  2636. referencedClasses: [],
  2637. //>>excludeEnd("ide");
  2638. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2639. }),
  2640. $globals.AssociativeCollection);
  2641. $core.addMethod(
  2642. $core.method({
  2643. selector: "remove:ifAbsent:",
  2644. protocol: 'adding/removing',
  2645. fn: function (aKey,aBlock){
  2646. var self=this;
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx1) {
  2649. //>>excludeEnd("ctx");
  2650. return self._removeKey_ifAbsent_(aKey,aBlock);
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2653. //>>excludeEnd("ctx");
  2654. },
  2655. //>>excludeStart("ide", pragmas.excludeIdeData);
  2656. args: ["aKey", "aBlock"],
  2657. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2658. referencedClasses: [],
  2659. //>>excludeEnd("ide");
  2660. messageSends: ["removeKey:ifAbsent:"]
  2661. }),
  2662. $globals.AssociativeCollection);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "removeAll",
  2666. protocol: 'adding/removing',
  2667. fn: function (){
  2668. var self=this;
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. return $core.withContext(function($ctx1) {
  2671. //>>excludeEnd("ctx");
  2672. return $recv(self._keys())._do_((function(each){
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. return $core.withContext(function($ctx2) {
  2675. //>>excludeEnd("ctx");
  2676. return self._removeKey_(each);
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2679. //>>excludeEnd("ctx");
  2680. }));
  2681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2682. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2683. //>>excludeEnd("ctx");
  2684. },
  2685. //>>excludeStart("ide", pragmas.excludeIdeData);
  2686. args: [],
  2687. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2688. referencedClasses: [],
  2689. //>>excludeEnd("ide");
  2690. messageSends: ["do:", "keys", "removeKey:"]
  2691. }),
  2692. $globals.AssociativeCollection);
  2693. $core.addMethod(
  2694. $core.method({
  2695. selector: "removeKey:",
  2696. protocol: 'adding/removing',
  2697. fn: function (aKey){
  2698. var self=this;
  2699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2700. return $core.withContext(function($ctx1) {
  2701. //>>excludeEnd("ctx");
  2702. return self._remove_(aKey);
  2703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2704. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2705. //>>excludeEnd("ctx");
  2706. },
  2707. //>>excludeStart("ide", pragmas.excludeIdeData);
  2708. args: ["aKey"],
  2709. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2710. referencedClasses: [],
  2711. //>>excludeEnd("ide");
  2712. messageSends: ["remove:"]
  2713. }),
  2714. $globals.AssociativeCollection);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "removeKey:ifAbsent:",
  2718. protocol: 'adding/removing',
  2719. fn: function (aKey,aBlock){
  2720. var self=this;
  2721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2722. return $core.withContext(function($ctx1) {
  2723. //>>excludeEnd("ctx");
  2724. self._subclassResponsibility();
  2725. return self;
  2726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2727. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2728. //>>excludeEnd("ctx");
  2729. },
  2730. //>>excludeStart("ide", pragmas.excludeIdeData);
  2731. args: ["aKey", "aBlock"],
  2732. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2733. referencedClasses: [],
  2734. //>>excludeEnd("ide");
  2735. messageSends: ["subclassResponsibility"]
  2736. }),
  2737. $globals.AssociativeCollection);
  2738. $core.addMethod(
  2739. $core.method({
  2740. selector: "select:",
  2741. protocol: 'enumerating',
  2742. fn: function (aBlock){
  2743. var self=this;
  2744. var newDict;
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. return $core.withContext(function($ctx1) {
  2747. //>>excludeEnd("ctx");
  2748. var $1;
  2749. newDict=$recv(self._class())._new();
  2750. self._keysAndValuesDo_((function(key,value){
  2751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2752. return $core.withContext(function($ctx2) {
  2753. //>>excludeEnd("ctx");
  2754. $1=$recv(aBlock)._value_(value);
  2755. if($core.assert($1)){
  2756. return $recv(newDict)._at_put_(key,value);
  2757. };
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2760. //>>excludeEnd("ctx");
  2761. }));
  2762. return newDict;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2765. //>>excludeEnd("ctx");
  2766. },
  2767. //>>excludeStart("ide", pragmas.excludeIdeData);
  2768. args: ["aBlock"],
  2769. 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",
  2770. referencedClasses: [],
  2771. //>>excludeEnd("ide");
  2772. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2773. }),
  2774. $globals.AssociativeCollection);
  2775. $core.addMethod(
  2776. $core.method({
  2777. selector: "shallowCopy",
  2778. protocol: 'copying',
  2779. fn: function (){
  2780. var self=this;
  2781. var copy;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. return $core.withContext(function($ctx1) {
  2784. //>>excludeEnd("ctx");
  2785. copy=$recv(self._class())._new();
  2786. self._keysAndValuesDo_((function(key,value){
  2787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2788. return $core.withContext(function($ctx2) {
  2789. //>>excludeEnd("ctx");
  2790. return $recv(copy)._at_put_(key,value);
  2791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2792. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2793. //>>excludeEnd("ctx");
  2794. }));
  2795. return copy;
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2798. //>>excludeEnd("ctx");
  2799. },
  2800. //>>excludeStart("ide", pragmas.excludeIdeData);
  2801. args: [],
  2802. 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",
  2803. referencedClasses: [],
  2804. //>>excludeEnd("ide");
  2805. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2806. }),
  2807. $globals.AssociativeCollection);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "size",
  2811. protocol: 'accessing',
  2812. fn: function (){
  2813. var self=this;
  2814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2815. return $core.withContext(function($ctx1) {
  2816. //>>excludeEnd("ctx");
  2817. return $recv(self._keys())._size();
  2818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2819. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2820. //>>excludeEnd("ctx");
  2821. },
  2822. //>>excludeStart("ide", pragmas.excludeIdeData);
  2823. args: [],
  2824. source: "size\x0a\x09^ self keys size",
  2825. referencedClasses: [],
  2826. //>>excludeEnd("ide");
  2827. messageSends: ["size", "keys"]
  2828. }),
  2829. $globals.AssociativeCollection);
  2830. $core.addMethod(
  2831. $core.method({
  2832. selector: "values",
  2833. protocol: 'accessing',
  2834. fn: function (){
  2835. var self=this;
  2836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2837. return $core.withContext(function($ctx1) {
  2838. //>>excludeEnd("ctx");
  2839. self._subclassResponsibility();
  2840. return self;
  2841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2842. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2843. //>>excludeEnd("ctx");
  2844. },
  2845. //>>excludeStart("ide", pragmas.excludeIdeData);
  2846. args: [],
  2847. source: "values\x0a\x09self subclassResponsibility",
  2848. referencedClasses: [],
  2849. //>>excludeEnd("ide");
  2850. messageSends: ["subclassResponsibility"]
  2851. }),
  2852. $globals.AssociativeCollection);
  2853. $core.addMethod(
  2854. $core.method({
  2855. selector: "valuesDo:",
  2856. protocol: 'enumerating',
  2857. fn: function (aBlock){
  2858. var self=this;
  2859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2860. return $core.withContext(function($ctx1) {
  2861. //>>excludeEnd("ctx");
  2862. self._subclassResponsibility();
  2863. return self;
  2864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2865. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2866. //>>excludeEnd("ctx");
  2867. },
  2868. //>>excludeStart("ide", pragmas.excludeIdeData);
  2869. args: ["aBlock"],
  2870. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2871. referencedClasses: [],
  2872. //>>excludeEnd("ide");
  2873. messageSends: ["subclassResponsibility"]
  2874. }),
  2875. $globals.AssociativeCollection);
  2876. $core.addMethod(
  2877. $core.method({
  2878. selector: "withIndexDo:",
  2879. protocol: 'enumerating',
  2880. fn: function (aBlock){
  2881. var self=this;
  2882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2883. return $core.withContext(function($ctx1) {
  2884. //>>excludeEnd("ctx");
  2885. self._keysAndValuesDo_((function(key,value){
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. return $core.withContext(function($ctx2) {
  2888. //>>excludeEnd("ctx");
  2889. return $recv(aBlock)._value_value_(value,key);
  2890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2891. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2892. //>>excludeEnd("ctx");
  2893. }));
  2894. return self;
  2895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2896. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2897. //>>excludeEnd("ctx");
  2898. },
  2899. //>>excludeStart("ide", pragmas.excludeIdeData);
  2900. args: ["aBlock"],
  2901. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2902. referencedClasses: [],
  2903. //>>excludeEnd("ide");
  2904. messageSends: ["keysAndValuesDo:", "value:value:"]
  2905. }),
  2906. $globals.AssociativeCollection);
  2907. $core.addMethod(
  2908. $core.method({
  2909. selector: "from:",
  2910. protocol: 'instance creation',
  2911. fn: function (aCollection){
  2912. var self=this;
  2913. var newCollection;
  2914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2915. return $core.withContext(function($ctx1) {
  2916. //>>excludeEnd("ctx");
  2917. newCollection=self._new();
  2918. $recv(aCollection)._do_((function(each){
  2919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2920. return $core.withContext(function($ctx2) {
  2921. //>>excludeEnd("ctx");
  2922. return $recv(newCollection)._add_(each);
  2923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2925. //>>excludeEnd("ctx");
  2926. }));
  2927. return newCollection;
  2928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2929. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  2930. //>>excludeEnd("ctx");
  2931. },
  2932. //>>excludeStart("ide", pragmas.excludeIdeData);
  2933. args: ["aCollection"],
  2934. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2935. referencedClasses: [],
  2936. //>>excludeEnd("ide");
  2937. messageSends: ["new", "do:", "add:"]
  2938. }),
  2939. $globals.AssociativeCollection.klass);
  2940. $core.addMethod(
  2941. $core.method({
  2942. selector: "fromPairs:",
  2943. protocol: 'instance creation',
  2944. fn: function (aCollection){
  2945. var self=this;
  2946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2947. return $core.withContext(function($ctx1) {
  2948. //>>excludeEnd("ctx");
  2949. return self._from_(aCollection);
  2950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2951. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  2952. //>>excludeEnd("ctx");
  2953. },
  2954. //>>excludeStart("ide", pragmas.excludeIdeData);
  2955. args: ["aCollection"],
  2956. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2957. referencedClasses: [],
  2958. //>>excludeEnd("ide");
  2959. messageSends: ["from:"]
  2960. }),
  2961. $globals.AssociativeCollection.klass);
  2962. $core.addMethod(
  2963. $core.method({
  2964. selector: "newFromPairs:",
  2965. protocol: 'instance creation',
  2966. fn: function (aCollection){
  2967. var self=this;
  2968. var newCollection;
  2969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2970. return $core.withContext(function($ctx1) {
  2971. //>>excludeEnd("ctx");
  2972. var $2,$1,$3,$4;
  2973. $2=$recv(aCollection)._size();
  2974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2975. $ctx1.sendIdx["size"]=1;
  2976. //>>excludeEnd("ctx");
  2977. $1=$recv($2)._even();
  2978. if(!$core.assert($1)){
  2979. self._error_("#newFromPairs only accepts arrays of an even length");
  2980. };
  2981. newCollection=self._new();
  2982. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2984. return $core.withContext(function($ctx2) {
  2985. //>>excludeEnd("ctx");
  2986. $3=newCollection;
  2987. $4=$recv(aCollection)._at_(each);
  2988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2989. $ctx2.sendIdx["at:"]=1;
  2990. //>>excludeEnd("ctx");
  2991. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2994. //>>excludeEnd("ctx");
  2995. }));
  2996. return newCollection;
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  2999. //>>excludeEnd("ctx");
  3000. },
  3001. //>>excludeStart("ide", pragmas.excludeIdeData);
  3002. args: ["aCollection"],
  3003. 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",
  3004. referencedClasses: [],
  3005. //>>excludeEnd("ide");
  3006. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3007. }),
  3008. $globals.AssociativeCollection.klass);
  3009. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  3010. //>>excludeStart("ide", pragmas.excludeIdeData);
  3011. $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.";
  3012. //>>excludeEnd("ide");
  3013. $core.addMethod(
  3014. $core.method({
  3015. selector: "at:ifAbsent:",
  3016. protocol: 'accessing',
  3017. fn: function (aKey,aBlock){
  3018. var self=this;
  3019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3020. return $core.withContext(function($ctx1) {
  3021. //>>excludeEnd("ctx");
  3022. var index = self._positionOfKey_(aKey);
  3023. return index >=0 ? self['@values'][index] : aBlock._value();
  3024. ;
  3025. return self;
  3026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3027. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3028. //>>excludeEnd("ctx");
  3029. },
  3030. //>>excludeStart("ide", pragmas.excludeIdeData);
  3031. args: ["aKey", "aBlock"],
  3032. 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>",
  3033. referencedClasses: [],
  3034. //>>excludeEnd("ide");
  3035. messageSends: []
  3036. }),
  3037. $globals.Dictionary);
  3038. $core.addMethod(
  3039. $core.method({
  3040. selector: "at:put:",
  3041. protocol: 'accessing',
  3042. fn: function (aKey,aValue){
  3043. var self=this;
  3044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3045. return $core.withContext(function($ctx1) {
  3046. //>>excludeEnd("ctx");
  3047. var index = self._positionOfKey_(aKey);
  3048. if(index === -1) {
  3049. var keys = self['@keys'];
  3050. index = keys.length;
  3051. keys.push(aKey);
  3052. }
  3053. return self['@values'][index] = aValue;
  3054. ;
  3055. return self;
  3056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3057. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3058. //>>excludeEnd("ctx");
  3059. },
  3060. //>>excludeStart("ide", pragmas.excludeIdeData);
  3061. args: ["aKey", "aValue"],
  3062. 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>",
  3063. referencedClasses: [],
  3064. //>>excludeEnd("ide");
  3065. messageSends: []
  3066. }),
  3067. $globals.Dictionary);
  3068. $core.addMethod(
  3069. $core.method({
  3070. selector: "includesKey:",
  3071. protocol: 'testing',
  3072. fn: function (aKey){
  3073. var self=this;
  3074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3075. return $core.withContext(function($ctx1) {
  3076. //>>excludeEnd("ctx");
  3077. return self._positionOfKey_(aKey) >= 0; ;
  3078. return self;
  3079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3080. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3081. //>>excludeEnd("ctx");
  3082. },
  3083. //>>excludeStart("ide", pragmas.excludeIdeData);
  3084. args: ["aKey"],
  3085. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  3086. referencedClasses: [],
  3087. //>>excludeEnd("ide");
  3088. messageSends: []
  3089. }),
  3090. $globals.Dictionary);
  3091. $core.addMethod(
  3092. $core.method({
  3093. selector: "indexOf:ifAbsent:",
  3094. protocol: 'accessing',
  3095. fn: function (anObject,aBlock){
  3096. var self=this;
  3097. var index;
  3098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3099. return $core.withContext(function($ctx1) {
  3100. //>>excludeEnd("ctx");
  3101. var $1;
  3102. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3103. return (0);
  3104. }));
  3105. $1=$recv(index).__eq((0));
  3106. if($core.assert($1)){
  3107. return $recv(aBlock)._value();
  3108. } else {
  3109. return $recv(self["@keys"])._at_(index);
  3110. };
  3111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3112. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3113. //>>excludeEnd("ctx");
  3114. },
  3115. //>>excludeStart("ide", pragmas.excludeIdeData);
  3116. args: ["anObject", "aBlock"],
  3117. 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 ]",
  3118. referencedClasses: [],
  3119. //>>excludeEnd("ide");
  3120. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3121. }),
  3122. $globals.Dictionary);
  3123. $core.addMethod(
  3124. $core.method({
  3125. selector: "initialize",
  3126. protocol: 'initialization',
  3127. fn: function (){
  3128. var self=this;
  3129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3130. return $core.withContext(function($ctx1) {
  3131. //>>excludeEnd("ctx");
  3132. (
  3133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3134. $ctx1.supercall = true,
  3135. //>>excludeEnd("ctx");
  3136. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  3137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3138. $ctx1.supercall = false;
  3139. //>>excludeEnd("ctx");;
  3140. self["@keys"]=[];
  3141. self["@values"]=[];
  3142. return self;
  3143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3144. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3145. //>>excludeEnd("ctx");
  3146. },
  3147. //>>excludeStart("ide", pragmas.excludeIdeData);
  3148. args: [],
  3149. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3150. referencedClasses: [],
  3151. //>>excludeEnd("ide");
  3152. messageSends: ["initialize"]
  3153. }),
  3154. $globals.Dictionary);
  3155. $core.addMethod(
  3156. $core.method({
  3157. selector: "keys",
  3158. protocol: 'accessing',
  3159. fn: function (){
  3160. var self=this;
  3161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3162. return $core.withContext(function($ctx1) {
  3163. //>>excludeEnd("ctx");
  3164. return $recv(self["@keys"])._copy();
  3165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3166. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3167. //>>excludeEnd("ctx");
  3168. },
  3169. //>>excludeStart("ide", pragmas.excludeIdeData);
  3170. args: [],
  3171. source: "keys\x0a\x09^ keys copy",
  3172. referencedClasses: [],
  3173. //>>excludeEnd("ide");
  3174. messageSends: ["copy"]
  3175. }),
  3176. $globals.Dictionary);
  3177. $core.addMethod(
  3178. $core.method({
  3179. selector: "keysAndValuesDo:",
  3180. protocol: 'enumerating',
  3181. fn: function (aBlock){
  3182. var self=this;
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. return $core.withContext(function($ctx1) {
  3185. //>>excludeEnd("ctx");
  3186. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3189. //>>excludeEnd("ctx");
  3190. },
  3191. //>>excludeStart("ide", pragmas.excludeIdeData);
  3192. args: ["aBlock"],
  3193. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3194. referencedClasses: [],
  3195. //>>excludeEnd("ide");
  3196. messageSends: ["with:do:"]
  3197. }),
  3198. $globals.Dictionary);
  3199. $core.addMethod(
  3200. $core.method({
  3201. selector: "keysDo:",
  3202. protocol: 'enumerating',
  3203. fn: function (aBlock){
  3204. var self=this;
  3205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3206. return $core.withContext(function($ctx1) {
  3207. //>>excludeEnd("ctx");
  3208. return $recv(self["@keys"])._do_(aBlock);
  3209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3210. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3211. //>>excludeEnd("ctx");
  3212. },
  3213. //>>excludeStart("ide", pragmas.excludeIdeData);
  3214. args: ["aBlock"],
  3215. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3216. referencedClasses: [],
  3217. //>>excludeEnd("ide");
  3218. messageSends: ["do:"]
  3219. }),
  3220. $globals.Dictionary);
  3221. $core.addMethod(
  3222. $core.method({
  3223. selector: "positionOfKey:",
  3224. protocol: 'private',
  3225. fn: function (anObject){
  3226. var self=this;
  3227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3228. return $core.withContext(function($ctx1) {
  3229. //>>excludeEnd("ctx");
  3230. var keys = self['@keys'];
  3231. for(var i=0;i<keys.length;i++){
  3232. if(keys[i].__eq(anObject)) { return i;}
  3233. }
  3234. return -1;
  3235. ;
  3236. return self;
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3239. //>>excludeEnd("ctx");
  3240. },
  3241. //>>excludeStart("ide", pragmas.excludeIdeData);
  3242. args: ["anObject"],
  3243. 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>",
  3244. referencedClasses: [],
  3245. //>>excludeEnd("ide");
  3246. messageSends: []
  3247. }),
  3248. $globals.Dictionary);
  3249. $core.addMethod(
  3250. $core.method({
  3251. selector: "removeAll",
  3252. protocol: 'adding/removing',
  3253. fn: function (){
  3254. var self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return $core.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. $recv(self["@keys"])._removeAll();
  3259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3260. $ctx1.sendIdx["removeAll"]=1;
  3261. //>>excludeEnd("ctx");
  3262. $recv(self["@values"])._removeAll();
  3263. return self;
  3264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3265. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3266. //>>excludeEnd("ctx");
  3267. },
  3268. //>>excludeStart("ide", pragmas.excludeIdeData);
  3269. args: [],
  3270. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3271. referencedClasses: [],
  3272. //>>excludeEnd("ide");
  3273. messageSends: ["removeAll"]
  3274. }),
  3275. $globals.Dictionary);
  3276. $core.addMethod(
  3277. $core.method({
  3278. selector: "removeKey:ifAbsent:",
  3279. protocol: 'adding/removing',
  3280. fn: function (aKey,aBlock){
  3281. var self=this;
  3282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3283. return $core.withContext(function($ctx1) {
  3284. //>>excludeEnd("ctx");
  3285. var index = self._positionOfKey_(aKey);
  3286. if(index === -1) {
  3287. return aBlock._value()
  3288. } else {
  3289. var keys = self['@keys'], values = self['@values'];
  3290. var value = values[index], l = keys.length;
  3291. keys[index] = keys[l-1];
  3292. keys.pop();
  3293. values[index] = values[l-1];
  3294. values.pop();
  3295. return value;
  3296. }
  3297. ;
  3298. return self;
  3299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3300. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3301. //>>excludeEnd("ctx");
  3302. },
  3303. //>>excludeStart("ide", pragmas.excludeIdeData);
  3304. args: ["aKey", "aBlock"],
  3305. 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>",
  3306. referencedClasses: [],
  3307. //>>excludeEnd("ide");
  3308. messageSends: []
  3309. }),
  3310. $globals.Dictionary);
  3311. $core.addMethod(
  3312. $core.method({
  3313. selector: "values",
  3314. protocol: 'accessing',
  3315. fn: function (){
  3316. var self=this;
  3317. return self["@values"];
  3318. },
  3319. //>>excludeStart("ide", pragmas.excludeIdeData);
  3320. args: [],
  3321. source: "values\x0a\x09^ values",
  3322. referencedClasses: [],
  3323. //>>excludeEnd("ide");
  3324. messageSends: []
  3325. }),
  3326. $globals.Dictionary);
  3327. $core.addMethod(
  3328. $core.method({
  3329. selector: "valuesDo:",
  3330. protocol: 'enumerating',
  3331. fn: function (aBlock){
  3332. var self=this;
  3333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3334. return $core.withContext(function($ctx1) {
  3335. //>>excludeEnd("ctx");
  3336. return $recv(self["@values"])._do_(aBlock);
  3337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3338. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3339. //>>excludeEnd("ctx");
  3340. },
  3341. //>>excludeStart("ide", pragmas.excludeIdeData);
  3342. args: ["aBlock"],
  3343. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3344. referencedClasses: [],
  3345. //>>excludeEnd("ide");
  3346. messageSends: ["do:"]
  3347. }),
  3348. $globals.Dictionary);
  3349. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  3350. //>>excludeStart("ide", pragmas.excludeIdeData);
  3351. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3352. //>>excludeEnd("ide");
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "at:ifAbsent:",
  3356. protocol: 'accessing',
  3357. fn: function (aKey,aBlock){
  3358. var self=this;
  3359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3360. return $core.withContext(function($ctx1) {
  3361. //>>excludeEnd("ctx");
  3362. var $1;
  3363. $1=self._includesKey_(aKey);
  3364. if($core.assert($1)){
  3365. return self._basicAt_(aKey);
  3366. } else {
  3367. return $recv(aBlock)._value();
  3368. };
  3369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3370. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3371. //>>excludeEnd("ctx");
  3372. },
  3373. //>>excludeStart("ide", pragmas.excludeIdeData);
  3374. args: ["aKey", "aBlock"],
  3375. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3376. referencedClasses: [],
  3377. //>>excludeEnd("ide");
  3378. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3379. }),
  3380. $globals.HashedCollection);
  3381. $core.addMethod(
  3382. $core.method({
  3383. selector: "at:put:",
  3384. protocol: 'accessing',
  3385. fn: function (aKey,aValue){
  3386. var self=this;
  3387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3388. return $core.withContext(function($ctx1) {
  3389. //>>excludeEnd("ctx");
  3390. return self._basicAt_put_(aKey,aValue);
  3391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3392. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3393. //>>excludeEnd("ctx");
  3394. },
  3395. //>>excludeStart("ide", pragmas.excludeIdeData);
  3396. args: ["aKey", "aValue"],
  3397. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3398. referencedClasses: [],
  3399. //>>excludeEnd("ide");
  3400. messageSends: ["basicAt:put:"]
  3401. }),
  3402. $globals.HashedCollection);
  3403. $core.addMethod(
  3404. $core.method({
  3405. selector: "includesKey:",
  3406. protocol: 'testing',
  3407. fn: function (aKey){
  3408. var self=this;
  3409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3410. return $core.withContext(function($ctx1) {
  3411. //>>excludeEnd("ctx");
  3412. return self.hasOwnProperty(aKey);
  3413. return self;
  3414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3415. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3416. //>>excludeEnd("ctx");
  3417. },
  3418. //>>excludeStart("ide", pragmas.excludeIdeData);
  3419. args: ["aKey"],
  3420. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  3421. referencedClasses: [],
  3422. //>>excludeEnd("ide");
  3423. messageSends: []
  3424. }),
  3425. $globals.HashedCollection);
  3426. $core.addMethod(
  3427. $core.method({
  3428. selector: "keys",
  3429. protocol: 'accessing',
  3430. fn: function (){
  3431. var self=this;
  3432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3433. return $core.withContext(function($ctx1) {
  3434. //>>excludeEnd("ctx");
  3435. return Object.keys(self);
  3436. return self;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3439. //>>excludeEnd("ctx");
  3440. },
  3441. //>>excludeStart("ide", pragmas.excludeIdeData);
  3442. args: [],
  3443. source: "keys\x0a\x09<return Object.keys(self)>",
  3444. referencedClasses: [],
  3445. //>>excludeEnd("ide");
  3446. messageSends: []
  3447. }),
  3448. $globals.HashedCollection);
  3449. $core.addMethod(
  3450. $core.method({
  3451. selector: "keysDo:",
  3452. protocol: 'enumerating',
  3453. fn: function (aBlock){
  3454. var self=this;
  3455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3456. return $core.withContext(function($ctx1) {
  3457. //>>excludeEnd("ctx");
  3458. $recv(self._keys())._do_(aBlock);
  3459. return self;
  3460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3461. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3462. //>>excludeEnd("ctx");
  3463. },
  3464. //>>excludeStart("ide", pragmas.excludeIdeData);
  3465. args: ["aBlock"],
  3466. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3467. referencedClasses: [],
  3468. //>>excludeEnd("ide");
  3469. messageSends: ["do:", "keys"]
  3470. }),
  3471. $globals.HashedCollection);
  3472. $core.addMethod(
  3473. $core.method({
  3474. selector: "removeKey:ifAbsent:",
  3475. protocol: 'adding/removing',
  3476. fn: function (aKey,aBlock){
  3477. var self=this;
  3478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3479. return $core.withContext(function($ctx1) {
  3480. //>>excludeEnd("ctx");
  3481. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3483. return $core.withContext(function($ctx2) {
  3484. //>>excludeEnd("ctx");
  3485. self._basicDelete_(aKey);
  3486. return removed;
  3487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3488. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3489. //>>excludeEnd("ctx");
  3490. }),(function(){
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return $core.withContext(function($ctx2) {
  3493. //>>excludeEnd("ctx");
  3494. return $recv(aBlock)._value();
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3497. //>>excludeEnd("ctx");
  3498. }));
  3499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3500. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3501. //>>excludeEnd("ctx");
  3502. },
  3503. //>>excludeStart("ide", pragmas.excludeIdeData);
  3504. args: ["aKey", "aBlock"],
  3505. 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 ]",
  3506. referencedClasses: [],
  3507. //>>excludeEnd("ide");
  3508. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3509. }),
  3510. $globals.HashedCollection);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: "values",
  3514. protocol: 'accessing',
  3515. fn: function (){
  3516. var self=this;
  3517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3518. return $core.withContext(function($ctx1) {
  3519. //>>excludeEnd("ctx");
  3520. return self._keys().map(function(key){
  3521. return self._at_(key);
  3522. });
  3523. ;
  3524. return self;
  3525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3526. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3527. //>>excludeEnd("ctx");
  3528. },
  3529. //>>excludeStart("ide", pragmas.excludeIdeData);
  3530. args: [],
  3531. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  3532. referencedClasses: [],
  3533. //>>excludeEnd("ide");
  3534. messageSends: []
  3535. }),
  3536. $globals.HashedCollection);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "valuesDo:",
  3540. protocol: 'enumerating',
  3541. fn: function (aBlock){
  3542. var self=this;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. return $core.withContext(function($ctx1) {
  3545. //>>excludeEnd("ctx");
  3546. $recv(self._values())._do_(aBlock);
  3547. return self;
  3548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3549. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3550. //>>excludeEnd("ctx");
  3551. },
  3552. //>>excludeStart("ide", pragmas.excludeIdeData);
  3553. args: ["aBlock"],
  3554. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3555. referencedClasses: [],
  3556. //>>excludeEnd("ide");
  3557. messageSends: ["do:", "values"]
  3558. }),
  3559. $globals.HashedCollection);
  3560. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  3561. //>>excludeStart("ide", pragmas.excludeIdeData);
  3562. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3563. //>>excludeEnd("ide");
  3564. $core.addMethod(
  3565. $core.method({
  3566. selector: "=",
  3567. protocol: 'comparing',
  3568. fn: function (aCollection){
  3569. var self=this;
  3570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3571. return $core.withContext(function($ctx1) {
  3572. //>>excludeEnd("ctx");
  3573. var $3,$2,$4,$1,$5;
  3574. var $early={};
  3575. try {
  3576. $3=self._class();
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. $ctx1.sendIdx["class"]=1;
  3579. //>>excludeEnd("ctx");
  3580. $2=$recv($3).__eq($recv(aCollection)._class());
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. $ctx1.sendIdx["="]=1;
  3583. //>>excludeEnd("ctx");
  3584. $1=$recv($2)._and_((function(){
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. return $core.withContext(function($ctx2) {
  3587. //>>excludeEnd("ctx");
  3588. $4=self._size();
  3589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3590. $ctx2.sendIdx["size"]=1;
  3591. //>>excludeEnd("ctx");
  3592. return $recv($4).__eq($recv(aCollection)._size());
  3593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3594. $ctx2.sendIdx["="]=2;
  3595. //>>excludeEnd("ctx");
  3596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3598. //>>excludeEnd("ctx");
  3599. }));
  3600. if(!$core.assert($1)){
  3601. return false;
  3602. };
  3603. self._withIndexDo_((function(each,i){
  3604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3605. return $core.withContext(function($ctx2) {
  3606. //>>excludeEnd("ctx");
  3607. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3608. if(!$core.assert($5)){
  3609. throw $early=[false];
  3610. };
  3611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3612. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3613. //>>excludeEnd("ctx");
  3614. }));
  3615. return true;
  3616. }
  3617. catch(e) {if(e===$early)return e[0]; throw e}
  3618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3619. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3620. //>>excludeEnd("ctx");
  3621. },
  3622. //>>excludeStart("ide", pragmas.excludeIdeData);
  3623. args: ["aCollection"],
  3624. 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",
  3625. referencedClasses: [],
  3626. //>>excludeEnd("ide");
  3627. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3628. }),
  3629. $globals.SequenceableCollection);
  3630. $core.addMethod(
  3631. $core.method({
  3632. selector: "addLast:",
  3633. protocol: 'adding/removing',
  3634. fn: function (anObject){
  3635. var self=this;
  3636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3637. return $core.withContext(function($ctx1) {
  3638. //>>excludeEnd("ctx");
  3639. self._add_(anObject);
  3640. return self;
  3641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3642. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3643. //>>excludeEnd("ctx");
  3644. },
  3645. //>>excludeStart("ide", pragmas.excludeIdeData);
  3646. args: ["anObject"],
  3647. source: "addLast: anObject\x0a\x09self add: anObject",
  3648. referencedClasses: [],
  3649. //>>excludeEnd("ide");
  3650. messageSends: ["add:"]
  3651. }),
  3652. $globals.SequenceableCollection);
  3653. $core.addMethod(
  3654. $core.method({
  3655. selector: "allButFirst",
  3656. protocol: 'accessing',
  3657. fn: function (){
  3658. var self=this;
  3659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3660. return $core.withContext(function($ctx1) {
  3661. //>>excludeEnd("ctx");
  3662. return self._copyFrom_to_((2),self._size());
  3663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3664. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3665. //>>excludeEnd("ctx");
  3666. },
  3667. //>>excludeStart("ide", pragmas.excludeIdeData);
  3668. args: [],
  3669. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3670. referencedClasses: [],
  3671. //>>excludeEnd("ide");
  3672. messageSends: ["copyFrom:to:", "size"]
  3673. }),
  3674. $globals.SequenceableCollection);
  3675. $core.addMethod(
  3676. $core.method({
  3677. selector: "allButLast",
  3678. protocol: 'accessing',
  3679. fn: function (){
  3680. var self=this;
  3681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3682. return $core.withContext(function($ctx1) {
  3683. //>>excludeEnd("ctx");
  3684. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  3685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3686. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3687. //>>excludeEnd("ctx");
  3688. },
  3689. //>>excludeStart("ide", pragmas.excludeIdeData);
  3690. args: [],
  3691. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3692. referencedClasses: [],
  3693. //>>excludeEnd("ide");
  3694. messageSends: ["copyFrom:to:", "-", "size"]
  3695. }),
  3696. $globals.SequenceableCollection);
  3697. $core.addMethod(
  3698. $core.method({
  3699. selector: "atRandom",
  3700. protocol: 'accessing',
  3701. fn: function (){
  3702. var self=this;
  3703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3704. return $core.withContext(function($ctx1) {
  3705. //>>excludeEnd("ctx");
  3706. return self._at_($recv(self._size())._atRandom());
  3707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3708. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3709. //>>excludeEnd("ctx");
  3710. },
  3711. //>>excludeStart("ide", pragmas.excludeIdeData);
  3712. args: [],
  3713. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3714. referencedClasses: [],
  3715. //>>excludeEnd("ide");
  3716. messageSends: ["at:", "atRandom", "size"]
  3717. }),
  3718. $globals.SequenceableCollection);
  3719. $core.addMethod(
  3720. $core.method({
  3721. selector: "beginsWith:",
  3722. protocol: 'testing',
  3723. fn: function (prefix){
  3724. var self=this;
  3725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3726. return $core.withContext(function($ctx1) {
  3727. //>>excludeEnd("ctx");
  3728. var $2,$3,$1;
  3729. $2=self._size();
  3730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3731. $ctx1.sendIdx["size"]=1;
  3732. //>>excludeEnd("ctx");
  3733. $3=$recv(prefix)._size();
  3734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3735. $ctx1.sendIdx["size"]=2;
  3736. //>>excludeEnd("ctx");
  3737. $1=$recv($2).__lt($3);
  3738. if($core.assert($1)){
  3739. return false;
  3740. };
  3741. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3744. //>>excludeEnd("ctx");
  3745. },
  3746. //>>excludeStart("ide", pragmas.excludeIdeData);
  3747. args: ["prefix"],
  3748. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3749. referencedClasses: [],
  3750. //>>excludeEnd("ide");
  3751. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3752. }),
  3753. $globals.SequenceableCollection);
  3754. $core.addMethod(
  3755. $core.method({
  3756. selector: "copyFrom:to:",
  3757. protocol: 'copying',
  3758. fn: function (anIndex,anotherIndex){
  3759. var self=this;
  3760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3761. return $core.withContext(function($ctx1) {
  3762. //>>excludeEnd("ctx");
  3763. self._subclassResponsibility();
  3764. return self;
  3765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3766. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3767. //>>excludeEnd("ctx");
  3768. },
  3769. //>>excludeStart("ide", pragmas.excludeIdeData);
  3770. args: ["anIndex", "anotherIndex"],
  3771. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3772. referencedClasses: [],
  3773. //>>excludeEnd("ide");
  3774. messageSends: ["subclassResponsibility"]
  3775. }),
  3776. $globals.SequenceableCollection);
  3777. $core.addMethod(
  3778. $core.method({
  3779. selector: "detect:ifNone:",
  3780. protocol: 'enumerating',
  3781. fn: function (aBlock,anotherBlock){
  3782. var self=this;
  3783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3784. return $core.withContext(function($ctx1) {
  3785. //>>excludeEnd("ctx");
  3786. self = self._numericallyIndexable();
  3787. for(var i = 0; i < self.length; i++)
  3788. if(aBlock._value_(self[i]))
  3789. return self[i];
  3790. return anotherBlock._value();
  3791. ;
  3792. return self;
  3793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3794. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3795. //>>excludeEnd("ctx");
  3796. },
  3797. //>>excludeStart("ide", pragmas.excludeIdeData);
  3798. args: ["aBlock", "anotherBlock"],
  3799. 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>",
  3800. referencedClasses: [],
  3801. //>>excludeEnd("ide");
  3802. messageSends: []
  3803. }),
  3804. $globals.SequenceableCollection);
  3805. $core.addMethod(
  3806. $core.method({
  3807. selector: "do:",
  3808. protocol: 'enumerating',
  3809. fn: function (aBlock){
  3810. var self=this;
  3811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3812. return $core.withContext(function($ctx1) {
  3813. //>>excludeEnd("ctx");
  3814. self = self._numericallyIndexable();
  3815. for(var i=0; i < self.length; i++) {
  3816. aBlock._value_(self[i]);
  3817. }
  3818. ;
  3819. return self;
  3820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3821. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3822. //>>excludeEnd("ctx");
  3823. },
  3824. //>>excludeStart("ide", pragmas.excludeIdeData);
  3825. args: ["aBlock"],
  3826. 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>",
  3827. referencedClasses: [],
  3828. //>>excludeEnd("ide");
  3829. messageSends: []
  3830. }),
  3831. $globals.SequenceableCollection);
  3832. $core.addMethod(
  3833. $core.method({
  3834. selector: "endsWith:",
  3835. protocol: 'testing',
  3836. fn: function (suffix){
  3837. var self=this;
  3838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3839. return $core.withContext(function($ctx1) {
  3840. //>>excludeEnd("ctx");
  3841. var $2,$3,$1;
  3842. $2=self._size();
  3843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3844. $ctx1.sendIdx["size"]=1;
  3845. //>>excludeEnd("ctx");
  3846. $3=$recv(suffix)._size();
  3847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3848. $ctx1.sendIdx["size"]=2;
  3849. //>>excludeEnd("ctx");
  3850. $1=$recv($2).__lt($3);
  3851. if($core.assert($1)){
  3852. return false;
  3853. };
  3854. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  3855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3856. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3857. //>>excludeEnd("ctx");
  3858. },
  3859. //>>excludeStart("ide", pragmas.excludeIdeData);
  3860. args: ["suffix"],
  3861. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3862. referencedClasses: [],
  3863. //>>excludeEnd("ide");
  3864. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3865. }),
  3866. $globals.SequenceableCollection);
  3867. $core.addMethod(
  3868. $core.method({
  3869. selector: "first",
  3870. protocol: 'accessing',
  3871. fn: function (){
  3872. var self=this;
  3873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3874. return $core.withContext(function($ctx1) {
  3875. //>>excludeEnd("ctx");
  3876. return self._at_((1));
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3879. //>>excludeEnd("ctx");
  3880. },
  3881. //>>excludeStart("ide", pragmas.excludeIdeData);
  3882. args: [],
  3883. source: "first\x0a\x09^ self at: 1",
  3884. referencedClasses: [],
  3885. //>>excludeEnd("ide");
  3886. messageSends: ["at:"]
  3887. }),
  3888. $globals.SequenceableCollection);
  3889. $core.addMethod(
  3890. $core.method({
  3891. selector: "first:",
  3892. protocol: 'accessing',
  3893. fn: function (aNumber){
  3894. var self=this;
  3895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3896. return $core.withContext(function($ctx1) {
  3897. //>>excludeEnd("ctx");
  3898. var $1;
  3899. $1=$recv(self._size()).__lt(aNumber);
  3900. if($core.assert($1)){
  3901. self._error_("Invalid number of elements");
  3902. };
  3903. return self._copyFrom_to_((1),aNumber);
  3904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3905. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3906. //>>excludeEnd("ctx");
  3907. },
  3908. //>>excludeStart("ide", pragmas.excludeIdeData);
  3909. args: ["aNumber"],
  3910. 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",
  3911. referencedClasses: [],
  3912. //>>excludeEnd("ide");
  3913. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3914. }),
  3915. $globals.SequenceableCollection);
  3916. $core.addMethod(
  3917. $core.method({
  3918. selector: "fourth",
  3919. protocol: 'accessing',
  3920. fn: function (){
  3921. var self=this;
  3922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3923. return $core.withContext(function($ctx1) {
  3924. //>>excludeEnd("ctx");
  3925. return self._at_((4));
  3926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3927. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3928. //>>excludeEnd("ctx");
  3929. },
  3930. //>>excludeStart("ide", pragmas.excludeIdeData);
  3931. args: [],
  3932. source: "fourth\x0a\x09^ self at: 4",
  3933. referencedClasses: [],
  3934. //>>excludeEnd("ide");
  3935. messageSends: ["at:"]
  3936. }),
  3937. $globals.SequenceableCollection);
  3938. $core.addMethod(
  3939. $core.method({
  3940. selector: "includes:",
  3941. protocol: 'testing',
  3942. fn: function (anObject){
  3943. var self=this;
  3944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3945. return $core.withContext(function($ctx1) {
  3946. //>>excludeEnd("ctx");
  3947. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  3948. return nil;
  3949. })))._notNil();
  3950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3951. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  3952. //>>excludeEnd("ctx");
  3953. },
  3954. //>>excludeStart("ide", pragmas.excludeIdeData);
  3955. args: ["anObject"],
  3956. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3957. referencedClasses: [],
  3958. //>>excludeEnd("ide");
  3959. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3960. }),
  3961. $globals.SequenceableCollection);
  3962. $core.addMethod(
  3963. $core.method({
  3964. selector: "indexOf:ifAbsent:",
  3965. protocol: 'accessing',
  3966. fn: function (anObject,aBlock){
  3967. var self=this;
  3968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3969. return $core.withContext(function($ctx1) {
  3970. //>>excludeEnd("ctx");
  3971. self = self._numericallyIndexable();
  3972. for(var i=0; i < self.length; i++) {
  3973. if($recv(self[i]).__eq(anObject)) {return i+1}
  3974. };
  3975. return aBlock._value();
  3976. ;
  3977. return self;
  3978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3979. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  3980. //>>excludeEnd("ctx");
  3981. },
  3982. //>>excludeStart("ide", pragmas.excludeIdeData);
  3983. args: ["anObject", "aBlock"],
  3984. 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($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  3985. referencedClasses: [],
  3986. //>>excludeEnd("ide");
  3987. messageSends: []
  3988. }),
  3989. $globals.SequenceableCollection);
  3990. $core.addMethod(
  3991. $core.method({
  3992. selector: "indexOf:startingAt:",
  3993. protocol: 'accessing',
  3994. fn: function (anObject,start){
  3995. var self=this;
  3996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3997. return $core.withContext(function($ctx1) {
  3998. //>>excludeEnd("ctx");
  3999. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4000. return (0);
  4001. }));
  4002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4003. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4004. //>>excludeEnd("ctx");
  4005. },
  4006. //>>excludeStart("ide", pragmas.excludeIdeData);
  4007. args: ["anObject", "start"],
  4008. 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 ]",
  4009. referencedClasses: [],
  4010. //>>excludeEnd("ide");
  4011. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4012. }),
  4013. $globals.SequenceableCollection);
  4014. $core.addMethod(
  4015. $core.method({
  4016. selector: "indexOf:startingAt:ifAbsent:",
  4017. protocol: 'accessing',
  4018. fn: function (anObject,start,aBlock){
  4019. var self=this;
  4020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4021. return $core.withContext(function($ctx1) {
  4022. //>>excludeEnd("ctx");
  4023. self = self._numericallyIndexable();
  4024. for(var i=start - 1; i < self.length; i++){
  4025. if($recv(self[i]).__eq(anObject)) {return i+1}
  4026. }
  4027. return aBlock._value();
  4028. ;
  4029. return self;
  4030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4031. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4032. //>>excludeEnd("ctx");
  4033. },
  4034. //>>excludeStart("ide", pragmas.excludeIdeData);
  4035. args: ["anObject", "start", "aBlock"],
  4036. 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($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  4037. referencedClasses: [],
  4038. //>>excludeEnd("ide");
  4039. messageSends: []
  4040. }),
  4041. $globals.SequenceableCollection);
  4042. $core.addMethod(
  4043. $core.method({
  4044. selector: "last",
  4045. protocol: 'accessing',
  4046. fn: function (){
  4047. var self=this;
  4048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4049. return $core.withContext(function($ctx1) {
  4050. //>>excludeEnd("ctx");
  4051. return self._at_(self._size());
  4052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4053. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4054. //>>excludeEnd("ctx");
  4055. },
  4056. //>>excludeStart("ide", pragmas.excludeIdeData);
  4057. args: [],
  4058. source: "last\x0a\x09^ self at: self size",
  4059. referencedClasses: [],
  4060. //>>excludeEnd("ide");
  4061. messageSends: ["at:", "size"]
  4062. }),
  4063. $globals.SequenceableCollection);
  4064. $core.addMethod(
  4065. $core.method({
  4066. selector: "last:",
  4067. protocol: 'accessing',
  4068. fn: function (aNumber){
  4069. var self=this;
  4070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4071. return $core.withContext(function($ctx1) {
  4072. //>>excludeEnd("ctx");
  4073. var $2,$1,$5,$4,$3;
  4074. $2=self._size();
  4075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4076. $ctx1.sendIdx["size"]=1;
  4077. //>>excludeEnd("ctx");
  4078. $1=$recv($2).__lt(aNumber);
  4079. if($core.assert($1)){
  4080. self._error_("Invalid number of elements");
  4081. };
  4082. $5=self._size();
  4083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4084. $ctx1.sendIdx["size"]=2;
  4085. //>>excludeEnd("ctx");
  4086. $4=$recv($5).__minus(aNumber);
  4087. $3=$recv($4).__plus((1));
  4088. return self._copyFrom_to_($3,self._size());
  4089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4090. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4091. //>>excludeEnd("ctx");
  4092. },
  4093. //>>excludeStart("ide", pragmas.excludeIdeData);
  4094. args: ["aNumber"],
  4095. 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",
  4096. referencedClasses: [],
  4097. //>>excludeEnd("ide");
  4098. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4099. }),
  4100. $globals.SequenceableCollection);
  4101. $core.addMethod(
  4102. $core.method({
  4103. selector: "newStream",
  4104. protocol: 'streaming',
  4105. fn: function (){
  4106. var self=this;
  4107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4108. return $core.withContext(function($ctx1) {
  4109. //>>excludeEnd("ctx");
  4110. return $recv(self._streamClass())._on_(self);
  4111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4112. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4113. //>>excludeEnd("ctx");
  4114. },
  4115. //>>excludeStart("ide", pragmas.excludeIdeData);
  4116. args: [],
  4117. source: "newStream\x0a\x09^ self streamClass on: self",
  4118. referencedClasses: [],
  4119. //>>excludeEnd("ide");
  4120. messageSends: ["on:", "streamClass"]
  4121. }),
  4122. $globals.SequenceableCollection);
  4123. $core.addMethod(
  4124. $core.method({
  4125. selector: "numericallyIndexable",
  4126. protocol: 'private',
  4127. fn: function (){
  4128. var self=this;
  4129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4130. return $core.withContext(function($ctx1) {
  4131. //>>excludeEnd("ctx");
  4132. self._subclassResponsibility();
  4133. return self;
  4134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4135. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4136. //>>excludeEnd("ctx");
  4137. },
  4138. //>>excludeStart("ide", pragmas.excludeIdeData);
  4139. args: [],
  4140. 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",
  4141. referencedClasses: [],
  4142. //>>excludeEnd("ide");
  4143. messageSends: ["subclassResponsibility"]
  4144. }),
  4145. $globals.SequenceableCollection);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: "readStream",
  4149. protocol: 'streaming',
  4150. fn: function (){
  4151. var self=this;
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. return $core.withContext(function($ctx1) {
  4154. //>>excludeEnd("ctx");
  4155. return self._stream();
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4158. //>>excludeEnd("ctx");
  4159. },
  4160. //>>excludeStart("ide", pragmas.excludeIdeData);
  4161. args: [],
  4162. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4163. referencedClasses: [],
  4164. //>>excludeEnd("ide");
  4165. messageSends: ["stream"]
  4166. }),
  4167. $globals.SequenceableCollection);
  4168. $core.addMethod(
  4169. $core.method({
  4170. selector: "removeLast",
  4171. protocol: 'adding/removing',
  4172. fn: function (){
  4173. var self=this;
  4174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4175. return $core.withContext(function($ctx1) {
  4176. //>>excludeEnd("ctx");
  4177. return self._remove_(self._last());
  4178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4179. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4180. //>>excludeEnd("ctx");
  4181. },
  4182. //>>excludeStart("ide", pragmas.excludeIdeData);
  4183. args: [],
  4184. source: "removeLast\x0a\x09^ self remove: self last",
  4185. referencedClasses: [],
  4186. //>>excludeEnd("ide");
  4187. messageSends: ["remove:", "last"]
  4188. }),
  4189. $globals.SequenceableCollection);
  4190. $core.addMethod(
  4191. $core.method({
  4192. selector: "reversed",
  4193. protocol: 'converting',
  4194. fn: function (){
  4195. var self=this;
  4196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4197. return $core.withContext(function($ctx1) {
  4198. //>>excludeEnd("ctx");
  4199. self._subclassResponsibility();
  4200. return self;
  4201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4202. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4203. //>>excludeEnd("ctx");
  4204. },
  4205. //>>excludeStart("ide", pragmas.excludeIdeData);
  4206. args: [],
  4207. source: "reversed\x0a\x09self subclassResponsibility",
  4208. referencedClasses: [],
  4209. //>>excludeEnd("ide");
  4210. messageSends: ["subclassResponsibility"]
  4211. }),
  4212. $globals.SequenceableCollection);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "second",
  4216. protocol: 'accessing',
  4217. fn: function (){
  4218. var self=this;
  4219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4220. return $core.withContext(function($ctx1) {
  4221. //>>excludeEnd("ctx");
  4222. return self._at_((2));
  4223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4224. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4225. //>>excludeEnd("ctx");
  4226. },
  4227. //>>excludeStart("ide", pragmas.excludeIdeData);
  4228. args: [],
  4229. source: "second\x0a\x09^ self at: 2",
  4230. referencedClasses: [],
  4231. //>>excludeEnd("ide");
  4232. messageSends: ["at:"]
  4233. }),
  4234. $globals.SequenceableCollection);
  4235. $core.addMethod(
  4236. $core.method({
  4237. selector: "stream",
  4238. protocol: 'streaming',
  4239. fn: function (){
  4240. var self=this;
  4241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4242. return $core.withContext(function($ctx1) {
  4243. //>>excludeEnd("ctx");
  4244. return self._newStream();
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4247. //>>excludeEnd("ctx");
  4248. },
  4249. //>>excludeStart("ide", pragmas.excludeIdeData);
  4250. args: [],
  4251. source: "stream\x0a\x09^ self newStream",
  4252. referencedClasses: [],
  4253. //>>excludeEnd("ide");
  4254. messageSends: ["newStream"]
  4255. }),
  4256. $globals.SequenceableCollection);
  4257. $core.addMethod(
  4258. $core.method({
  4259. selector: "streamClass",
  4260. protocol: 'streaming',
  4261. fn: function (){
  4262. var self=this;
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. return $core.withContext(function($ctx1) {
  4265. //>>excludeEnd("ctx");
  4266. return $recv(self._class())._streamClass();
  4267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4268. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4269. //>>excludeEnd("ctx");
  4270. },
  4271. //>>excludeStart("ide", pragmas.excludeIdeData);
  4272. args: [],
  4273. source: "streamClass\x0a\x09^ self class streamClass",
  4274. referencedClasses: [],
  4275. //>>excludeEnd("ide");
  4276. messageSends: ["streamClass", "class"]
  4277. }),
  4278. $globals.SequenceableCollection);
  4279. $core.addMethod(
  4280. $core.method({
  4281. selector: "third",
  4282. protocol: 'accessing',
  4283. fn: function (){
  4284. var self=this;
  4285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4286. return $core.withContext(function($ctx1) {
  4287. //>>excludeEnd("ctx");
  4288. return self._at_((3));
  4289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4290. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4291. //>>excludeEnd("ctx");
  4292. },
  4293. //>>excludeStart("ide", pragmas.excludeIdeData);
  4294. args: [],
  4295. source: "third\x0a\x09^ self at: 3",
  4296. referencedClasses: [],
  4297. //>>excludeEnd("ide");
  4298. messageSends: ["at:"]
  4299. }),
  4300. $globals.SequenceableCollection);
  4301. $core.addMethod(
  4302. $core.method({
  4303. selector: "with:do:",
  4304. protocol: 'enumerating',
  4305. fn: function (anotherCollection,aBlock){
  4306. var self=this;
  4307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4308. return $core.withContext(function($ctx1) {
  4309. //>>excludeEnd("ctx");
  4310. self = self._numericallyIndexable();
  4311. anotherCollection = anotherCollection._numericallyIndexable();
  4312. for(var i=0; i<self.length; i++) {
  4313. aBlock._value_value_(self[i], anotherCollection[i]);
  4314. }
  4315. ;
  4316. return self;
  4317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4318. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4319. //>>excludeEnd("ctx");
  4320. },
  4321. //>>excludeStart("ide", pragmas.excludeIdeData);
  4322. args: ["anotherCollection", "aBlock"],
  4323. 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>",
  4324. referencedClasses: [],
  4325. //>>excludeEnd("ide");
  4326. messageSends: []
  4327. }),
  4328. $globals.SequenceableCollection);
  4329. $core.addMethod(
  4330. $core.method({
  4331. selector: "withIndexDo:",
  4332. protocol: 'enumerating',
  4333. fn: function (aBlock){
  4334. var self=this;
  4335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4336. return $core.withContext(function($ctx1) {
  4337. //>>excludeEnd("ctx");
  4338. self = self._numericallyIndexable();
  4339. for(var i=0; i < self.length; i++) {
  4340. aBlock._value_value_(self[i], i+1);
  4341. }
  4342. ;
  4343. return self;
  4344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4345. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4346. //>>excludeEnd("ctx");
  4347. },
  4348. //>>excludeStart("ide", pragmas.excludeIdeData);
  4349. args: ["aBlock"],
  4350. 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>",
  4351. referencedClasses: [],
  4352. //>>excludeEnd("ide");
  4353. messageSends: []
  4354. }),
  4355. $globals.SequenceableCollection);
  4356. $core.addMethod(
  4357. $core.method({
  4358. selector: "writeStream",
  4359. protocol: 'streaming',
  4360. fn: function (){
  4361. var self=this;
  4362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4363. return $core.withContext(function($ctx1) {
  4364. //>>excludeEnd("ctx");
  4365. return self._stream();
  4366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4367. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4368. //>>excludeEnd("ctx");
  4369. },
  4370. //>>excludeStart("ide", pragmas.excludeIdeData);
  4371. args: [],
  4372. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4373. referencedClasses: [],
  4374. //>>excludeEnd("ide");
  4375. messageSends: ["stream"]
  4376. }),
  4377. $globals.SequenceableCollection);
  4378. $core.addMethod(
  4379. $core.method({
  4380. selector: "streamClass",
  4381. protocol: 'accessing',
  4382. fn: function (){
  4383. var self=this;
  4384. return $globals.Stream;
  4385. },
  4386. //>>excludeStart("ide", pragmas.excludeIdeData);
  4387. args: [],
  4388. source: "streamClass\x0a\x09\x09^ Stream",
  4389. referencedClasses: ["Stream"],
  4390. //>>excludeEnd("ide");
  4391. messageSends: []
  4392. }),
  4393. $globals.SequenceableCollection.klass);
  4394. $core.addMethod(
  4395. $core.method({
  4396. selector: "streamContents:",
  4397. protocol: 'streaming',
  4398. fn: function (aBlock){
  4399. var self=this;
  4400. var stream;
  4401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4402. return $core.withContext(function($ctx1) {
  4403. //>>excludeEnd("ctx");
  4404. stream=$recv(self._streamClass())._on_(self._new());
  4405. $recv(aBlock)._value_(stream);
  4406. return $recv(stream)._contents();
  4407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4408. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  4409. //>>excludeEnd("ctx");
  4410. },
  4411. //>>excludeStart("ide", pragmas.excludeIdeData);
  4412. args: ["aBlock"],
  4413. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4414. referencedClasses: [],
  4415. //>>excludeEnd("ide");
  4416. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4417. }),
  4418. $globals.SequenceableCollection.klass);
  4419. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  4420. //>>excludeStart("ide", pragmas.excludeIdeData);
  4421. $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`.";
  4422. //>>excludeEnd("ide");
  4423. $core.addMethod(
  4424. $core.method({
  4425. selector: "add:",
  4426. protocol: 'adding/removing',
  4427. fn: function (anObject){
  4428. var self=this;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. return $core.withContext(function($ctx1) {
  4431. //>>excludeEnd("ctx");
  4432. self.push(anObject); return anObject;;
  4433. return self;
  4434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4435. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4436. //>>excludeEnd("ctx");
  4437. },
  4438. //>>excludeStart("ide", pragmas.excludeIdeData);
  4439. args: ["anObject"],
  4440. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  4441. referencedClasses: [],
  4442. //>>excludeEnd("ide");
  4443. messageSends: []
  4444. }),
  4445. $globals.Array);
  4446. $core.addMethod(
  4447. $core.method({
  4448. selector: "addAll:",
  4449. protocol: 'adding/removing',
  4450. fn: function (aCollection){
  4451. var self=this;
  4452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4453. return $core.withContext(function($ctx1) {
  4454. //>>excludeEnd("ctx");
  4455. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4456. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  4457. return aCollection;;
  4458. return self;
  4459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4460. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4461. //>>excludeEnd("ctx");
  4462. },
  4463. //>>excludeStart("ide", pragmas.excludeIdeData);
  4464. args: ["aCollection"],
  4465. source: "addAll: aCollection\x0a<\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);\x0a\x09return aCollection;\x0a>",
  4466. referencedClasses: [],
  4467. //>>excludeEnd("ide");
  4468. messageSends: []
  4469. }),
  4470. $globals.Array);
  4471. $core.addMethod(
  4472. $core.method({
  4473. selector: "addFirst:",
  4474. protocol: 'adding/removing',
  4475. fn: function (anObject){
  4476. var self=this;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. return $core.withContext(function($ctx1) {
  4479. //>>excludeEnd("ctx");
  4480. self.unshift(anObject); return anObject;;
  4481. return self;
  4482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4483. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4484. //>>excludeEnd("ctx");
  4485. },
  4486. //>>excludeStart("ide", pragmas.excludeIdeData);
  4487. args: ["anObject"],
  4488. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  4489. referencedClasses: [],
  4490. //>>excludeEnd("ide");
  4491. messageSends: []
  4492. }),
  4493. $globals.Array);
  4494. $core.addMethod(
  4495. $core.method({
  4496. selector: "asJavascript",
  4497. protocol: 'converting',
  4498. fn: function (){
  4499. var self=this;
  4500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4501. return $core.withContext(function($ctx1) {
  4502. //>>excludeEnd("ctx");
  4503. var $1;
  4504. $1=$recv("[".__comma($recv(self._collect_((function(each){
  4505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4506. return $core.withContext(function($ctx2) {
  4507. //>>excludeEnd("ctx");
  4508. return $recv(each)._asJavascript();
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4511. //>>excludeEnd("ctx");
  4512. })))._join_(", "))).__comma("]");
  4513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4514. $ctx1.sendIdx[","]=1;
  4515. //>>excludeEnd("ctx");
  4516. return $1;
  4517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4518. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  4519. //>>excludeEnd("ctx");
  4520. },
  4521. //>>excludeStart("ide", pragmas.excludeIdeData);
  4522. args: [],
  4523. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  4524. referencedClasses: [],
  4525. //>>excludeEnd("ide");
  4526. messageSends: [",", "join:", "collect:", "asJavascript"]
  4527. }),
  4528. $globals.Array);
  4529. $core.addMethod(
  4530. $core.method({
  4531. selector: "at:ifAbsent:",
  4532. protocol: 'accessing',
  4533. fn: function (anIndex,aBlock){
  4534. var self=this;
  4535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4536. return $core.withContext(function($ctx1) {
  4537. //>>excludeEnd("ctx");
  4538. return anIndex >= 1 && anIndex <= self.length
  4539. ? self[anIndex - 1]
  4540. : aBlock._value()
  4541. ;
  4542. return self;
  4543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4544. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4545. //>>excludeEnd("ctx");
  4546. },
  4547. //>>excludeStart("ide", pragmas.excludeIdeData);
  4548. args: ["anIndex", "aBlock"],
  4549. 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>",
  4550. referencedClasses: [],
  4551. //>>excludeEnd("ide");
  4552. messageSends: []
  4553. }),
  4554. $globals.Array);
  4555. $core.addMethod(
  4556. $core.method({
  4557. selector: "at:ifPresent:ifAbsent:",
  4558. protocol: 'accessing',
  4559. fn: function (anIndex,aBlock,anotherBlock){
  4560. var self=this;
  4561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4562. return $core.withContext(function($ctx1) {
  4563. //>>excludeEnd("ctx");
  4564. return anIndex >= 1 && anIndex <= self.length
  4565. ? aBlock._value_(self[anIndex - 1])
  4566. : anotherBlock._value()
  4567. ;
  4568. return self;
  4569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4570. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4571. //>>excludeEnd("ctx");
  4572. },
  4573. //>>excludeStart("ide", pragmas.excludeIdeData);
  4574. args: ["anIndex", "aBlock", "anotherBlock"],
  4575. 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>",
  4576. referencedClasses: [],
  4577. //>>excludeEnd("ide");
  4578. messageSends: []
  4579. }),
  4580. $globals.Array);
  4581. $core.addMethod(
  4582. $core.method({
  4583. selector: "at:put:",
  4584. protocol: 'accessing',
  4585. fn: function (anIndex,anObject){
  4586. var self=this;
  4587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4588. return $core.withContext(function($ctx1) {
  4589. //>>excludeEnd("ctx");
  4590. return self[anIndex - 1] = anObject;
  4591. return self;
  4592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4593. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4594. //>>excludeEnd("ctx");
  4595. },
  4596. //>>excludeStart("ide", pragmas.excludeIdeData);
  4597. args: ["anIndex", "anObject"],
  4598. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  4599. referencedClasses: [],
  4600. //>>excludeEnd("ide");
  4601. messageSends: []
  4602. }),
  4603. $globals.Array);
  4604. $core.addMethod(
  4605. $core.method({
  4606. selector: "collect:",
  4607. protocol: 'enumerating',
  4608. fn: function (aBlock){
  4609. var self=this;
  4610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4611. return $core.withContext(function($ctx1) {
  4612. //>>excludeEnd("ctx");
  4613. return self.map(function(each) {return aBlock._value_(each)});
  4614. return self;
  4615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4616. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4617. //>>excludeEnd("ctx");
  4618. },
  4619. //>>excludeStart("ide", pragmas.excludeIdeData);
  4620. args: ["aBlock"],
  4621. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  4622. referencedClasses: [],
  4623. //>>excludeEnd("ide");
  4624. messageSends: []
  4625. }),
  4626. $globals.Array);
  4627. $core.addMethod(
  4628. $core.method({
  4629. selector: "copyFrom:to:",
  4630. protocol: 'copying',
  4631. fn: function (anIndex,anotherIndex){
  4632. var self=this;
  4633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4634. return $core.withContext(function($ctx1) {
  4635. //>>excludeEnd("ctx");
  4636. if (anIndex >= 1 && anotherIndex <= self.length) {
  4637. return self.slice(anIndex - 1, anotherIndex);
  4638. } else {
  4639. self._at_(anIndex);
  4640. self._at_(self.length + 1);
  4641. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4642. };
  4643. return self;
  4644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4645. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4646. //>>excludeEnd("ctx");
  4647. },
  4648. //>>excludeStart("ide", pragmas.excludeIdeData);
  4649. args: ["anIndex", "anotherIndex"],
  4650. source: "copyFrom: anIndex to: anotherIndex\x0a<\x0a\x09if (anIndex >>= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}\x0a>",
  4651. referencedClasses: [],
  4652. //>>excludeEnd("ide");
  4653. messageSends: []
  4654. }),
  4655. $globals.Array);
  4656. $core.addMethod(
  4657. $core.method({
  4658. selector: "join:",
  4659. protocol: 'enumerating',
  4660. fn: function (aString){
  4661. var self=this;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. return $core.withContext(function($ctx1) {
  4664. //>>excludeEnd("ctx");
  4665. return self.join(aString);
  4666. return self;
  4667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4668. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4669. //>>excludeEnd("ctx");
  4670. },
  4671. //>>excludeStart("ide", pragmas.excludeIdeData);
  4672. args: ["aString"],
  4673. source: "join: aString\x0a\x09<return self.join(aString)>",
  4674. referencedClasses: [],
  4675. //>>excludeEnd("ide");
  4676. messageSends: []
  4677. }),
  4678. $globals.Array);
  4679. $core.addMethod(
  4680. $core.method({
  4681. selector: "numericallyIndexable",
  4682. protocol: 'private',
  4683. fn: function (){
  4684. var self=this;
  4685. return self;
  4686. },
  4687. //>>excludeStart("ide", pragmas.excludeIdeData);
  4688. args: [],
  4689. source: "numericallyIndexable\x0a\x09^ self",
  4690. referencedClasses: [],
  4691. //>>excludeEnd("ide");
  4692. messageSends: []
  4693. }),
  4694. $globals.Array);
  4695. $core.addMethod(
  4696. $core.method({
  4697. selector: "printOn:",
  4698. protocol: 'printing',
  4699. fn: function (aStream){
  4700. var self=this;
  4701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4702. return $core.withContext(function($ctx1) {
  4703. //>>excludeEnd("ctx");
  4704. (
  4705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4706. $ctx1.supercall = true,
  4707. //>>excludeEnd("ctx");
  4708. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  4709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4710. $ctx1.supercall = false;
  4711. //>>excludeEnd("ctx");;
  4712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4713. $ctx1.sendIdx["printOn:"]=1;
  4714. //>>excludeEnd("ctx");
  4715. $recv(aStream)._nextPutAll_(" (");
  4716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4717. $ctx1.sendIdx["nextPutAll:"]=1;
  4718. //>>excludeEnd("ctx");
  4719. self._do_separatedBy_((function(each){
  4720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4721. return $core.withContext(function($ctx2) {
  4722. //>>excludeEnd("ctx");
  4723. return $recv(each)._printOn_(aStream);
  4724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4726. //>>excludeEnd("ctx");
  4727. }),(function(){
  4728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4729. return $core.withContext(function($ctx2) {
  4730. //>>excludeEnd("ctx");
  4731. return $recv(aStream)._nextPutAll_(" ");
  4732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4733. $ctx2.sendIdx["nextPutAll:"]=2;
  4734. //>>excludeEnd("ctx");
  4735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4736. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4737. //>>excludeEnd("ctx");
  4738. }));
  4739. $recv(aStream)._nextPutAll_(")");
  4740. return self;
  4741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4742. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4743. //>>excludeEnd("ctx");
  4744. },
  4745. //>>excludeStart("ide", pragmas.excludeIdeData);
  4746. args: ["aStream"],
  4747. 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: ')'",
  4748. referencedClasses: [],
  4749. //>>excludeEnd("ide");
  4750. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4751. }),
  4752. $globals.Array);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "remove:ifAbsent:",
  4756. protocol: 'adding/removing',
  4757. fn: function (anObject,aBlock){
  4758. var self=this;
  4759. var index;
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. return $core.withContext(function($ctx1) {
  4762. //>>excludeEnd("ctx");
  4763. var $1;
  4764. index=self._indexOf_ifAbsent_(anObject,(function(){
  4765. return (0);
  4766. }));
  4767. $1=$recv(index).__eq((0));
  4768. if($core.assert($1)){
  4769. return $recv(aBlock)._value();
  4770. } else {
  4771. self._removeIndex_(index);
  4772. return anObject;
  4773. };
  4774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4775. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4776. //>>excludeEnd("ctx");
  4777. },
  4778. //>>excludeStart("ide", pragmas.excludeIdeData);
  4779. args: ["anObject", "aBlock"],
  4780. 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 ]",
  4781. referencedClasses: [],
  4782. //>>excludeEnd("ide");
  4783. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4784. }),
  4785. $globals.Array);
  4786. $core.addMethod(
  4787. $core.method({
  4788. selector: "removeAll",
  4789. protocol: 'adding/removing',
  4790. fn: function (){
  4791. var self=this;
  4792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4793. return $core.withContext(function($ctx1) {
  4794. //>>excludeEnd("ctx");
  4795. self.length = 0;
  4796. return self;
  4797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4798. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4799. //>>excludeEnd("ctx");
  4800. },
  4801. //>>excludeStart("ide", pragmas.excludeIdeData);
  4802. args: [],
  4803. source: "removeAll\x0a\x09<self.length = 0>",
  4804. referencedClasses: [],
  4805. //>>excludeEnd("ide");
  4806. messageSends: []
  4807. }),
  4808. $globals.Array);
  4809. $core.addMethod(
  4810. $core.method({
  4811. selector: "removeFrom:to:",
  4812. protocol: 'adding/removing',
  4813. fn: function (aNumber,anotherNumber){
  4814. var self=this;
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. return $core.withContext(function($ctx1) {
  4817. //>>excludeEnd("ctx");
  4818. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4819. return self;
  4820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4821. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4822. //>>excludeEnd("ctx");
  4823. },
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: ["aNumber", "anotherNumber"],
  4826. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. messageSends: []
  4830. }),
  4831. $globals.Array);
  4832. $core.addMethod(
  4833. $core.method({
  4834. selector: "removeIndex:",
  4835. protocol: 'adding/removing',
  4836. fn: function (anInteger){
  4837. var self=this;
  4838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4839. return $core.withContext(function($ctx1) {
  4840. //>>excludeEnd("ctx");
  4841. self.splice(anInteger - 1, 1);
  4842. return self;
  4843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4844. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4845. //>>excludeEnd("ctx");
  4846. },
  4847. //>>excludeStart("ide", pragmas.excludeIdeData);
  4848. args: ["anInteger"],
  4849. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  4850. referencedClasses: [],
  4851. //>>excludeEnd("ide");
  4852. messageSends: []
  4853. }),
  4854. $globals.Array);
  4855. $core.addMethod(
  4856. $core.method({
  4857. selector: "removeLast",
  4858. protocol: 'adding/removing',
  4859. fn: function (){
  4860. var self=this;
  4861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4862. return $core.withContext(function($ctx1) {
  4863. //>>excludeEnd("ctx");
  4864. return self.pop();;
  4865. return self;
  4866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4867. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4868. //>>excludeEnd("ctx");
  4869. },
  4870. //>>excludeStart("ide", pragmas.excludeIdeData);
  4871. args: [],
  4872. source: "removeLast\x0a\x09<return self.pop();>",
  4873. referencedClasses: [],
  4874. //>>excludeEnd("ide");
  4875. messageSends: []
  4876. }),
  4877. $globals.Array);
  4878. $core.addMethod(
  4879. $core.method({
  4880. selector: "reversed",
  4881. protocol: 'converting',
  4882. fn: function (){
  4883. var self=this;
  4884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4885. return $core.withContext(function($ctx1) {
  4886. //>>excludeEnd("ctx");
  4887. return self.slice().reverse();
  4888. return self;
  4889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4890. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4891. //>>excludeEnd("ctx");
  4892. },
  4893. //>>excludeStart("ide", pragmas.excludeIdeData);
  4894. args: [],
  4895. source: "reversed\x0a\x09<return self.slice().reverse()>",
  4896. referencedClasses: [],
  4897. //>>excludeEnd("ide");
  4898. messageSends: []
  4899. }),
  4900. $globals.Array);
  4901. $core.addMethod(
  4902. $core.method({
  4903. selector: "select:",
  4904. protocol: 'enumerating',
  4905. fn: function (aBlock){
  4906. var self=this;
  4907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4908. return $core.withContext(function($ctx1) {
  4909. //>>excludeEnd("ctx");
  4910. return self.filter(function(each) {return aBlock._value_(each)});
  4911. return self;
  4912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4913. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4914. //>>excludeEnd("ctx");
  4915. },
  4916. //>>excludeStart("ide", pragmas.excludeIdeData);
  4917. args: ["aBlock"],
  4918. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  4919. referencedClasses: [],
  4920. //>>excludeEnd("ide");
  4921. messageSends: []
  4922. }),
  4923. $globals.Array);
  4924. $core.addMethod(
  4925. $core.method({
  4926. selector: "shallowCopy",
  4927. protocol: 'copying',
  4928. fn: function (){
  4929. var self=this;
  4930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4931. return $core.withContext(function($ctx1) {
  4932. //>>excludeEnd("ctx");
  4933. return self.slice();
  4934. return self;
  4935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4936. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4937. //>>excludeEnd("ctx");
  4938. },
  4939. //>>excludeStart("ide", pragmas.excludeIdeData);
  4940. args: [],
  4941. source: "shallowCopy\x0a\x09<return self.slice()>",
  4942. referencedClasses: [],
  4943. //>>excludeEnd("ide");
  4944. messageSends: []
  4945. }),
  4946. $globals.Array);
  4947. $core.addMethod(
  4948. $core.method({
  4949. selector: "size",
  4950. protocol: 'accessing',
  4951. fn: function (){
  4952. var self=this;
  4953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4954. return $core.withContext(function($ctx1) {
  4955. //>>excludeEnd("ctx");
  4956. return self.length;
  4957. return self;
  4958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4959. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  4960. //>>excludeEnd("ctx");
  4961. },
  4962. //>>excludeStart("ide", pragmas.excludeIdeData);
  4963. args: [],
  4964. source: "size\x0a\x09<return self.length>",
  4965. referencedClasses: [],
  4966. //>>excludeEnd("ide");
  4967. messageSends: []
  4968. }),
  4969. $globals.Array);
  4970. $core.addMethod(
  4971. $core.method({
  4972. selector: "sort",
  4973. protocol: 'enumerating',
  4974. fn: function (){
  4975. var self=this;
  4976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4977. return $core.withContext(function($ctx1) {
  4978. //>>excludeEnd("ctx");
  4979. return self._sort_((function(a,b){
  4980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4981. return $core.withContext(function($ctx2) {
  4982. //>>excludeEnd("ctx");
  4983. return $recv(a).__lt(b);
  4984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4985. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4986. //>>excludeEnd("ctx");
  4987. }));
  4988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4989. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4990. //>>excludeEnd("ctx");
  4991. },
  4992. //>>excludeStart("ide", pragmas.excludeIdeData);
  4993. args: [],
  4994. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4995. referencedClasses: [],
  4996. //>>excludeEnd("ide");
  4997. messageSends: ["sort:", "<"]
  4998. }),
  4999. $globals.Array);
  5000. $core.addMethod(
  5001. $core.method({
  5002. selector: "sort:",
  5003. protocol: 'enumerating',
  5004. fn: function (aBlock){
  5005. var self=this;
  5006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5007. return $core.withContext(function($ctx1) {
  5008. //>>excludeEnd("ctx");
  5009. return self.sort(function(a, b) {
  5010. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5011. })
  5012. ;
  5013. return self;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5016. //>>excludeEnd("ctx");
  5017. },
  5018. //>>excludeStart("ide", pragmas.excludeIdeData);
  5019. args: ["aBlock"],
  5020. 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>",
  5021. referencedClasses: [],
  5022. //>>excludeEnd("ide");
  5023. messageSends: []
  5024. }),
  5025. $globals.Array);
  5026. $core.addMethod(
  5027. $core.method({
  5028. selector: "sorted",
  5029. protocol: 'enumerating',
  5030. fn: function (){
  5031. var self=this;
  5032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5033. return $core.withContext(function($ctx1) {
  5034. //>>excludeEnd("ctx");
  5035. return $recv(self._copy())._sort();
  5036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5037. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5038. //>>excludeEnd("ctx");
  5039. },
  5040. //>>excludeStart("ide", pragmas.excludeIdeData);
  5041. args: [],
  5042. source: "sorted\x0a\x09^ self copy sort",
  5043. referencedClasses: [],
  5044. //>>excludeEnd("ide");
  5045. messageSends: ["sort", "copy"]
  5046. }),
  5047. $globals.Array);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: "sorted:",
  5051. protocol: 'enumerating',
  5052. fn: function (aBlock){
  5053. var self=this;
  5054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5055. return $core.withContext(function($ctx1) {
  5056. //>>excludeEnd("ctx");
  5057. return $recv(self._copy())._sort_(aBlock);
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5060. //>>excludeEnd("ctx");
  5061. },
  5062. //>>excludeStart("ide", pragmas.excludeIdeData);
  5063. args: ["aBlock"],
  5064. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5065. referencedClasses: [],
  5066. //>>excludeEnd("ide");
  5067. messageSends: ["sort:", "copy"]
  5068. }),
  5069. $globals.Array);
  5070. $core.addMethod(
  5071. $core.method({
  5072. selector: "new:",
  5073. protocol: 'instance creation',
  5074. fn: function (anInteger){
  5075. var self=this;
  5076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5077. return $core.withContext(function($ctx1) {
  5078. //>>excludeEnd("ctx");
  5079. return new Array(anInteger);
  5080. return self;
  5081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5082. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  5083. //>>excludeEnd("ctx");
  5084. },
  5085. //>>excludeStart("ide", pragmas.excludeIdeData);
  5086. args: ["anInteger"],
  5087. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  5088. referencedClasses: [],
  5089. //>>excludeEnd("ide");
  5090. messageSends: []
  5091. }),
  5092. $globals.Array.klass);
  5093. $core.addMethod(
  5094. $core.method({
  5095. selector: "with:",
  5096. protocol: 'instance creation',
  5097. fn: function (anObject){
  5098. var self=this;
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. return $core.withContext(function($ctx1) {
  5101. //>>excludeEnd("ctx");
  5102. var $1;
  5103. $1=self._new_((1));
  5104. $recv($1)._at_put_((1),anObject);
  5105. return $recv($1)._yourself();
  5106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5107. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  5108. //>>excludeEnd("ctx");
  5109. },
  5110. //>>excludeStart("ide", pragmas.excludeIdeData);
  5111. args: ["anObject"],
  5112. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5113. referencedClasses: [],
  5114. //>>excludeEnd("ide");
  5115. messageSends: ["at:put:", "new:", "yourself"]
  5116. }),
  5117. $globals.Array.klass);
  5118. $core.addMethod(
  5119. $core.method({
  5120. selector: "with:with:",
  5121. protocol: 'instance creation',
  5122. fn: function (anObject,anObject2){
  5123. var self=this;
  5124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5125. return $core.withContext(function($ctx1) {
  5126. //>>excludeEnd("ctx");
  5127. var $1;
  5128. $1=self._new_((2));
  5129. $recv($1)._at_put_((1),anObject);
  5130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5131. $ctx1.sendIdx["at:put:"]=1;
  5132. //>>excludeEnd("ctx");
  5133. $recv($1)._at_put_((2),anObject2);
  5134. return $recv($1)._yourself();
  5135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5136. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  5137. //>>excludeEnd("ctx");
  5138. },
  5139. //>>excludeStart("ide", pragmas.excludeIdeData);
  5140. args: ["anObject", "anObject2"],
  5141. 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",
  5142. referencedClasses: [],
  5143. //>>excludeEnd("ide");
  5144. messageSends: ["at:put:", "new:", "yourself"]
  5145. }),
  5146. $globals.Array.klass);
  5147. $core.addMethod(
  5148. $core.method({
  5149. selector: "with:with:with:",
  5150. protocol: 'instance creation',
  5151. fn: function (anObject,anObject2,anObject3){
  5152. var self=this;
  5153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5154. return $core.withContext(function($ctx1) {
  5155. //>>excludeEnd("ctx");
  5156. var $1;
  5157. $1=self._new_((3));
  5158. $recv($1)._at_put_((1),anObject);
  5159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5160. $ctx1.sendIdx["at:put:"]=1;
  5161. //>>excludeEnd("ctx");
  5162. $recv($1)._at_put_((2),anObject2);
  5163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5164. $ctx1.sendIdx["at:put:"]=2;
  5165. //>>excludeEnd("ctx");
  5166. $recv($1)._at_put_((3),anObject3);
  5167. return $recv($1)._yourself();
  5168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5169. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  5170. //>>excludeEnd("ctx");
  5171. },
  5172. //>>excludeStart("ide", pragmas.excludeIdeData);
  5173. args: ["anObject", "anObject2", "anObject3"],
  5174. 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",
  5175. referencedClasses: [],
  5176. //>>excludeEnd("ide");
  5177. messageSends: ["at:put:", "new:", "yourself"]
  5178. }),
  5179. $globals.Array.klass);
  5180. $core.addMethod(
  5181. $core.method({
  5182. selector: "withAll:",
  5183. protocol: 'instance creation',
  5184. fn: function (aCollection){
  5185. var self=this;
  5186. var instance,index;
  5187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5188. return $core.withContext(function($ctx1) {
  5189. //>>excludeEnd("ctx");
  5190. index=(1);
  5191. instance=self._new_($recv(aCollection)._size());
  5192. $recv(aCollection)._do_((function(each){
  5193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5194. return $core.withContext(function($ctx2) {
  5195. //>>excludeEnd("ctx");
  5196. $recv(instance)._at_put_(index,each);
  5197. index=$recv(index).__plus((1));
  5198. return index;
  5199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5201. //>>excludeEnd("ctx");
  5202. }));
  5203. return instance;
  5204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5205. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  5206. //>>excludeEnd("ctx");
  5207. },
  5208. //>>excludeStart("ide", pragmas.excludeIdeData);
  5209. args: ["aCollection"],
  5210. 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",
  5211. referencedClasses: [],
  5212. //>>excludeEnd("ide");
  5213. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5214. }),
  5215. $globals.Array.klass);
  5216. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  5217. //>>excludeStart("ide", pragmas.excludeIdeData);
  5218. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5219. //>>excludeEnd("ide");
  5220. $core.addMethod(
  5221. $core.method({
  5222. selector: ",",
  5223. protocol: 'copying',
  5224. fn: function (aString){
  5225. var self=this;
  5226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5227. return $core.withContext(function($ctx1) {
  5228. //>>excludeEnd("ctx");
  5229. var $1;
  5230. $1=self._asString();
  5231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5232. $ctx1.sendIdx["asString"]=1;
  5233. //>>excludeEnd("ctx");
  5234. return $recv($1).__comma($recv(aString)._asString());
  5235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5236. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5237. //>>excludeEnd("ctx");
  5238. },
  5239. //>>excludeStart("ide", pragmas.excludeIdeData);
  5240. args: ["aString"],
  5241. source: ", aString\x0a\x09^ self asString, aString asString",
  5242. referencedClasses: [],
  5243. //>>excludeEnd("ide");
  5244. messageSends: [",", "asString"]
  5245. }),
  5246. $globals.CharacterArray);
  5247. $core.addMethod(
  5248. $core.method({
  5249. selector: "add:",
  5250. protocol: 'adding/removing',
  5251. fn: function (anObject){
  5252. var self=this;
  5253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5254. return $core.withContext(function($ctx1) {
  5255. //>>excludeEnd("ctx");
  5256. self._errorReadOnly();
  5257. return self;
  5258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5259. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5260. //>>excludeEnd("ctx");
  5261. },
  5262. //>>excludeStart("ide", pragmas.excludeIdeData);
  5263. args: ["anObject"],
  5264. source: "add: anObject\x0a\x09self errorReadOnly",
  5265. referencedClasses: [],
  5266. //>>excludeEnd("ide");
  5267. messageSends: ["errorReadOnly"]
  5268. }),
  5269. $globals.CharacterArray);
  5270. $core.addMethod(
  5271. $core.method({
  5272. selector: "asLowercase",
  5273. protocol: 'converting',
  5274. fn: function (){
  5275. var self=this;
  5276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5277. return $core.withContext(function($ctx1) {
  5278. //>>excludeEnd("ctx");
  5279. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5282. //>>excludeEnd("ctx");
  5283. },
  5284. //>>excludeStart("ide", pragmas.excludeIdeData);
  5285. args: [],
  5286. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5287. referencedClasses: [],
  5288. //>>excludeEnd("ide");
  5289. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5290. }),
  5291. $globals.CharacterArray);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "asNumber",
  5295. protocol: 'converting',
  5296. fn: function (){
  5297. var self=this;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. return $core.withContext(function($ctx1) {
  5300. //>>excludeEnd("ctx");
  5301. return $recv(self._asString())._asNumber();
  5302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5303. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5304. //>>excludeEnd("ctx");
  5305. },
  5306. //>>excludeStart("ide", pragmas.excludeIdeData);
  5307. args: [],
  5308. source: "asNumber\x0a\x09^ self asString asNumber",
  5309. referencedClasses: [],
  5310. //>>excludeEnd("ide");
  5311. messageSends: ["asNumber", "asString"]
  5312. }),
  5313. $globals.CharacterArray);
  5314. $core.addMethod(
  5315. $core.method({
  5316. selector: "asString",
  5317. protocol: 'converting',
  5318. fn: function (){
  5319. var self=this;
  5320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5321. return $core.withContext(function($ctx1) {
  5322. //>>excludeEnd("ctx");
  5323. return self._subclassResponsibility();
  5324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5325. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5326. //>>excludeEnd("ctx");
  5327. },
  5328. //>>excludeStart("ide", pragmas.excludeIdeData);
  5329. args: [],
  5330. source: "asString\x0a\x09^ self subclassResponsibility",
  5331. referencedClasses: [],
  5332. //>>excludeEnd("ide");
  5333. messageSends: ["subclassResponsibility"]
  5334. }),
  5335. $globals.CharacterArray);
  5336. $core.addMethod(
  5337. $core.method({
  5338. selector: "asSymbol",
  5339. protocol: 'converting',
  5340. fn: function (){
  5341. var self=this;
  5342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5343. return $core.withContext(function($ctx1) {
  5344. //>>excludeEnd("ctx");
  5345. return self._asString();
  5346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5347. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5348. //>>excludeEnd("ctx");
  5349. },
  5350. //>>excludeStart("ide", pragmas.excludeIdeData);
  5351. args: [],
  5352. source: "asSymbol\x0a\x09^ self asString",
  5353. referencedClasses: [],
  5354. //>>excludeEnd("ide");
  5355. messageSends: ["asString"]
  5356. }),
  5357. $globals.CharacterArray);
  5358. $core.addMethod(
  5359. $core.method({
  5360. selector: "asUppercase",
  5361. protocol: 'converting',
  5362. fn: function (){
  5363. var self=this;
  5364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5365. return $core.withContext(function($ctx1) {
  5366. //>>excludeEnd("ctx");
  5367. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  5368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5369. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5370. //>>excludeEnd("ctx");
  5371. },
  5372. //>>excludeStart("ide", pragmas.excludeIdeData);
  5373. args: [],
  5374. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5375. referencedClasses: [],
  5376. //>>excludeEnd("ide");
  5377. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5378. }),
  5379. $globals.CharacterArray);
  5380. $core.addMethod(
  5381. $core.method({
  5382. selector: "at:put:",
  5383. protocol: 'accessing',
  5384. fn: function (anIndex,anObject){
  5385. var self=this;
  5386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5387. return $core.withContext(function($ctx1) {
  5388. //>>excludeEnd("ctx");
  5389. self._errorReadOnly();
  5390. return self;
  5391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5392. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5393. //>>excludeEnd("ctx");
  5394. },
  5395. //>>excludeStart("ide", pragmas.excludeIdeData);
  5396. args: ["anIndex", "anObject"],
  5397. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5398. referencedClasses: [],
  5399. //>>excludeEnd("ide");
  5400. messageSends: ["errorReadOnly"]
  5401. }),
  5402. $globals.CharacterArray);
  5403. $core.addMethod(
  5404. $core.method({
  5405. selector: "errorReadOnly",
  5406. protocol: 'error handling',
  5407. fn: function (){
  5408. var self=this;
  5409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5410. return $core.withContext(function($ctx1) {
  5411. //>>excludeEnd("ctx");
  5412. self._error_("Object is read-only");
  5413. return self;
  5414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5415. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5416. //>>excludeEnd("ctx");
  5417. },
  5418. //>>excludeStart("ide", pragmas.excludeIdeData);
  5419. args: [],
  5420. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5421. referencedClasses: [],
  5422. //>>excludeEnd("ide");
  5423. messageSends: ["error:"]
  5424. }),
  5425. $globals.CharacterArray);
  5426. $core.addMethod(
  5427. $core.method({
  5428. selector: "printOn:",
  5429. protocol: 'printing',
  5430. fn: function (aStream){
  5431. var self=this;
  5432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5433. return $core.withContext(function($ctx1) {
  5434. //>>excludeEnd("ctx");
  5435. $recv(self._asString())._printOn_(aStream);
  5436. return self;
  5437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5438. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5439. //>>excludeEnd("ctx");
  5440. },
  5441. //>>excludeStart("ide", pragmas.excludeIdeData);
  5442. args: ["aStream"],
  5443. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5444. referencedClasses: [],
  5445. //>>excludeEnd("ide");
  5446. messageSends: ["printOn:", "asString"]
  5447. }),
  5448. $globals.CharacterArray);
  5449. $core.addMethod(
  5450. $core.method({
  5451. selector: "putOn:",
  5452. protocol: 'streaming',
  5453. fn: function (aStream){
  5454. var self=this;
  5455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5456. return $core.withContext(function($ctx1) {
  5457. //>>excludeEnd("ctx");
  5458. $recv(aStream)._nextPutString_(self);
  5459. return self;
  5460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5461. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5462. //>>excludeEnd("ctx");
  5463. },
  5464. //>>excludeStart("ide", pragmas.excludeIdeData);
  5465. args: ["aStream"],
  5466. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5467. referencedClasses: [],
  5468. //>>excludeEnd("ide");
  5469. messageSends: ["nextPutString:"]
  5470. }),
  5471. $globals.CharacterArray);
  5472. $core.addMethod(
  5473. $core.method({
  5474. selector: "remove:",
  5475. protocol: 'adding/removing',
  5476. fn: function (anObject){
  5477. var self=this;
  5478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5479. return $core.withContext(function($ctx1) {
  5480. //>>excludeEnd("ctx");
  5481. self._errorReadOnly();
  5482. return self;
  5483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5484. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5485. //>>excludeEnd("ctx");
  5486. },
  5487. //>>excludeStart("ide", pragmas.excludeIdeData);
  5488. args: ["anObject"],
  5489. source: "remove: anObject\x0a\x09self errorReadOnly",
  5490. referencedClasses: [],
  5491. //>>excludeEnd("ide");
  5492. messageSends: ["errorReadOnly"]
  5493. }),
  5494. $globals.CharacterArray);
  5495. $core.addMethod(
  5496. $core.method({
  5497. selector: "fromString:",
  5498. protocol: 'instance creation',
  5499. fn: function (aString){
  5500. var self=this;
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. return $core.withContext(function($ctx1) {
  5503. //>>excludeEnd("ctx");
  5504. self._subclassResponsibility();
  5505. return self;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  5508. //>>excludeEnd("ctx");
  5509. },
  5510. //>>excludeStart("ide", pragmas.excludeIdeData);
  5511. args: ["aString"],
  5512. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5513. referencedClasses: [],
  5514. //>>excludeEnd("ide");
  5515. messageSends: ["subclassResponsibility"]
  5516. }),
  5517. $globals.CharacterArray.klass);
  5518. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  5519. //>>excludeStart("ide", pragmas.excludeIdeData);
  5520. $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 >> #,`";
  5521. //>>excludeEnd("ide");
  5522. $core.addMethod(
  5523. $core.method({
  5524. selector: ",",
  5525. protocol: 'copying',
  5526. fn: function (aString){
  5527. var self=this;
  5528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5529. return $core.withContext(function($ctx1) {
  5530. //>>excludeEnd("ctx");
  5531. return String(self) + aString;
  5532. return self;
  5533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5534. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5535. //>>excludeEnd("ctx");
  5536. },
  5537. //>>excludeStart("ide", pragmas.excludeIdeData);
  5538. args: ["aString"],
  5539. source: ", aString\x0a\x09<return String(self) + aString>",
  5540. referencedClasses: [],
  5541. //>>excludeEnd("ide");
  5542. messageSends: []
  5543. }),
  5544. $globals.String);
  5545. $core.addMethod(
  5546. $core.method({
  5547. selector: "<",
  5548. protocol: 'comparing',
  5549. fn: function (aString){
  5550. var self=this;
  5551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5552. return $core.withContext(function($ctx1) {
  5553. //>>excludeEnd("ctx");
  5554. return String(self) < aString._asString();
  5555. return self;
  5556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5557. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5558. //>>excludeEnd("ctx");
  5559. },
  5560. //>>excludeStart("ide", pragmas.excludeIdeData);
  5561. args: ["aString"],
  5562. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  5563. referencedClasses: [],
  5564. //>>excludeEnd("ide");
  5565. messageSends: []
  5566. }),
  5567. $globals.String);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "<=",
  5571. protocol: 'comparing',
  5572. fn: function (aString){
  5573. var self=this;
  5574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5575. return $core.withContext(function($ctx1) {
  5576. //>>excludeEnd("ctx");
  5577. return String(self) <= aString._asString();
  5578. return self;
  5579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5580. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5581. //>>excludeEnd("ctx");
  5582. },
  5583. //>>excludeStart("ide", pragmas.excludeIdeData);
  5584. args: ["aString"],
  5585. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  5586. referencedClasses: [],
  5587. //>>excludeEnd("ide");
  5588. messageSends: []
  5589. }),
  5590. $globals.String);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "=",
  5594. protocol: 'comparing',
  5595. fn: function (aString){
  5596. var self=this;
  5597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5598. return $core.withContext(function($ctx1) {
  5599. //>>excludeEnd("ctx");
  5600. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5601. return self;
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5604. //>>excludeEnd("ctx");
  5605. },
  5606. //>>excludeStart("ide", pragmas.excludeIdeData);
  5607. args: ["aString"],
  5608. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  5609. referencedClasses: [],
  5610. //>>excludeEnd("ide");
  5611. messageSends: []
  5612. }),
  5613. $globals.String);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "==",
  5617. protocol: 'comparing',
  5618. fn: function (aString){
  5619. var self=this;
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. return $core.withContext(function($ctx1) {
  5622. //>>excludeEnd("ctx");
  5623. if (typeof aString === "string") return String(self) === aString;
  5624. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5625. else return false;;
  5626. return self;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5629. //>>excludeEnd("ctx");
  5630. },
  5631. //>>excludeStart("ide", pragmas.excludeIdeData);
  5632. args: ["aString"],
  5633. source: "== aString\x0a<\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;\x0a>",
  5634. referencedClasses: [],
  5635. //>>excludeEnd("ide");
  5636. messageSends: []
  5637. }),
  5638. $globals.String);
  5639. $core.addMethod(
  5640. $core.method({
  5641. selector: ">",
  5642. protocol: 'comparing',
  5643. fn: function (aString){
  5644. var self=this;
  5645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5646. return $core.withContext(function($ctx1) {
  5647. //>>excludeEnd("ctx");
  5648. return String(self) > aString._asString();
  5649. return self;
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5652. //>>excludeEnd("ctx");
  5653. },
  5654. //>>excludeStart("ide", pragmas.excludeIdeData);
  5655. args: ["aString"],
  5656. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  5657. referencedClasses: [],
  5658. //>>excludeEnd("ide");
  5659. messageSends: []
  5660. }),
  5661. $globals.String);
  5662. $core.addMethod(
  5663. $core.method({
  5664. selector: ">=",
  5665. protocol: 'comparing',
  5666. fn: function (aString){
  5667. var self=this;
  5668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5669. return $core.withContext(function($ctx1) {
  5670. //>>excludeEnd("ctx");
  5671. return String(self) >= aString._asString();
  5672. return self;
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5675. //>>excludeEnd("ctx");
  5676. },
  5677. //>>excludeStart("ide", pragmas.excludeIdeData);
  5678. args: ["aString"],
  5679. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  5680. referencedClasses: [],
  5681. //>>excludeEnd("ide");
  5682. messageSends: []
  5683. }),
  5684. $globals.String);
  5685. $core.addMethod(
  5686. $core.method({
  5687. selector: "asJSON",
  5688. protocol: 'converting',
  5689. fn: function (){
  5690. var self=this;
  5691. return self;
  5692. },
  5693. //>>excludeStart("ide", pragmas.excludeIdeData);
  5694. args: [],
  5695. source: "asJSON\x0a\x09^ self",
  5696. referencedClasses: [],
  5697. //>>excludeEnd("ide");
  5698. messageSends: []
  5699. }),
  5700. $globals.String);
  5701. $core.addMethod(
  5702. $core.method({
  5703. selector: "asJavaScriptMethodName",
  5704. protocol: 'converting',
  5705. fn: function (){
  5706. var self=this;
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. return $core.withContext(function($ctx1) {
  5709. //>>excludeEnd("ctx");
  5710. return $core.st2js(self);
  5711. return self;
  5712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5713. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5714. //>>excludeEnd("ctx");
  5715. },
  5716. //>>excludeStart("ide", pragmas.excludeIdeData);
  5717. args: [],
  5718. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  5719. referencedClasses: [],
  5720. //>>excludeEnd("ide");
  5721. messageSends: []
  5722. }),
  5723. $globals.String);
  5724. $core.addMethod(
  5725. $core.method({
  5726. selector: "asJavascript",
  5727. protocol: 'converting',
  5728. fn: function (){
  5729. var self=this;
  5730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5731. return $core.withContext(function($ctx1) {
  5732. //>>excludeEnd("ctx");
  5733. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5734. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5735. else
  5736. return "\"" + self + "\"";
  5737. ;
  5738. return self;
  5739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5740. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  5741. //>>excludeEnd("ctx");
  5742. },
  5743. //>>excludeStart("ide", pragmas.excludeIdeData);
  5744. args: [],
  5745. 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>",
  5746. referencedClasses: [],
  5747. //>>excludeEnd("ide");
  5748. messageSends: []
  5749. }),
  5750. $globals.String);
  5751. $core.addMethod(
  5752. $core.method({
  5753. selector: "asLowercase",
  5754. protocol: 'converting',
  5755. fn: function (){
  5756. var self=this;
  5757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5758. return $core.withContext(function($ctx1) {
  5759. //>>excludeEnd("ctx");
  5760. return self.toLowerCase();
  5761. return self;
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5764. //>>excludeEnd("ctx");
  5765. },
  5766. //>>excludeStart("ide", pragmas.excludeIdeData);
  5767. args: [],
  5768. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  5769. referencedClasses: [],
  5770. //>>excludeEnd("ide");
  5771. messageSends: []
  5772. }),
  5773. $globals.String);
  5774. $core.addMethod(
  5775. $core.method({
  5776. selector: "asMutator",
  5777. protocol: 'converting',
  5778. fn: function (){
  5779. var self=this;
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. return $core.withContext(function($ctx1) {
  5782. //>>excludeEnd("ctx");
  5783. var $1;
  5784. $1=$recv(self._last()).__eq(":");
  5785. if(!$core.assert($1)){
  5786. return self.__comma(":");
  5787. };
  5788. return self;
  5789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5790. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5791. //>>excludeEnd("ctx");
  5792. },
  5793. //>>excludeStart("ide", pragmas.excludeIdeData);
  5794. args: [],
  5795. 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",
  5796. referencedClasses: [],
  5797. //>>excludeEnd("ide");
  5798. messageSends: ["ifFalse:", "=", "last", ","]
  5799. }),
  5800. $globals.String);
  5801. $core.addMethod(
  5802. $core.method({
  5803. selector: "asNumber",
  5804. protocol: 'converting',
  5805. fn: function (){
  5806. var self=this;
  5807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5808. return $core.withContext(function($ctx1) {
  5809. //>>excludeEnd("ctx");
  5810. return Number(self);
  5811. return self;
  5812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5813. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5814. //>>excludeEnd("ctx");
  5815. },
  5816. //>>excludeStart("ide", pragmas.excludeIdeData);
  5817. args: [],
  5818. source: "asNumber\x0a\x09<return Number(self)>",
  5819. referencedClasses: [],
  5820. //>>excludeEnd("ide");
  5821. messageSends: []
  5822. }),
  5823. $globals.String);
  5824. $core.addMethod(
  5825. $core.method({
  5826. selector: "asRegexp",
  5827. protocol: 'converting',
  5828. fn: function (){
  5829. var self=this;
  5830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5831. return $core.withContext(function($ctx1) {
  5832. //>>excludeEnd("ctx");
  5833. return $recv($globals.RegularExpression)._fromString_(self);
  5834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5835. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5836. //>>excludeEnd("ctx");
  5837. },
  5838. //>>excludeStart("ide", pragmas.excludeIdeData);
  5839. args: [],
  5840. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5841. referencedClasses: ["RegularExpression"],
  5842. //>>excludeEnd("ide");
  5843. messageSends: ["fromString:"]
  5844. }),
  5845. $globals.String);
  5846. $core.addMethod(
  5847. $core.method({
  5848. selector: "asString",
  5849. protocol: 'converting',
  5850. fn: function (){
  5851. var self=this;
  5852. return self;
  5853. },
  5854. //>>excludeStart("ide", pragmas.excludeIdeData);
  5855. args: [],
  5856. source: "asString\x0a\x09^ self",
  5857. referencedClasses: [],
  5858. //>>excludeEnd("ide");
  5859. messageSends: []
  5860. }),
  5861. $globals.String);
  5862. $core.addMethod(
  5863. $core.method({
  5864. selector: "asSymbol",
  5865. protocol: 'converting',
  5866. fn: function (){
  5867. var self=this;
  5868. return self;
  5869. },
  5870. //>>excludeStart("ide", pragmas.excludeIdeData);
  5871. args: [],
  5872. source: "asSymbol\x0a\x09^ self",
  5873. referencedClasses: [],
  5874. //>>excludeEnd("ide");
  5875. messageSends: []
  5876. }),
  5877. $globals.String);
  5878. $core.addMethod(
  5879. $core.method({
  5880. selector: "asUppercase",
  5881. protocol: 'converting',
  5882. fn: function (){
  5883. var self=this;
  5884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5885. return $core.withContext(function($ctx1) {
  5886. //>>excludeEnd("ctx");
  5887. return self.toUpperCase();
  5888. return self;
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5891. //>>excludeEnd("ctx");
  5892. },
  5893. //>>excludeStart("ide", pragmas.excludeIdeData);
  5894. args: [],
  5895. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  5896. referencedClasses: [],
  5897. //>>excludeEnd("ide");
  5898. messageSends: []
  5899. }),
  5900. $globals.String);
  5901. $core.addMethod(
  5902. $core.method({
  5903. selector: "asciiValue",
  5904. protocol: 'accessing',
  5905. fn: function (){
  5906. var self=this;
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. return $core.withContext(function($ctx1) {
  5909. //>>excludeEnd("ctx");
  5910. return self.charCodeAt(0);;
  5911. return self;
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5914. //>>excludeEnd("ctx");
  5915. },
  5916. //>>excludeStart("ide", pragmas.excludeIdeData);
  5917. args: [],
  5918. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  5919. referencedClasses: [],
  5920. //>>excludeEnd("ide");
  5921. messageSends: []
  5922. }),
  5923. $globals.String);
  5924. $core.addMethod(
  5925. $core.method({
  5926. selector: "at:ifAbsent:",
  5927. protocol: 'accessing',
  5928. fn: function (anIndex,aBlock){
  5929. var self=this;
  5930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5931. return $core.withContext(function($ctx1) {
  5932. //>>excludeEnd("ctx");
  5933. return String(self)[anIndex - 1] || aBlock._value();
  5934. return self;
  5935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5936. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5937. //>>excludeEnd("ctx");
  5938. },
  5939. //>>excludeStart("ide", pragmas.excludeIdeData);
  5940. args: ["anIndex", "aBlock"],
  5941. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  5942. referencedClasses: [],
  5943. //>>excludeEnd("ide");
  5944. messageSends: []
  5945. }),
  5946. $globals.String);
  5947. $core.addMethod(
  5948. $core.method({
  5949. selector: "at:ifPresent:ifAbsent:",
  5950. protocol: 'accessing',
  5951. fn: function (anIndex,aBlock,anotherBlock){
  5952. var self=this;
  5953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5954. return $core.withContext(function($ctx1) {
  5955. //>>excludeEnd("ctx");
  5956. var result = String(self)[anIndex - 1];
  5957. return result ? aBlock._value_(result) : anotherBlock._value();
  5958. ;
  5959. return self;
  5960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5961. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5962. //>>excludeEnd("ctx");
  5963. },
  5964. //>>excludeStart("ide", pragmas.excludeIdeData);
  5965. args: ["anIndex", "aBlock", "anotherBlock"],
  5966. 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>",
  5967. referencedClasses: [],
  5968. //>>excludeEnd("ide");
  5969. messageSends: []
  5970. }),
  5971. $globals.String);
  5972. $core.addMethod(
  5973. $core.method({
  5974. selector: "capitalized",
  5975. protocol: 'converting',
  5976. fn: function (){
  5977. var self=this;
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. return $core.withContext(function($ctx1) {
  5980. //>>excludeEnd("ctx");
  5981. var $1;
  5982. $1=self._isEmpty();
  5983. if($core.assert($1)){
  5984. return self;
  5985. } else {
  5986. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  5987. };
  5988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5989. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5990. //>>excludeEnd("ctx");
  5991. },
  5992. //>>excludeStart("ide", pragmas.excludeIdeData);
  5993. args: [],
  5994. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  5995. referencedClasses: [],
  5996. //>>excludeEnd("ide");
  5997. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  5998. }),
  5999. $globals.String);
  6000. $core.addMethod(
  6001. $core.method({
  6002. selector: "charCodeAt:",
  6003. protocol: 'accessing',
  6004. fn: function (anInteger){
  6005. var self=this;
  6006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6007. return $core.withContext(function($ctx1) {
  6008. //>>excludeEnd("ctx");
  6009. return self.charCodeAt(anInteger - 1);
  6010. return self;
  6011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6012. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6013. //>>excludeEnd("ctx");
  6014. },
  6015. //>>excludeStart("ide", pragmas.excludeIdeData);
  6016. args: ["anInteger"],
  6017. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  6018. referencedClasses: [],
  6019. //>>excludeEnd("ide");
  6020. messageSends: []
  6021. }),
  6022. $globals.String);
  6023. $core.addMethod(
  6024. $core.method({
  6025. selector: "copyFrom:to:",
  6026. protocol: 'copying',
  6027. fn: function (anIndex,anotherIndex){
  6028. var self=this;
  6029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6030. return $core.withContext(function($ctx1) {
  6031. //>>excludeEnd("ctx");
  6032. return self.substring(anIndex - 1, anotherIndex);
  6033. return self;
  6034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6035. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6036. //>>excludeEnd("ctx");
  6037. },
  6038. //>>excludeStart("ide", pragmas.excludeIdeData);
  6039. args: ["anIndex", "anotherIndex"],
  6040. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  6041. referencedClasses: [],
  6042. //>>excludeEnd("ide");
  6043. messageSends: []
  6044. }),
  6045. $globals.String);
  6046. $core.addMethod(
  6047. $core.method({
  6048. selector: "crlfSanitized",
  6049. protocol: 'converting',
  6050. fn: function (){
  6051. var self=this;
  6052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6053. return $core.withContext(function($ctx1) {
  6054. //>>excludeEnd("ctx");
  6055. return $recv(self._lines())._join_($recv($globals.String)._lf());
  6056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6057. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6058. //>>excludeEnd("ctx");
  6059. },
  6060. //>>excludeStart("ide", pragmas.excludeIdeData);
  6061. args: [],
  6062. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6063. referencedClasses: ["String"],
  6064. //>>excludeEnd("ide");
  6065. messageSends: ["join:", "lines", "lf"]
  6066. }),
  6067. $globals.String);
  6068. $core.addMethod(
  6069. $core.method({
  6070. selector: "deepCopy",
  6071. protocol: 'copying',
  6072. fn: function (){
  6073. var self=this;
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. return $core.withContext(function($ctx1) {
  6076. //>>excludeEnd("ctx");
  6077. return self._shallowCopy();
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6080. //>>excludeEnd("ctx");
  6081. },
  6082. //>>excludeStart("ide", pragmas.excludeIdeData);
  6083. args: [],
  6084. source: "deepCopy\x0a\x09^ self shallowCopy",
  6085. referencedClasses: [],
  6086. //>>excludeEnd("ide");
  6087. messageSends: ["shallowCopy"]
  6088. }),
  6089. $globals.String);
  6090. $core.addMethod(
  6091. $core.method({
  6092. selector: "escaped",
  6093. protocol: 'converting',
  6094. fn: function (){
  6095. var self=this;
  6096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6097. return $core.withContext(function($ctx1) {
  6098. //>>excludeEnd("ctx");
  6099. return escape(self);
  6100. return self;
  6101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6102. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6103. //>>excludeEnd("ctx");
  6104. },
  6105. //>>excludeStart("ide", pragmas.excludeIdeData);
  6106. args: [],
  6107. source: "escaped\x0a\x09<return escape(self)>",
  6108. referencedClasses: [],
  6109. //>>excludeEnd("ide");
  6110. messageSends: []
  6111. }),
  6112. $globals.String);
  6113. $core.addMethod(
  6114. $core.method({
  6115. selector: "includesSubString:",
  6116. protocol: 'testing',
  6117. fn: function (subString){
  6118. var self=this;
  6119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6120. return $core.withContext(function($ctx1) {
  6121. //>>excludeEnd("ctx");
  6122. return self.indexOf(subString) != -1;
  6123. return self;
  6124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6125. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6126. //>>excludeEnd("ctx");
  6127. },
  6128. //>>excludeStart("ide", pragmas.excludeIdeData);
  6129. args: ["subString"],
  6130. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  6131. referencedClasses: [],
  6132. //>>excludeEnd("ide");
  6133. messageSends: []
  6134. }),
  6135. $globals.String);
  6136. $core.addMethod(
  6137. $core.method({
  6138. selector: "isCapitalized",
  6139. protocol: 'testing',
  6140. fn: function (){
  6141. var self=this;
  6142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6143. return $core.withContext(function($ctx1) {
  6144. //>>excludeEnd("ctx");
  6145. var $2,$1;
  6146. $2=self._first();
  6147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6148. $ctx1.sendIdx["first"]=1;
  6149. //>>excludeEnd("ctx");
  6150. $1=$recv($2)._asUppercase();
  6151. return $recv($1).__eq_eq(self._first());
  6152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6153. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6154. //>>excludeEnd("ctx");
  6155. },
  6156. //>>excludeStart("ide", pragmas.excludeIdeData);
  6157. args: [],
  6158. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6159. referencedClasses: [],
  6160. //>>excludeEnd("ide");
  6161. messageSends: ["==", "asUppercase", "first"]
  6162. }),
  6163. $globals.String);
  6164. $core.addMethod(
  6165. $core.method({
  6166. selector: "isImmutable",
  6167. protocol: 'testing',
  6168. fn: function (){
  6169. var self=this;
  6170. return true;
  6171. },
  6172. //>>excludeStart("ide", pragmas.excludeIdeData);
  6173. args: [],
  6174. source: "isImmutable\x0a\x09^ true",
  6175. referencedClasses: [],
  6176. //>>excludeEnd("ide");
  6177. messageSends: []
  6178. }),
  6179. $globals.String);
  6180. $core.addMethod(
  6181. $core.method({
  6182. selector: "isString",
  6183. protocol: 'testing',
  6184. fn: function (){
  6185. var self=this;
  6186. return true;
  6187. },
  6188. //>>excludeStart("ide", pragmas.excludeIdeData);
  6189. args: [],
  6190. source: "isString\x0a\x09^ true",
  6191. referencedClasses: [],
  6192. //>>excludeEnd("ide");
  6193. messageSends: []
  6194. }),
  6195. $globals.String);
  6196. $core.addMethod(
  6197. $core.method({
  6198. selector: "isVowel",
  6199. protocol: 'testing',
  6200. fn: function (){
  6201. var self=this;
  6202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6203. return $core.withContext(function($ctx1) {
  6204. //>>excludeEnd("ctx");
  6205. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  6206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6207. return $core.withContext(function($ctx2) {
  6208. //>>excludeEnd("ctx");
  6209. return "aeiou"._includes_(self._asLowercase());
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6212. //>>excludeEnd("ctx");
  6213. }));
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6216. //>>excludeEnd("ctx");
  6217. },
  6218. //>>excludeStart("ide", pragmas.excludeIdeData);
  6219. args: [],
  6220. 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 ]",
  6221. referencedClasses: [],
  6222. //>>excludeEnd("ide");
  6223. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6224. }),
  6225. $globals.String);
  6226. $core.addMethod(
  6227. $core.method({
  6228. selector: "join:",
  6229. protocol: 'split join',
  6230. fn: function (aCollection){
  6231. var self=this;
  6232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6233. return $core.withContext(function($ctx1) {
  6234. //>>excludeEnd("ctx");
  6235. return $recv($globals.String)._streamContents_((function(stream){
  6236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6237. return $core.withContext(function($ctx2) {
  6238. //>>excludeEnd("ctx");
  6239. return $recv(aCollection)._do_separatedBy_((function(each){
  6240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6241. return $core.withContext(function($ctx3) {
  6242. //>>excludeEnd("ctx");
  6243. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6245. $ctx3.sendIdx["nextPutAll:"]=1;
  6246. //>>excludeEnd("ctx");
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6249. //>>excludeEnd("ctx");
  6250. }),(function(){
  6251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6252. return $core.withContext(function($ctx3) {
  6253. //>>excludeEnd("ctx");
  6254. return $recv(stream)._nextPutAll_(self);
  6255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6256. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6257. //>>excludeEnd("ctx");
  6258. }));
  6259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6260. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6261. //>>excludeEnd("ctx");
  6262. }));
  6263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6264. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6265. //>>excludeEnd("ctx");
  6266. },
  6267. //>>excludeStart("ide", pragmas.excludeIdeData);
  6268. args: ["aCollection"],
  6269. 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 ]]",
  6270. referencedClasses: ["String"],
  6271. //>>excludeEnd("ide");
  6272. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6273. }),
  6274. $globals.String);
  6275. $core.addMethod(
  6276. $core.method({
  6277. selector: "lineIndicesDo:",
  6278. protocol: 'split join',
  6279. fn: function (aBlock){
  6280. var self=this;
  6281. var cr,lf,start,sz,nextLF,nextCR;
  6282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6283. return $core.withContext(function($ctx1) {
  6284. //>>excludeEnd("ctx");
  6285. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6286. var $early={};
  6287. try {
  6288. start=(1);
  6289. sz=self._size();
  6290. cr=$recv($globals.String)._cr();
  6291. nextCR=self._indexOf_startingAt_(cr,(1));
  6292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6293. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6294. //>>excludeEnd("ctx");
  6295. lf=$recv($globals.String)._lf();
  6296. nextLF=self._indexOf_startingAt_(lf,(1));
  6297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6298. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6299. //>>excludeEnd("ctx");
  6300. $recv((function(){
  6301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6302. return $core.withContext(function($ctx2) {
  6303. //>>excludeEnd("ctx");
  6304. return $recv(start).__lt_eq(sz);
  6305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6307. //>>excludeEnd("ctx");
  6308. }))._whileTrue_((function(){
  6309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6310. return $core.withContext(function($ctx2) {
  6311. //>>excludeEnd("ctx");
  6312. $2=$recv(nextLF).__eq((0));
  6313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6314. $ctx2.sendIdx["="]=1;
  6315. //>>excludeEnd("ctx");
  6316. $1=$recv($2)._and_((function(){
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. return $core.withContext(function($ctx3) {
  6319. //>>excludeEnd("ctx");
  6320. return $recv(nextCR).__eq((0));
  6321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6322. $ctx3.sendIdx["="]=2;
  6323. //>>excludeEnd("ctx");
  6324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6325. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6326. //>>excludeEnd("ctx");
  6327. }));
  6328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6329. $ctx2.sendIdx["and:"]=1;
  6330. //>>excludeEnd("ctx");
  6331. if($core.assert($1)){
  6332. $recv(aBlock)._value_value_value_(start,sz,sz);
  6333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6334. $ctx2.sendIdx["value:value:value:"]=1;
  6335. //>>excludeEnd("ctx");
  6336. throw $early=[self];
  6337. };
  6338. $4=$recv(nextCR).__eq((0));
  6339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6340. $ctx2.sendIdx["="]=3;
  6341. //>>excludeEnd("ctx");
  6342. $3=$recv($4)._or_((function(){
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. return $core.withContext(function($ctx3) {
  6345. //>>excludeEnd("ctx");
  6346. $5=(0).__lt(nextLF);
  6347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6348. $ctx3.sendIdx["<"]=1;
  6349. //>>excludeEnd("ctx");
  6350. return $recv($5)._and_((function(){
  6351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6352. return $core.withContext(function($ctx4) {
  6353. //>>excludeEnd("ctx");
  6354. return $recv(nextLF).__lt(nextCR);
  6355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6356. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6357. //>>excludeEnd("ctx");
  6358. }));
  6359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6360. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6361. //>>excludeEnd("ctx");
  6362. }));
  6363. if($core.assert($3)){
  6364. $6=start;
  6365. $7=$recv(nextLF).__minus((1));
  6366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6367. $ctx2.sendIdx["-"]=1;
  6368. //>>excludeEnd("ctx");
  6369. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6371. $ctx2.sendIdx["value:value:value:"]=2;
  6372. //>>excludeEnd("ctx");
  6373. start=(1).__plus(nextLF);
  6374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6375. $ctx2.sendIdx["+"]=1;
  6376. //>>excludeEnd("ctx");
  6377. start;
  6378. nextLF=self._indexOf_startingAt_(lf,start);
  6379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6380. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6381. //>>excludeEnd("ctx");
  6382. return nextLF;
  6383. } else {
  6384. $9=(1).__plus(nextCR);
  6385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6386. $ctx2.sendIdx["+"]=2;
  6387. //>>excludeEnd("ctx");
  6388. $8=$recv($9).__eq(nextLF);
  6389. if($core.assert($8)){
  6390. $10=start;
  6391. $11=$recv(nextCR).__minus((1));
  6392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6393. $ctx2.sendIdx["-"]=2;
  6394. //>>excludeEnd("ctx");
  6395. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6397. $ctx2.sendIdx["value:value:value:"]=3;
  6398. //>>excludeEnd("ctx");
  6399. start=(1).__plus(nextLF);
  6400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6401. $ctx2.sendIdx["+"]=3;
  6402. //>>excludeEnd("ctx");
  6403. start;
  6404. nextCR=self._indexOf_startingAt_(cr,start);
  6405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6406. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6407. //>>excludeEnd("ctx");
  6408. nextCR;
  6409. nextLF=self._indexOf_startingAt_(lf,start);
  6410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6411. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6412. //>>excludeEnd("ctx");
  6413. return nextLF;
  6414. } else {
  6415. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6416. start=(1).__plus(nextCR);
  6417. start;
  6418. nextCR=self._indexOf_startingAt_(cr,start);
  6419. return nextCR;
  6420. };
  6421. };
  6422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6424. //>>excludeEnd("ctx");
  6425. }));
  6426. return self;
  6427. }
  6428. catch(e) {if(e===$early)return e[0]; throw e}
  6429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6430. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6431. //>>excludeEnd("ctx");
  6432. },
  6433. //>>excludeStart("ide", pragmas.excludeIdeData);
  6434. args: ["aBlock"],
  6435. 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 ] ]]",
  6436. referencedClasses: ["String"],
  6437. //>>excludeEnd("ide");
  6438. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6439. }),
  6440. $globals.String);
  6441. $core.addMethod(
  6442. $core.method({
  6443. selector: "lineNumber:",
  6444. protocol: 'split join',
  6445. fn: function (anIndex){
  6446. var self=this;
  6447. var lineCount;
  6448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6449. return $core.withContext(function($ctx1) {
  6450. //>>excludeEnd("ctx");
  6451. var $2,$1;
  6452. var $early={};
  6453. try {
  6454. lineCount=(0);
  6455. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6457. return $core.withContext(function($ctx2) {
  6458. //>>excludeEnd("ctx");
  6459. lineCount=$recv(lineCount).__plus((1));
  6460. $2=lineCount;
  6461. $1=$recv($2).__eq(anIndex);
  6462. if($core.assert($1)){
  6463. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  6464. };
  6465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6466. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6467. //>>excludeEnd("ctx");
  6468. }));
  6469. return nil;
  6470. }
  6471. catch(e) {if(e===$early)return e[0]; throw e}
  6472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6473. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6474. //>>excludeEnd("ctx");
  6475. },
  6476. //>>excludeStart("ide", pragmas.excludeIdeData);
  6477. args: ["anIndex"],
  6478. 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",
  6479. referencedClasses: [],
  6480. //>>excludeEnd("ide");
  6481. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6482. }),
  6483. $globals.String);
  6484. $core.addMethod(
  6485. $core.method({
  6486. selector: "lines",
  6487. protocol: 'split join',
  6488. fn: function (){
  6489. var self=this;
  6490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6491. return $core.withContext(function($ctx1) {
  6492. //>>excludeEnd("ctx");
  6493. var result = self.split(/\r\n|\r|\n/);
  6494. if (!result[result.length-1]) result.pop();
  6495. return result;;
  6496. return self;
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6499. //>>excludeEnd("ctx");
  6500. },
  6501. //>>excludeStart("ide", pragmas.excludeIdeData);
  6502. args: [],
  6503. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  6504. referencedClasses: [],
  6505. //>>excludeEnd("ide");
  6506. messageSends: []
  6507. }),
  6508. $globals.String);
  6509. $core.addMethod(
  6510. $core.method({
  6511. selector: "linesDo:",
  6512. protocol: 'split join',
  6513. fn: function (aBlock){
  6514. var self=this;
  6515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6516. return $core.withContext(function($ctx1) {
  6517. //>>excludeEnd("ctx");
  6518. $recv(self._lines())._do_(aBlock);
  6519. return self;
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6522. //>>excludeEnd("ctx");
  6523. },
  6524. //>>excludeStart("ide", pragmas.excludeIdeData);
  6525. args: ["aBlock"],
  6526. 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 lines do: aBlock",
  6527. referencedClasses: [],
  6528. //>>excludeEnd("ide");
  6529. messageSends: ["do:", "lines"]
  6530. }),
  6531. $globals.String);
  6532. $core.addMethod(
  6533. $core.method({
  6534. selector: "match:",
  6535. protocol: 'regular expressions',
  6536. fn: function (aRegexp){
  6537. var self=this;
  6538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6539. return $core.withContext(function($ctx1) {
  6540. //>>excludeEnd("ctx");
  6541. return self.search(aRegexp) != -1;
  6542. return self;
  6543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6544. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6545. //>>excludeEnd("ctx");
  6546. },
  6547. //>>excludeStart("ide", pragmas.excludeIdeData);
  6548. args: ["aRegexp"],
  6549. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  6550. referencedClasses: [],
  6551. //>>excludeEnd("ide");
  6552. messageSends: []
  6553. }),
  6554. $globals.String);
  6555. $core.addMethod(
  6556. $core.method({
  6557. selector: "matchesOf:",
  6558. protocol: 'regular expressions',
  6559. fn: function (aRegularExpression){
  6560. var self=this;
  6561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6562. return $core.withContext(function($ctx1) {
  6563. //>>excludeEnd("ctx");
  6564. return self.match(aRegularExpression);
  6565. return self;
  6566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6567. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6568. //>>excludeEnd("ctx");
  6569. },
  6570. //>>excludeStart("ide", pragmas.excludeIdeData);
  6571. args: ["aRegularExpression"],
  6572. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  6573. referencedClasses: [],
  6574. //>>excludeEnd("ide");
  6575. messageSends: []
  6576. }),
  6577. $globals.String);
  6578. $core.addMethod(
  6579. $core.method({
  6580. selector: "numericallyIndexable",
  6581. protocol: 'private',
  6582. fn: function (){
  6583. var self=this;
  6584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6585. return $core.withContext(function($ctx1) {
  6586. //>>excludeEnd("ctx");
  6587. return String(self);
  6588. return self;
  6589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6590. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6591. //>>excludeEnd("ctx");
  6592. },
  6593. //>>excludeStart("ide", pragmas.excludeIdeData);
  6594. args: [],
  6595. source: "numericallyIndexable\x0a\x09<return String(self)>",
  6596. referencedClasses: [],
  6597. //>>excludeEnd("ide");
  6598. messageSends: []
  6599. }),
  6600. $globals.String);
  6601. $core.addMethod(
  6602. $core.method({
  6603. selector: "printNl",
  6604. protocol: 'printing',
  6605. fn: function (){
  6606. var self=this;
  6607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6608. return $core.withContext(function($ctx1) {
  6609. //>>excludeEnd("ctx");
  6610. console.log(self);
  6611. return self;
  6612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6613. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6614. //>>excludeEnd("ctx");
  6615. },
  6616. //>>excludeStart("ide", pragmas.excludeIdeData);
  6617. args: [],
  6618. source: "printNl\x0a\x09<console.log(self)>",
  6619. referencedClasses: [],
  6620. //>>excludeEnd("ide");
  6621. messageSends: []
  6622. }),
  6623. $globals.String);
  6624. $core.addMethod(
  6625. $core.method({
  6626. selector: "printOn:",
  6627. protocol: 'printing',
  6628. fn: function (aStream){
  6629. var self=this;
  6630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6631. return $core.withContext(function($ctx1) {
  6632. //>>excludeEnd("ctx");
  6633. $recv(aStream)._nextPutAll_("'");
  6634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6635. $ctx1.sendIdx["nextPutAll:"]=1;
  6636. //>>excludeEnd("ctx");
  6637. $recv(aStream)._nextPutAll_(self);
  6638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6639. $ctx1.sendIdx["nextPutAll:"]=2;
  6640. //>>excludeEnd("ctx");
  6641. $recv(aStream)._nextPutAll_("'");
  6642. return self;
  6643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6644. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6645. //>>excludeEnd("ctx");
  6646. },
  6647. //>>excludeStart("ide", pragmas.excludeIdeData);
  6648. args: ["aStream"],
  6649. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  6650. referencedClasses: [],
  6651. //>>excludeEnd("ide");
  6652. messageSends: ["nextPutAll:"]
  6653. }),
  6654. $globals.String);
  6655. $core.addMethod(
  6656. $core.method({
  6657. selector: "replace:with:",
  6658. protocol: 'regular expressions',
  6659. fn: function (aString,anotherString){
  6660. var self=this;
  6661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6662. return $core.withContext(function($ctx1) {
  6663. //>>excludeEnd("ctx");
  6664. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6666. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6667. //>>excludeEnd("ctx");
  6668. },
  6669. //>>excludeStart("ide", pragmas.excludeIdeData);
  6670. args: ["aString", "anotherString"],
  6671. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6672. referencedClasses: ["RegularExpression"],
  6673. //>>excludeEnd("ide");
  6674. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6675. }),
  6676. $globals.String);
  6677. $core.addMethod(
  6678. $core.method({
  6679. selector: "replaceRegexp:with:",
  6680. protocol: 'regular expressions',
  6681. fn: function (aRegexp,aString){
  6682. var self=this;
  6683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6684. return $core.withContext(function($ctx1) {
  6685. //>>excludeEnd("ctx");
  6686. return self.replace(aRegexp, aString);
  6687. return self;
  6688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6689. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6690. //>>excludeEnd("ctx");
  6691. },
  6692. //>>excludeStart("ide", pragmas.excludeIdeData);
  6693. args: ["aRegexp", "aString"],
  6694. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  6695. referencedClasses: [],
  6696. //>>excludeEnd("ide");
  6697. messageSends: []
  6698. }),
  6699. $globals.String);
  6700. $core.addMethod(
  6701. $core.method({
  6702. selector: "reversed",
  6703. protocol: 'converting',
  6704. fn: function (){
  6705. var self=this;
  6706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6707. return $core.withContext(function($ctx1) {
  6708. //>>excludeEnd("ctx");
  6709. return self.split("").reverse().join("");
  6710. return self;
  6711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6712. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6713. //>>excludeEnd("ctx");
  6714. },
  6715. //>>excludeStart("ide", pragmas.excludeIdeData);
  6716. args: [],
  6717. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  6718. referencedClasses: [],
  6719. //>>excludeEnd("ide");
  6720. messageSends: []
  6721. }),
  6722. $globals.String);
  6723. $core.addMethod(
  6724. $core.method({
  6725. selector: "shallowCopy",
  6726. protocol: 'copying',
  6727. fn: function (){
  6728. var self=this;
  6729. return self;
  6730. },
  6731. //>>excludeStart("ide", pragmas.excludeIdeData);
  6732. args: [],
  6733. source: "shallowCopy\x0a\x09^ self",
  6734. referencedClasses: [],
  6735. //>>excludeEnd("ide");
  6736. messageSends: []
  6737. }),
  6738. $globals.String);
  6739. $core.addMethod(
  6740. $core.method({
  6741. selector: "size",
  6742. protocol: 'accessing',
  6743. fn: function (){
  6744. var self=this;
  6745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6746. return $core.withContext(function($ctx1) {
  6747. //>>excludeEnd("ctx");
  6748. return self.length;
  6749. return self;
  6750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6751. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6752. //>>excludeEnd("ctx");
  6753. },
  6754. //>>excludeStart("ide", pragmas.excludeIdeData);
  6755. args: [],
  6756. source: "size\x0a\x09<return self.length>",
  6757. referencedClasses: [],
  6758. //>>excludeEnd("ide");
  6759. messageSends: []
  6760. }),
  6761. $globals.String);
  6762. $core.addMethod(
  6763. $core.method({
  6764. selector: "subStrings:",
  6765. protocol: 'split join',
  6766. fn: function (aString){
  6767. var self=this;
  6768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6769. return $core.withContext(function($ctx1) {
  6770. //>>excludeEnd("ctx");
  6771. return self._tokenize_(aString);
  6772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6773. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6774. //>>excludeEnd("ctx");
  6775. },
  6776. //>>excludeStart("ide", pragmas.excludeIdeData);
  6777. args: ["aString"],
  6778. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6779. referencedClasses: [],
  6780. //>>excludeEnd("ide");
  6781. messageSends: ["tokenize:"]
  6782. }),
  6783. $globals.String);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "tokenize:",
  6787. protocol: 'split join',
  6788. fn: function (aString){
  6789. var self=this;
  6790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6791. return $core.withContext(function($ctx1) {
  6792. //>>excludeEnd("ctx");
  6793. return self.split(aString);
  6794. return self;
  6795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6796. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6797. //>>excludeEnd("ctx");
  6798. },
  6799. //>>excludeStart("ide", pragmas.excludeIdeData);
  6800. args: ["aString"],
  6801. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  6802. referencedClasses: [],
  6803. //>>excludeEnd("ide");
  6804. messageSends: []
  6805. }),
  6806. $globals.String);
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "trimBoth",
  6810. protocol: 'regular expressions',
  6811. fn: function (){
  6812. var self=this;
  6813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6814. return $core.withContext(function($ctx1) {
  6815. //>>excludeEnd("ctx");
  6816. return self._trimBoth_("\x5cs");
  6817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6818. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6819. //>>excludeEnd("ctx");
  6820. },
  6821. //>>excludeStart("ide", pragmas.excludeIdeData);
  6822. args: [],
  6823. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6824. referencedClasses: [],
  6825. //>>excludeEnd("ide");
  6826. messageSends: ["trimBoth:"]
  6827. }),
  6828. $globals.String);
  6829. $core.addMethod(
  6830. $core.method({
  6831. selector: "trimBoth:",
  6832. protocol: 'regular expressions',
  6833. fn: function (separators){
  6834. var self=this;
  6835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6836. return $core.withContext(function($ctx1) {
  6837. //>>excludeEnd("ctx");
  6838. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  6839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6840. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6841. //>>excludeEnd("ctx");
  6842. },
  6843. //>>excludeStart("ide", pragmas.excludeIdeData);
  6844. args: ["separators"],
  6845. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6846. referencedClasses: [],
  6847. //>>excludeEnd("ide");
  6848. messageSends: ["trimRight:", "trimLeft:"]
  6849. }),
  6850. $globals.String);
  6851. $core.addMethod(
  6852. $core.method({
  6853. selector: "trimLeft",
  6854. protocol: 'regular expressions',
  6855. fn: function (){
  6856. var self=this;
  6857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6858. return $core.withContext(function($ctx1) {
  6859. //>>excludeEnd("ctx");
  6860. return self._trimLeft_("\x5cs");
  6861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6862. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6863. //>>excludeEnd("ctx");
  6864. },
  6865. //>>excludeStart("ide", pragmas.excludeIdeData);
  6866. args: [],
  6867. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6868. referencedClasses: [],
  6869. //>>excludeEnd("ide");
  6870. messageSends: ["trimLeft:"]
  6871. }),
  6872. $globals.String);
  6873. $core.addMethod(
  6874. $core.method({
  6875. selector: "trimLeft:",
  6876. protocol: 'regular expressions',
  6877. fn: function (separators){
  6878. var self=this;
  6879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6880. return $core.withContext(function($ctx1) {
  6881. //>>excludeEnd("ctx");
  6882. var $2,$1;
  6883. $2=$recv("^[".__comma(separators)).__comma("]+");
  6884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6885. $ctx1.sendIdx[","]=1;
  6886. //>>excludeEnd("ctx");
  6887. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6888. return self._replaceRegexp_with_($1,"");
  6889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6890. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6891. //>>excludeEnd("ctx");
  6892. },
  6893. //>>excludeStart("ide", pragmas.excludeIdeData);
  6894. args: ["separators"],
  6895. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6896. referencedClasses: ["RegularExpression"],
  6897. //>>excludeEnd("ide");
  6898. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6899. }),
  6900. $globals.String);
  6901. $core.addMethod(
  6902. $core.method({
  6903. selector: "trimRight",
  6904. protocol: 'regular expressions',
  6905. fn: function (){
  6906. var self=this;
  6907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6908. return $core.withContext(function($ctx1) {
  6909. //>>excludeEnd("ctx");
  6910. return self._trimRight_("\x5cs");
  6911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6912. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6913. //>>excludeEnd("ctx");
  6914. },
  6915. //>>excludeStart("ide", pragmas.excludeIdeData);
  6916. args: [],
  6917. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6918. referencedClasses: [],
  6919. //>>excludeEnd("ide");
  6920. messageSends: ["trimRight:"]
  6921. }),
  6922. $globals.String);
  6923. $core.addMethod(
  6924. $core.method({
  6925. selector: "trimRight:",
  6926. protocol: 'regular expressions',
  6927. fn: function (separators){
  6928. var self=this;
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. return $core.withContext(function($ctx1) {
  6931. //>>excludeEnd("ctx");
  6932. var $2,$1;
  6933. $2=$recv("[".__comma(separators)).__comma("]+$");
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. $ctx1.sendIdx[","]=1;
  6936. //>>excludeEnd("ctx");
  6937. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6938. return self._replaceRegexp_with_($1,"");
  6939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6940. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6941. //>>excludeEnd("ctx");
  6942. },
  6943. //>>excludeStart("ide", pragmas.excludeIdeData);
  6944. args: ["separators"],
  6945. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6946. referencedClasses: ["RegularExpression"],
  6947. //>>excludeEnd("ide");
  6948. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6949. }),
  6950. $globals.String);
  6951. $core.addMethod(
  6952. $core.method({
  6953. selector: "unescaped",
  6954. protocol: 'converting',
  6955. fn: function (){
  6956. var self=this;
  6957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6958. return $core.withContext(function($ctx1) {
  6959. //>>excludeEnd("ctx");
  6960. return unescape(self);
  6961. return self;
  6962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6963. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6964. //>>excludeEnd("ctx");
  6965. },
  6966. //>>excludeStart("ide", pragmas.excludeIdeData);
  6967. args: [],
  6968. source: "unescaped\x0a\x09<return unescape(self)>",
  6969. referencedClasses: [],
  6970. //>>excludeEnd("ide");
  6971. messageSends: []
  6972. }),
  6973. $globals.String);
  6974. $core.addMethod(
  6975. $core.method({
  6976. selector: "uriComponentDecoded",
  6977. protocol: 'converting',
  6978. fn: function (){
  6979. var self=this;
  6980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6981. return $core.withContext(function($ctx1) {
  6982. //>>excludeEnd("ctx");
  6983. return decodeURIComponent(self);
  6984. return self;
  6985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6986. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  6987. //>>excludeEnd("ctx");
  6988. },
  6989. //>>excludeStart("ide", pragmas.excludeIdeData);
  6990. args: [],
  6991. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  6992. referencedClasses: [],
  6993. //>>excludeEnd("ide");
  6994. messageSends: []
  6995. }),
  6996. $globals.String);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "uriComponentEncoded",
  7000. protocol: 'converting',
  7001. fn: function (){
  7002. var self=this;
  7003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7004. return $core.withContext(function($ctx1) {
  7005. //>>excludeEnd("ctx");
  7006. return encodeURIComponent(self);
  7007. return self;
  7008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7009. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7010. //>>excludeEnd("ctx");
  7011. },
  7012. //>>excludeStart("ide", pragmas.excludeIdeData);
  7013. args: [],
  7014. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  7015. referencedClasses: [],
  7016. //>>excludeEnd("ide");
  7017. messageSends: []
  7018. }),
  7019. $globals.String);
  7020. $core.addMethod(
  7021. $core.method({
  7022. selector: "uriDecoded",
  7023. protocol: 'converting',
  7024. fn: function (){
  7025. var self=this;
  7026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7027. return $core.withContext(function($ctx1) {
  7028. //>>excludeEnd("ctx");
  7029. return decodeURI(self);
  7030. return self;
  7031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7032. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7033. //>>excludeEnd("ctx");
  7034. },
  7035. //>>excludeStart("ide", pragmas.excludeIdeData);
  7036. args: [],
  7037. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  7038. referencedClasses: [],
  7039. //>>excludeEnd("ide");
  7040. messageSends: []
  7041. }),
  7042. $globals.String);
  7043. $core.addMethod(
  7044. $core.method({
  7045. selector: "uriEncoded",
  7046. protocol: 'converting',
  7047. fn: function (){
  7048. var self=this;
  7049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7050. return $core.withContext(function($ctx1) {
  7051. //>>excludeEnd("ctx");
  7052. return encodeURI(self);
  7053. return self;
  7054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7055. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7056. //>>excludeEnd("ctx");
  7057. },
  7058. //>>excludeStart("ide", pragmas.excludeIdeData);
  7059. args: [],
  7060. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  7061. referencedClasses: [],
  7062. //>>excludeEnd("ide");
  7063. messageSends: []
  7064. }),
  7065. $globals.String);
  7066. $core.addMethod(
  7067. $core.method({
  7068. selector: "value:",
  7069. protocol: 'evaluating',
  7070. fn: function (anObject){
  7071. var self=this;
  7072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7073. return $core.withContext(function($ctx1) {
  7074. //>>excludeEnd("ctx");
  7075. return $recv(anObject)._perform_(self);
  7076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7077. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7078. //>>excludeEnd("ctx");
  7079. },
  7080. //>>excludeStart("ide", pragmas.excludeIdeData);
  7081. args: ["anObject"],
  7082. source: "value: anObject \x0a\x09^ anObject perform: self",
  7083. referencedClasses: [],
  7084. //>>excludeEnd("ide");
  7085. messageSends: ["perform:"]
  7086. }),
  7087. $globals.String);
  7088. $core.addMethod(
  7089. $core.method({
  7090. selector: "cr",
  7091. protocol: 'accessing',
  7092. fn: function (){
  7093. var self=this;
  7094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7095. return $core.withContext(function($ctx1) {
  7096. //>>excludeEnd("ctx");
  7097. return '\r';
  7098. return self;
  7099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7100. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  7101. //>>excludeEnd("ctx");
  7102. },
  7103. //>>excludeStart("ide", pragmas.excludeIdeData);
  7104. args: [],
  7105. source: "cr\x0a\x09<return '\x5cr'>",
  7106. referencedClasses: [],
  7107. //>>excludeEnd("ide");
  7108. messageSends: []
  7109. }),
  7110. $globals.String.klass);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "crlf",
  7114. protocol: 'accessing',
  7115. fn: function (){
  7116. var self=this;
  7117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7118. return $core.withContext(function($ctx1) {
  7119. //>>excludeEnd("ctx");
  7120. return '\r\n';
  7121. return self;
  7122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7123. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  7124. //>>excludeEnd("ctx");
  7125. },
  7126. //>>excludeStart("ide", pragmas.excludeIdeData);
  7127. args: [],
  7128. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  7129. referencedClasses: [],
  7130. //>>excludeEnd("ide");
  7131. messageSends: []
  7132. }),
  7133. $globals.String.klass);
  7134. $core.addMethod(
  7135. $core.method({
  7136. selector: "esc",
  7137. protocol: 'accessing',
  7138. fn: function (){
  7139. var self=this;
  7140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7141. return $core.withContext(function($ctx1) {
  7142. //>>excludeEnd("ctx");
  7143. return self._fromCharCode_((27));
  7144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7145. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  7146. //>>excludeEnd("ctx");
  7147. },
  7148. //>>excludeStart("ide", pragmas.excludeIdeData);
  7149. args: [],
  7150. source: "esc\x0a\x09^ self fromCharCode: 27",
  7151. referencedClasses: [],
  7152. //>>excludeEnd("ide");
  7153. messageSends: ["fromCharCode:"]
  7154. }),
  7155. $globals.String.klass);
  7156. $core.addMethod(
  7157. $core.method({
  7158. selector: "fromCharCode:",
  7159. protocol: 'instance creation',
  7160. fn: function (anInteger){
  7161. var self=this;
  7162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7163. return $core.withContext(function($ctx1) {
  7164. //>>excludeEnd("ctx");
  7165. return String.fromCharCode(anInteger);
  7166. return self;
  7167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7168. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  7169. //>>excludeEnd("ctx");
  7170. },
  7171. //>>excludeStart("ide", pragmas.excludeIdeData);
  7172. args: ["anInteger"],
  7173. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  7174. referencedClasses: [],
  7175. //>>excludeEnd("ide");
  7176. messageSends: []
  7177. }),
  7178. $globals.String.klass);
  7179. $core.addMethod(
  7180. $core.method({
  7181. selector: "fromString:",
  7182. protocol: 'instance creation',
  7183. fn: function (aString){
  7184. var self=this;
  7185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7186. return $core.withContext(function($ctx1) {
  7187. //>>excludeEnd("ctx");
  7188. return String(aString);
  7189. return self;
  7190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7191. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  7192. //>>excludeEnd("ctx");
  7193. },
  7194. //>>excludeStart("ide", pragmas.excludeIdeData);
  7195. args: ["aString"],
  7196. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  7197. referencedClasses: [],
  7198. //>>excludeEnd("ide");
  7199. messageSends: []
  7200. }),
  7201. $globals.String.klass);
  7202. $core.addMethod(
  7203. $core.method({
  7204. selector: "lf",
  7205. protocol: 'accessing',
  7206. fn: function (){
  7207. var self=this;
  7208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7209. return $core.withContext(function($ctx1) {
  7210. //>>excludeEnd("ctx");
  7211. return '\n';
  7212. return self;
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  7215. //>>excludeEnd("ctx");
  7216. },
  7217. //>>excludeStart("ide", pragmas.excludeIdeData);
  7218. args: [],
  7219. source: "lf\x0a\x09<return '\x5cn'>",
  7220. referencedClasses: [],
  7221. //>>excludeEnd("ide");
  7222. messageSends: []
  7223. }),
  7224. $globals.String.klass);
  7225. $core.addMethod(
  7226. $core.method({
  7227. selector: "random",
  7228. protocol: 'random',
  7229. fn: function (){
  7230. var self=this;
  7231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7232. return $core.withContext(function($ctx1) {
  7233. //>>excludeEnd("ctx");
  7234. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7235. return self;
  7236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7237. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  7238. //>>excludeEnd("ctx");
  7239. },
  7240. //>>excludeStart("ide", pragmas.excludeIdeData);
  7241. args: [],
  7242. 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);>",
  7243. referencedClasses: [],
  7244. //>>excludeEnd("ide");
  7245. messageSends: []
  7246. }),
  7247. $globals.String.klass);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "randomNotIn:",
  7251. protocol: 'random',
  7252. fn: function (aString){
  7253. var self=this;
  7254. var result;
  7255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7256. return $core.withContext(function($ctx1) {
  7257. //>>excludeEnd("ctx");
  7258. $recv((function(){
  7259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7260. return $core.withContext(function($ctx2) {
  7261. //>>excludeEnd("ctx");
  7262. result=self._random();
  7263. result;
  7264. return $recv(aString)._includesSubString_(result);
  7265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7267. //>>excludeEnd("ctx");
  7268. }))._whileTrue();
  7269. return result;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  7272. //>>excludeEnd("ctx");
  7273. },
  7274. //>>excludeStart("ide", pragmas.excludeIdeData);
  7275. args: ["aString"],
  7276. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7277. referencedClasses: [],
  7278. //>>excludeEnd("ide");
  7279. messageSends: ["whileTrue", "random", "includesSubString:"]
  7280. }),
  7281. $globals.String.klass);
  7282. $core.addMethod(
  7283. $core.method({
  7284. selector: "space",
  7285. protocol: 'accessing',
  7286. fn: function (){
  7287. var self=this;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. return $core.withContext(function($ctx1) {
  7290. //>>excludeEnd("ctx");
  7291. return ' ';
  7292. return self;
  7293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7294. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  7295. //>>excludeEnd("ctx");
  7296. },
  7297. //>>excludeStart("ide", pragmas.excludeIdeData);
  7298. args: [],
  7299. source: "space\x0a\x09<return ' '>",
  7300. referencedClasses: [],
  7301. //>>excludeEnd("ide");
  7302. messageSends: []
  7303. }),
  7304. $globals.String.klass);
  7305. $core.addMethod(
  7306. $core.method({
  7307. selector: "streamClass",
  7308. protocol: 'accessing',
  7309. fn: function (){
  7310. var self=this;
  7311. return $globals.StringStream;
  7312. },
  7313. //>>excludeStart("ide", pragmas.excludeIdeData);
  7314. args: [],
  7315. source: "streamClass\x0a\x09\x09^ StringStream",
  7316. referencedClasses: ["StringStream"],
  7317. //>>excludeEnd("ide");
  7318. messageSends: []
  7319. }),
  7320. $globals.String.klass);
  7321. $core.addMethod(
  7322. $core.method({
  7323. selector: "tab",
  7324. protocol: 'accessing',
  7325. fn: function (){
  7326. var self=this;
  7327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7328. return $core.withContext(function($ctx1) {
  7329. //>>excludeEnd("ctx");
  7330. return '\t';
  7331. return self;
  7332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7333. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  7334. //>>excludeEnd("ctx");
  7335. },
  7336. //>>excludeStart("ide", pragmas.excludeIdeData);
  7337. args: [],
  7338. source: "tab\x0a\x09<return '\x5ct'>",
  7339. referencedClasses: [],
  7340. //>>excludeEnd("ide");
  7341. messageSends: []
  7342. }),
  7343. $globals.String.klass);
  7344. $core.addMethod(
  7345. $core.method({
  7346. selector: "value:",
  7347. protocol: 'instance creation',
  7348. fn: function (aUTFCharCode){
  7349. var self=this;
  7350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7351. return $core.withContext(function($ctx1) {
  7352. //>>excludeEnd("ctx");
  7353. return String.fromCharCode(aUTFCharCode);;
  7354. return self;
  7355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7356. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  7357. //>>excludeEnd("ctx");
  7358. },
  7359. //>>excludeStart("ide", pragmas.excludeIdeData);
  7360. args: ["aUTFCharCode"],
  7361. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  7362. referencedClasses: [],
  7363. //>>excludeEnd("ide");
  7364. messageSends: []
  7365. }),
  7366. $globals.String.klass);
  7367. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  7368. //>>excludeStart("ide", pragmas.excludeIdeData);
  7369. $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`.";
  7370. //>>excludeEnd("ide");
  7371. $core.addMethod(
  7372. $core.method({
  7373. selector: "=",
  7374. protocol: 'comparing',
  7375. fn: function (aCollection){
  7376. var self=this;
  7377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7378. return $core.withContext(function($ctx1) {
  7379. //>>excludeEnd("ctx");
  7380. var $2,$1,$4,$3,$5;
  7381. var $early={};
  7382. try {
  7383. $2=self._class();
  7384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7385. $ctx1.sendIdx["class"]=1;
  7386. //>>excludeEnd("ctx");
  7387. $1=$recv($2).__eq($recv(aCollection)._class());
  7388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7389. $ctx1.sendIdx["="]=1;
  7390. //>>excludeEnd("ctx");
  7391. if(!$core.assert($1)){
  7392. return false;
  7393. };
  7394. $4=self._size();
  7395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7396. $ctx1.sendIdx["size"]=1;
  7397. //>>excludeEnd("ctx");
  7398. $3=$recv($4).__eq($recv(aCollection)._size());
  7399. if(!$core.assert($3)){
  7400. return false;
  7401. };
  7402. self._do_((function(each){
  7403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7404. return $core.withContext(function($ctx2) {
  7405. //>>excludeEnd("ctx");
  7406. $5=$recv(aCollection)._includes_(each);
  7407. if(!$core.assert($5)){
  7408. throw $early=[false];
  7409. };
  7410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7411. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7412. //>>excludeEnd("ctx");
  7413. }));
  7414. return true;
  7415. }
  7416. catch(e) {if(e===$early)return e[0]; throw e}
  7417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7418. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7419. //>>excludeEnd("ctx");
  7420. },
  7421. //>>excludeStart("ide", pragmas.excludeIdeData);
  7422. args: ["aCollection"],
  7423. 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",
  7424. referencedClasses: [],
  7425. //>>excludeEnd("ide");
  7426. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7427. }),
  7428. $globals.Set);
  7429. $core.addMethod(
  7430. $core.method({
  7431. selector: "add:",
  7432. protocol: 'adding/removing',
  7433. fn: function (anObject){
  7434. var self=this;
  7435. var bucket;
  7436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7437. return $core.withContext(function($ctx1) {
  7438. //>>excludeEnd("ctx");
  7439. var $1,$receiver;
  7440. bucket=self._bucketsOfElement_(anObject);
  7441. $1=$recv(bucket)._second();
  7442. if(($receiver = $1) == null || $receiver.isNil){
  7443. var object,slowBucket;
  7444. object=$recv(bucket)._first();
  7445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7446. $ctx1.sendIdx["first"]=1;
  7447. //>>excludeEnd("ctx");
  7448. object;
  7449. slowBucket=$recv(bucket)._third();
  7450. slowBucket;
  7451. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. return $core.withContext(function($ctx2) {
  7454. //>>excludeEnd("ctx");
  7455. $recv(slowBucket)._add_(object);
  7456. self["@size"]=$recv(self["@size"]).__plus((1));
  7457. return self["@size"];
  7458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7460. //>>excludeEnd("ctx");
  7461. }));
  7462. return object;
  7463. } else {
  7464. var primitiveBucket;
  7465. primitiveBucket=$receiver;
  7466. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  7467. };
  7468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7469. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7470. //>>excludeEnd("ctx");
  7471. },
  7472. //>>excludeStart("ide", pragmas.excludeIdeData);
  7473. args: ["anObject"],
  7474. 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 ]",
  7475. referencedClasses: [],
  7476. //>>excludeEnd("ide");
  7477. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7478. }),
  7479. $globals.Set);
  7480. $core.addMethod(
  7481. $core.method({
  7482. selector: "add:in:",
  7483. protocol: 'private',
  7484. fn: function (anObject,anotherObject){
  7485. var self=this;
  7486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7487. return $core.withContext(function($ctx1) {
  7488. //>>excludeEnd("ctx");
  7489. if (anObject in anotherObject.store) { return false; }
  7490. self['@size']++;
  7491. anotherObject.store[anObject] = true;
  7492. return anObject;
  7493. ;
  7494. return self;
  7495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7496. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7497. //>>excludeEnd("ctx");
  7498. },
  7499. //>>excludeStart("ide", pragmas.excludeIdeData);
  7500. args: ["anObject", "anotherObject"],
  7501. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09>",
  7502. referencedClasses: [],
  7503. //>>excludeEnd("ide");
  7504. messageSends: []
  7505. }),
  7506. $globals.Set);
  7507. $core.addMethod(
  7508. $core.method({
  7509. selector: "bucketsOfElement:",
  7510. protocol: 'private',
  7511. fn: function (anObject){
  7512. var self=this;
  7513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7514. return $core.withContext(function($ctx1) {
  7515. //>>excludeEnd("ctx");
  7516. // include nil to well-known objects under 'boolean' fastBucket
  7517. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  7518. var prim = anObject.valueOf();
  7519. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  7520. var bucket = null;
  7521. self['@slowBucketStores'].some(function (store) {
  7522. return bucket = store._bucketOfElement_(anObject);
  7523. });
  7524. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7525. }
  7526. return [ prim, self['@fastBuckets'][typeof prim] ];
  7527. ;
  7528. return self;
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7531. //>>excludeEnd("ctx");
  7532. },
  7533. //>>excludeStart("ide", pragmas.excludeIdeData);
  7534. args: ["anObject"],
  7535. 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\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !self['@fastBuckets'][typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][typeof prim] ];\x0a\x09>",
  7536. referencedClasses: [],
  7537. //>>excludeEnd("ide");
  7538. messageSends: []
  7539. }),
  7540. $globals.Set);
  7541. $core.addMethod(
  7542. $core.method({
  7543. selector: "classNameOf:",
  7544. protocol: 'private',
  7545. fn: function (anObject){
  7546. var self=this;
  7547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7548. return $core.withContext(function($ctx1) {
  7549. //>>excludeEnd("ctx");
  7550. return anObject.klass != null && anObject.klass.className;
  7551. return self;
  7552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7553. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7554. //>>excludeEnd("ctx");
  7555. },
  7556. //>>excludeStart("ide", pragmas.excludeIdeData);
  7557. args: ["anObject"],
  7558. 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 != null && anObject.klass.className>",
  7559. referencedClasses: [],
  7560. //>>excludeEnd("ide");
  7561. messageSends: []
  7562. }),
  7563. $globals.Set);
  7564. $core.addMethod(
  7565. $core.method({
  7566. selector: "collect:",
  7567. protocol: 'enumerating',
  7568. fn: function (aBlock){
  7569. var self=this;
  7570. var collection;
  7571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7572. return $core.withContext(function($ctx1) {
  7573. //>>excludeEnd("ctx");
  7574. collection=$recv(self._class())._new();
  7575. self._do_((function(each){
  7576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7577. return $core.withContext(function($ctx2) {
  7578. //>>excludeEnd("ctx");
  7579. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7582. //>>excludeEnd("ctx");
  7583. }));
  7584. return collection;
  7585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7586. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7587. //>>excludeEnd("ctx");
  7588. },
  7589. //>>excludeStart("ide", pragmas.excludeIdeData);
  7590. args: ["aBlock"],
  7591. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7592. referencedClasses: [],
  7593. //>>excludeEnd("ide");
  7594. messageSends: ["new", "class", "do:", "add:", "value:"]
  7595. }),
  7596. $globals.Set);
  7597. $core.addMethod(
  7598. $core.method({
  7599. selector: "detect:ifNone:",
  7600. protocol: 'enumerating',
  7601. fn: function (aBlock,anotherBlock){
  7602. var self=this;
  7603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7604. return $core.withContext(function($ctx1) {
  7605. //>>excludeEnd("ctx");
  7606. var $1;
  7607. var $early={};
  7608. try {
  7609. self._do_((function(each){
  7610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7611. return $core.withContext(function($ctx2) {
  7612. //>>excludeEnd("ctx");
  7613. $1=$recv(aBlock)._value_(each);
  7614. if($core.assert($1)){
  7615. throw $early=[each];
  7616. };
  7617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7619. //>>excludeEnd("ctx");
  7620. }));
  7621. return $recv(anotherBlock)._value();
  7622. }
  7623. catch(e) {if(e===$early)return e[0]; throw e}
  7624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7625. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7626. //>>excludeEnd("ctx");
  7627. },
  7628. //>>excludeStart("ide", pragmas.excludeIdeData);
  7629. args: ["aBlock", "anotherBlock"],
  7630. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7631. referencedClasses: [],
  7632. //>>excludeEnd("ide");
  7633. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7634. }),
  7635. $globals.Set);
  7636. $core.addMethod(
  7637. $core.method({
  7638. selector: "do:",
  7639. protocol: 'enumerating',
  7640. fn: function (aBlock){
  7641. var self=this;
  7642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7643. return $core.withContext(function($ctx1) {
  7644. //>>excludeEnd("ctx");
  7645. var el, keys, i;
  7646. el = self['@fastBuckets'];
  7647. keys = Object.keys(el);
  7648. for (i = 0; i < keys.length; ++i) {
  7649. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7650. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7651. else { store._do_(aBlock); }
  7652. }
  7653. el = self['@slowBucketStores'];
  7654. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7655. self['@defaultBucket']._do_(aBlock);
  7656. ;
  7657. return self;
  7658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7659. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7660. //>>excludeEnd("ctx");
  7661. },
  7662. //>>excludeStart("ide", pragmas.excludeIdeData);
  7663. args: ["aBlock"],
  7664. 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>",
  7665. referencedClasses: [],
  7666. //>>excludeEnd("ide");
  7667. messageSends: []
  7668. }),
  7669. $globals.Set);
  7670. $core.addMethod(
  7671. $core.method({
  7672. selector: "includes:",
  7673. protocol: 'testing',
  7674. fn: function (anObject){
  7675. var self=this;
  7676. var bucket;
  7677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7678. return $core.withContext(function($ctx1) {
  7679. //>>excludeEnd("ctx");
  7680. var $1,$2,$3,$receiver;
  7681. bucket=self._bucketsOfElement_(anObject);
  7682. $1=$recv(bucket)._second();
  7683. if(($receiver = $1) == null || $receiver.isNil){
  7684. $2=$recv(bucket)._third();
  7685. $3=$recv(bucket)._first();
  7686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7687. $ctx1.sendIdx["first"]=1;
  7688. //>>excludeEnd("ctx");
  7689. return $recv($2)._includes_($3);
  7690. } else {
  7691. var primitiveBucket;
  7692. primitiveBucket=$receiver;
  7693. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7694. };
  7695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7696. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7697. //>>excludeEnd("ctx");
  7698. },
  7699. //>>excludeStart("ide", pragmas.excludeIdeData);
  7700. args: ["anObject"],
  7701. 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 ]",
  7702. referencedClasses: [],
  7703. //>>excludeEnd("ide");
  7704. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7705. }),
  7706. $globals.Set);
  7707. $core.addMethod(
  7708. $core.method({
  7709. selector: "includes:in:",
  7710. protocol: 'private',
  7711. fn: function (anObject,anotherObject){
  7712. var self=this;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. return $core.withContext(function($ctx1) {
  7715. //>>excludeEnd("ctx");
  7716. return anObject in anotherObject.store;
  7717. return self;
  7718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7719. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7720. //>>excludeEnd("ctx");
  7721. },
  7722. //>>excludeStart("ide", pragmas.excludeIdeData);
  7723. args: ["anObject", "anotherObject"],
  7724. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  7725. referencedClasses: [],
  7726. //>>excludeEnd("ide");
  7727. messageSends: []
  7728. }),
  7729. $globals.Set);
  7730. $core.addMethod(
  7731. $core.method({
  7732. selector: "initialize",
  7733. protocol: 'initialization',
  7734. fn: function (){
  7735. var self=this;
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return $core.withContext(function($ctx1) {
  7738. //>>excludeEnd("ctx");
  7739. (
  7740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7741. $ctx1.supercall = true,
  7742. //>>excludeEnd("ctx");
  7743. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  7744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7745. $ctx1.supercall = false;
  7746. //>>excludeEnd("ctx");;
  7747. self["@defaultBucket"]=[];
  7748. self._initializeSlowBucketStores();
  7749. self._removeAll();
  7750. return self;
  7751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7752. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7753. //>>excludeEnd("ctx");
  7754. },
  7755. //>>excludeStart("ide", pragmas.excludeIdeData);
  7756. args: [],
  7757. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7758. referencedClasses: [],
  7759. //>>excludeEnd("ide");
  7760. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7761. }),
  7762. $globals.Set);
  7763. $core.addMethod(
  7764. $core.method({
  7765. selector: "initializeSlowBucketStores",
  7766. protocol: 'initialization',
  7767. fn: function (){
  7768. var self=this;
  7769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7770. return $core.withContext(function($ctx1) {
  7771. //>>excludeEnd("ctx");
  7772. var $1;
  7773. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7775. return $core.withContext(function($ctx2) {
  7776. //>>excludeEnd("ctx");
  7777. return self._classNameOf_(x);
  7778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7779. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7780. //>>excludeEnd("ctx");
  7781. }));
  7782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7783. $ctx1.sendIdx["hashBlock:"]=1;
  7784. //>>excludeEnd("ctx");
  7785. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. return $core.withContext(function($ctx2) {
  7788. //>>excludeEnd("ctx");
  7789. return self._jsConstructorNameOf_(x);
  7790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7791. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7792. //>>excludeEnd("ctx");
  7793. }))];
  7794. return self;
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7797. //>>excludeEnd("ctx");
  7798. },
  7799. //>>excludeStart("ide", pragmas.excludeIdeData);
  7800. args: [],
  7801. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7802. referencedClasses: ["ArrayBucketStore"],
  7803. //>>excludeEnd("ide");
  7804. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7805. }),
  7806. $globals.Set);
  7807. $core.addMethod(
  7808. $core.method({
  7809. selector: "jsConstructorNameOf:",
  7810. protocol: 'private',
  7811. fn: function (anObject){
  7812. var self=this;
  7813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7814. return $core.withContext(function($ctx1) {
  7815. //>>excludeEnd("ctx");
  7816. return anObject.constructor && anObject.constructor.name;
  7817. return self;
  7818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7819. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7820. //>>excludeEnd("ctx");
  7821. },
  7822. //>>excludeStart("ide", pragmas.excludeIdeData);
  7823. args: ["anObject"],
  7824. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  7825. referencedClasses: [],
  7826. //>>excludeEnd("ide");
  7827. messageSends: []
  7828. }),
  7829. $globals.Set);
  7830. $core.addMethod(
  7831. $core.method({
  7832. selector: "printOn:",
  7833. protocol: 'printing',
  7834. fn: function (aStream){
  7835. var self=this;
  7836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7837. return $core.withContext(function($ctx1) {
  7838. //>>excludeEnd("ctx");
  7839. (
  7840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7841. $ctx1.supercall = true,
  7842. //>>excludeEnd("ctx");
  7843. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  7844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7845. $ctx1.supercall = false;
  7846. //>>excludeEnd("ctx");;
  7847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7848. $ctx1.sendIdx["printOn:"]=1;
  7849. //>>excludeEnd("ctx");
  7850. $recv(aStream)._nextPutAll_(" (");
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. $ctx1.sendIdx["nextPutAll:"]=1;
  7853. //>>excludeEnd("ctx");
  7854. self._do_separatedBy_((function(each){
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. return $core.withContext(function($ctx2) {
  7857. //>>excludeEnd("ctx");
  7858. return $recv(each)._printOn_(aStream);
  7859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7861. //>>excludeEnd("ctx");
  7862. }),(function(){
  7863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7864. return $core.withContext(function($ctx2) {
  7865. //>>excludeEnd("ctx");
  7866. return $recv(aStream)._nextPutAll_(" ");
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. $ctx2.sendIdx["nextPutAll:"]=2;
  7869. //>>excludeEnd("ctx");
  7870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7872. //>>excludeEnd("ctx");
  7873. }));
  7874. $recv(aStream)._nextPutAll_(")");
  7875. return self;
  7876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7877. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7878. //>>excludeEnd("ctx");
  7879. },
  7880. //>>excludeStart("ide", pragmas.excludeIdeData);
  7881. args: ["aStream"],
  7882. 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: ')'",
  7883. referencedClasses: [],
  7884. //>>excludeEnd("ide");
  7885. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7886. }),
  7887. $globals.Set);
  7888. $core.addMethod(
  7889. $core.method({
  7890. selector: "remove:ifAbsent:",
  7891. protocol: 'adding/removing',
  7892. fn: function (anObject,aBlock){
  7893. var self=this;
  7894. var bucket;
  7895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7896. return $core.withContext(function($ctx1) {
  7897. //>>excludeEnd("ctx");
  7898. var $1,$2,$3,$receiver;
  7899. var $early={};
  7900. try {
  7901. bucket=self._bucketsOfElement_(anObject);
  7902. $1=$recv(bucket)._second();
  7903. if(($receiver = $1) == null || $receiver.isNil){
  7904. $2=$recv(bucket)._third();
  7905. $3=$recv(bucket)._first();
  7906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7907. $ctx1.sendIdx["first"]=1;
  7908. //>>excludeEnd("ctx");
  7909. $recv($2)._remove_ifAbsent_($3,(function(){
  7910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7911. return $core.withContext(function($ctx2) {
  7912. //>>excludeEnd("ctx");
  7913. throw $early=[$recv(aBlock)._value()];
  7914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7916. //>>excludeEnd("ctx");
  7917. }));
  7918. self["@size"]=$recv(self["@size"]).__minus((1));
  7919. return self["@size"];
  7920. } else {
  7921. var primitiveBucket;
  7922. primitiveBucket=$receiver;
  7923. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  7924. };
  7925. }
  7926. catch(e) {if(e===$early)return e[0]; throw e}
  7927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7928. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7929. //>>excludeEnd("ctx");
  7930. },
  7931. //>>excludeStart("ide", pragmas.excludeIdeData);
  7932. args: ["anObject", "aBlock"],
  7933. 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 ]",
  7934. referencedClasses: [],
  7935. //>>excludeEnd("ide");
  7936. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  7937. }),
  7938. $globals.Set);
  7939. $core.addMethod(
  7940. $core.method({
  7941. selector: "remove:in:",
  7942. protocol: 'private',
  7943. fn: function (anObject,anotherObject){
  7944. var self=this;
  7945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7946. return $core.withContext(function($ctx1) {
  7947. //>>excludeEnd("ctx");
  7948. if (delete anotherObject.store[anObject]) self['@size']--;
  7949. return self;
  7950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7951. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7952. //>>excludeEnd("ctx");
  7953. },
  7954. //>>excludeStart("ide", pragmas.excludeIdeData);
  7955. args: ["anObject", "anotherObject"],
  7956. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  7957. referencedClasses: [],
  7958. //>>excludeEnd("ide");
  7959. messageSends: []
  7960. }),
  7961. $globals.Set);
  7962. $core.addMethod(
  7963. $core.method({
  7964. selector: "removeAll",
  7965. protocol: 'adding/removing',
  7966. fn: function (){
  7967. var self=this;
  7968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7969. return $core.withContext(function($ctx1) {
  7970. //>>excludeEnd("ctx");
  7971. self['@fastBuckets'] = {
  7972. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  7973. 'number': { store: Object.create(null), fn: Number },
  7974. 'string': { store: Object.create(null) }
  7975. };
  7976. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7977. self['@defaultBucket']._removeAll();
  7978. self['@size'] = 0;
  7979. ;
  7980. return self;
  7981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7982. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7983. //>>excludeEnd("ctx");
  7984. },
  7985. //>>excludeStart("ide", pragmas.excludeIdeData);
  7986. args: [],
  7987. 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>",
  7988. referencedClasses: [],
  7989. //>>excludeEnd("ide");
  7990. messageSends: []
  7991. }),
  7992. $globals.Set);
  7993. $core.addMethod(
  7994. $core.method({
  7995. selector: "select:",
  7996. protocol: 'enumerating',
  7997. fn: function (aBlock){
  7998. var self=this;
  7999. var collection;
  8000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8001. return $core.withContext(function($ctx1) {
  8002. //>>excludeEnd("ctx");
  8003. var $1;
  8004. collection=$recv(self._class())._new();
  8005. self._do_((function(each){
  8006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8007. return $core.withContext(function($ctx2) {
  8008. //>>excludeEnd("ctx");
  8009. $1=$recv(aBlock)._value_(each);
  8010. if($core.assert($1)){
  8011. return $recv(collection)._add_(each);
  8012. };
  8013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8015. //>>excludeEnd("ctx");
  8016. }));
  8017. return collection;
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8020. //>>excludeEnd("ctx");
  8021. },
  8022. //>>excludeStart("ide", pragmas.excludeIdeData);
  8023. args: ["aBlock"],
  8024. 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",
  8025. referencedClasses: [],
  8026. //>>excludeEnd("ide");
  8027. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8028. }),
  8029. $globals.Set);
  8030. $core.addMethod(
  8031. $core.method({
  8032. selector: "size",
  8033. protocol: 'accessing',
  8034. fn: function (){
  8035. var self=this;
  8036. return self["@size"];
  8037. },
  8038. //>>excludeStart("ide", pragmas.excludeIdeData);
  8039. args: [],
  8040. source: "size\x0a\x09^ size",
  8041. referencedClasses: [],
  8042. //>>excludeEnd("ide");
  8043. messageSends: []
  8044. }),
  8045. $globals.Set);
  8046. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  8047. //>>excludeStart("ide", pragmas.excludeIdeData);
  8048. $globals.ProtoStream.comment="I am the abstract base for different accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams modifying the contents.";
  8049. //>>excludeEnd("ide");
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "<<",
  8053. protocol: 'writing',
  8054. fn: function (anObject){
  8055. var self=this;
  8056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8057. return $core.withContext(function($ctx1) {
  8058. //>>excludeEnd("ctx");
  8059. self._write_(anObject);
  8060. return self;
  8061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8062. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8063. //>>excludeEnd("ctx");
  8064. },
  8065. //>>excludeStart("ide", pragmas.excludeIdeData);
  8066. args: ["anObject"],
  8067. source: "<< anObject\x0a\x09self write: anObject",
  8068. referencedClasses: [],
  8069. //>>excludeEnd("ide");
  8070. messageSends: ["write:"]
  8071. }),
  8072. $globals.ProtoStream);
  8073. $core.addMethod(
  8074. $core.method({
  8075. selector: "atEnd",
  8076. protocol: 'testing',
  8077. fn: function (){
  8078. var self=this;
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. return $core.withContext(function($ctx1) {
  8081. //>>excludeEnd("ctx");
  8082. self._subclassResponsibility();
  8083. return self;
  8084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8085. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8086. //>>excludeEnd("ctx");
  8087. },
  8088. //>>excludeStart("ide", pragmas.excludeIdeData);
  8089. args: [],
  8090. source: "atEnd\x0a\x09self subclassResponsibility",
  8091. referencedClasses: [],
  8092. //>>excludeEnd("ide");
  8093. messageSends: ["subclassResponsibility"]
  8094. }),
  8095. $globals.ProtoStream);
  8096. $core.addMethod(
  8097. $core.method({
  8098. selector: "atStart",
  8099. protocol: 'testing',
  8100. fn: function (){
  8101. var self=this;
  8102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8103. return $core.withContext(function($ctx1) {
  8104. //>>excludeEnd("ctx");
  8105. self._subclassResponsibility();
  8106. return self;
  8107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8108. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8109. //>>excludeEnd("ctx");
  8110. },
  8111. //>>excludeStart("ide", pragmas.excludeIdeData);
  8112. args: [],
  8113. source: "atStart\x0a\x09self subclassResponsibility",
  8114. referencedClasses: [],
  8115. //>>excludeEnd("ide");
  8116. messageSends: ["subclassResponsibility"]
  8117. }),
  8118. $globals.ProtoStream);
  8119. $core.addMethod(
  8120. $core.method({
  8121. selector: "contents",
  8122. protocol: 'accessing',
  8123. fn: function (){
  8124. var self=this;
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. return $core.withContext(function($ctx1) {
  8127. //>>excludeEnd("ctx");
  8128. self._subclassResponsibility();
  8129. return self;
  8130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8131. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8132. //>>excludeEnd("ctx");
  8133. },
  8134. //>>excludeStart("ide", pragmas.excludeIdeData);
  8135. args: [],
  8136. source: "contents\x0a\x09self subclassResponsibility",
  8137. referencedClasses: [],
  8138. //>>excludeEnd("ide");
  8139. messageSends: ["subclassResponsibility"]
  8140. }),
  8141. $globals.ProtoStream);
  8142. $core.addMethod(
  8143. $core.method({
  8144. selector: "do:",
  8145. protocol: 'enumerating',
  8146. fn: function (aBlock){
  8147. var self=this;
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. return $core.withContext(function($ctx1) {
  8150. //>>excludeEnd("ctx");
  8151. $recv((function(){
  8152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8153. return $core.withContext(function($ctx2) {
  8154. //>>excludeEnd("ctx");
  8155. return self._atEnd();
  8156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8158. //>>excludeEnd("ctx");
  8159. }))._whileFalse_((function(){
  8160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8161. return $core.withContext(function($ctx2) {
  8162. //>>excludeEnd("ctx");
  8163. return $recv(aBlock)._value_(self._next());
  8164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8166. //>>excludeEnd("ctx");
  8167. }));
  8168. return self;
  8169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8170. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8171. //>>excludeEnd("ctx");
  8172. },
  8173. //>>excludeStart("ide", pragmas.excludeIdeData);
  8174. args: ["aBlock"],
  8175. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8176. referencedClasses: [],
  8177. //>>excludeEnd("ide");
  8178. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8179. }),
  8180. $globals.ProtoStream);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "isEmpty",
  8184. protocol: 'testing',
  8185. fn: function (){
  8186. var self=this;
  8187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8188. return $core.withContext(function($ctx1) {
  8189. //>>excludeEnd("ctx");
  8190. return $recv(self._atStart())._and_((function(){
  8191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8192. return $core.withContext(function($ctx2) {
  8193. //>>excludeEnd("ctx");
  8194. return self._atEnd();
  8195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8197. //>>excludeEnd("ctx");
  8198. }));
  8199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8200. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8201. //>>excludeEnd("ctx");
  8202. },
  8203. //>>excludeStart("ide", pragmas.excludeIdeData);
  8204. args: [],
  8205. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8206. referencedClasses: [],
  8207. //>>excludeEnd("ide");
  8208. messageSends: ["and:", "atStart", "atEnd"]
  8209. }),
  8210. $globals.ProtoStream);
  8211. $core.addMethod(
  8212. $core.method({
  8213. selector: "next",
  8214. protocol: 'reading',
  8215. fn: function (){
  8216. var self=this;
  8217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8218. return $core.withContext(function($ctx1) {
  8219. //>>excludeEnd("ctx");
  8220. var $1;
  8221. $1=self._atEnd();
  8222. if($core.assert($1)){
  8223. return nil;
  8224. } else {
  8225. return self._subclassResponsibility();
  8226. };
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8229. //>>excludeEnd("ctx");
  8230. },
  8231. //>>excludeStart("ide", pragmas.excludeIdeData);
  8232. args: [],
  8233. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8234. referencedClasses: [],
  8235. //>>excludeEnd("ide");
  8236. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8237. }),
  8238. $globals.ProtoStream);
  8239. $core.addMethod(
  8240. $core.method({
  8241. selector: "nextPut:",
  8242. protocol: 'writing',
  8243. fn: function (anObject){
  8244. var self=this;
  8245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8246. return $core.withContext(function($ctx1) {
  8247. //>>excludeEnd("ctx");
  8248. self._subclassResponsibility();
  8249. return self;
  8250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8251. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8252. //>>excludeEnd("ctx");
  8253. },
  8254. //>>excludeStart("ide", pragmas.excludeIdeData);
  8255. args: ["anObject"],
  8256. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8257. referencedClasses: [],
  8258. //>>excludeEnd("ide");
  8259. messageSends: ["subclassResponsibility"]
  8260. }),
  8261. $globals.ProtoStream);
  8262. $core.addMethod(
  8263. $core.method({
  8264. selector: "nextPutAll:",
  8265. protocol: 'writing',
  8266. fn: function (aCollection){
  8267. var self=this;
  8268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8269. return $core.withContext(function($ctx1) {
  8270. //>>excludeEnd("ctx");
  8271. $recv(aCollection)._do_((function(each){
  8272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8273. return $core.withContext(function($ctx2) {
  8274. //>>excludeEnd("ctx");
  8275. return self._nextPut_(each);
  8276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8277. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8278. //>>excludeEnd("ctx");
  8279. }));
  8280. return self;
  8281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8282. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8283. //>>excludeEnd("ctx");
  8284. },
  8285. //>>excludeStart("ide", pragmas.excludeIdeData);
  8286. args: ["aCollection"],
  8287. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8288. referencedClasses: [],
  8289. //>>excludeEnd("ide");
  8290. messageSends: ["do:", "nextPut:"]
  8291. }),
  8292. $globals.ProtoStream);
  8293. $core.addMethod(
  8294. $core.method({
  8295. selector: "nextPutJSObject:",
  8296. protocol: 'writing',
  8297. fn: function (aJSObject){
  8298. var self=this;
  8299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8300. return $core.withContext(function($ctx1) {
  8301. //>>excludeEnd("ctx");
  8302. self._nextPut_(aJSObject);
  8303. return self;
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  8306. //>>excludeEnd("ctx");
  8307. },
  8308. //>>excludeStart("ide", pragmas.excludeIdeData);
  8309. args: ["aJSObject"],
  8310. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  8311. referencedClasses: [],
  8312. //>>excludeEnd("ide");
  8313. messageSends: ["nextPut:"]
  8314. }),
  8315. $globals.ProtoStream);
  8316. $core.addMethod(
  8317. $core.method({
  8318. selector: "nextPutString:",
  8319. protocol: 'writing',
  8320. fn: function (aString){
  8321. var self=this;
  8322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8323. return $core.withContext(function($ctx1) {
  8324. //>>excludeEnd("ctx");
  8325. self._nextPut_(aString);
  8326. return self;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8329. //>>excludeEnd("ctx");
  8330. },
  8331. //>>excludeStart("ide", pragmas.excludeIdeData);
  8332. args: ["aString"],
  8333. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8334. referencedClasses: [],
  8335. //>>excludeEnd("ide");
  8336. messageSends: ["nextPut:"]
  8337. }),
  8338. $globals.ProtoStream);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "peek",
  8342. protocol: 'reading',
  8343. fn: function (){
  8344. var self=this;
  8345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8346. return $core.withContext(function($ctx1) {
  8347. //>>excludeEnd("ctx");
  8348. var $1;
  8349. $1=self._atEnd();
  8350. if($core.assert($1)){
  8351. return nil;
  8352. } else {
  8353. return self._subclassResponsibility();
  8354. };
  8355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8356. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8357. //>>excludeEnd("ctx");
  8358. },
  8359. //>>excludeStart("ide", pragmas.excludeIdeData);
  8360. args: [],
  8361. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8362. referencedClasses: [],
  8363. //>>excludeEnd("ide");
  8364. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8365. }),
  8366. $globals.ProtoStream);
  8367. $core.addMethod(
  8368. $core.method({
  8369. selector: "reset",
  8370. protocol: 'actions',
  8371. fn: function (){
  8372. var self=this;
  8373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8374. return $core.withContext(function($ctx1) {
  8375. //>>excludeEnd("ctx");
  8376. self._subclassResponsibility();
  8377. return self;
  8378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8379. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8380. //>>excludeEnd("ctx");
  8381. },
  8382. //>>excludeStart("ide", pragmas.excludeIdeData);
  8383. args: [],
  8384. source: "reset\x0a\x09self subclassResponsibility",
  8385. referencedClasses: [],
  8386. //>>excludeEnd("ide");
  8387. messageSends: ["subclassResponsibility"]
  8388. }),
  8389. $globals.ProtoStream);
  8390. $core.addMethod(
  8391. $core.method({
  8392. selector: "resetContents",
  8393. protocol: 'actions',
  8394. fn: function (){
  8395. var self=this;
  8396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8397. return $core.withContext(function($ctx1) {
  8398. //>>excludeEnd("ctx");
  8399. self._subclassResponsibility();
  8400. return self;
  8401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8402. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8403. //>>excludeEnd("ctx");
  8404. },
  8405. //>>excludeStart("ide", pragmas.excludeIdeData);
  8406. args: [],
  8407. source: "resetContents\x0a\x09self subclassResponsibility",
  8408. referencedClasses: [],
  8409. //>>excludeEnd("ide");
  8410. messageSends: ["subclassResponsibility"]
  8411. }),
  8412. $globals.ProtoStream);
  8413. $core.addMethod(
  8414. $core.method({
  8415. selector: "setToEnd",
  8416. protocol: 'positioning',
  8417. fn: function (){
  8418. var self=this;
  8419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8420. return $core.withContext(function($ctx1) {
  8421. //>>excludeEnd("ctx");
  8422. self._subclassResponsibility();
  8423. return self;
  8424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8425. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8426. //>>excludeEnd("ctx");
  8427. },
  8428. //>>excludeStart("ide", pragmas.excludeIdeData);
  8429. args: [],
  8430. source: "setToEnd\x0a\x09self subclassResponsibility",
  8431. referencedClasses: [],
  8432. //>>excludeEnd("ide");
  8433. messageSends: ["subclassResponsibility"]
  8434. }),
  8435. $globals.ProtoStream);
  8436. $core.addMethod(
  8437. $core.method({
  8438. selector: "setToStart",
  8439. protocol: 'positioning',
  8440. fn: function (){
  8441. var self=this;
  8442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8443. return $core.withContext(function($ctx1) {
  8444. //>>excludeEnd("ctx");
  8445. self._reset();
  8446. return self;
  8447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8448. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8449. //>>excludeEnd("ctx");
  8450. },
  8451. //>>excludeStart("ide", pragmas.excludeIdeData);
  8452. args: [],
  8453. source: "setToStart\x0a\x09self reset",
  8454. referencedClasses: [],
  8455. //>>excludeEnd("ide");
  8456. messageSends: ["reset"]
  8457. }),
  8458. $globals.ProtoStream);
  8459. $core.addMethod(
  8460. $core.method({
  8461. selector: "write:",
  8462. protocol: 'writing',
  8463. fn: function (anObject){
  8464. var self=this;
  8465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8466. return $core.withContext(function($ctx1) {
  8467. //>>excludeEnd("ctx");
  8468. $recv(anObject)._putOn_(self);
  8469. return self;
  8470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8471. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8472. //>>excludeEnd("ctx");
  8473. },
  8474. //>>excludeStart("ide", pragmas.excludeIdeData);
  8475. args: ["anObject"],
  8476. source: "write: anObject\x0a\x09anObject putOn: self",
  8477. referencedClasses: [],
  8478. //>>excludeEnd("ide");
  8479. messageSends: ["putOn:"]
  8480. }),
  8481. $globals.ProtoStream);
  8482. $core.addMethod(
  8483. $core.method({
  8484. selector: "on:",
  8485. protocol: 'instance creation',
  8486. fn: function (aCollection){
  8487. var self=this;
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. return $core.withContext(function($ctx1) {
  8490. //>>excludeEnd("ctx");
  8491. var $1;
  8492. $1=self._new();
  8493. $recv($1)._setCollection_(aCollection);
  8494. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8495. return $recv($1)._yourself();
  8496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8497. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  8498. //>>excludeEnd("ctx");
  8499. },
  8500. //>>excludeStart("ide", pragmas.excludeIdeData);
  8501. args: ["aCollection"],
  8502. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8503. referencedClasses: [],
  8504. //>>excludeEnd("ide");
  8505. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8506. }),
  8507. $globals.ProtoStream.klass);
  8508. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  8509. //>>excludeStart("ide", pragmas.excludeIdeData);
  8510. $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.";
  8511. //>>excludeEnd("ide");
  8512. $core.addMethod(
  8513. $core.method({
  8514. selector: "atEnd",
  8515. protocol: 'testing',
  8516. fn: function (){
  8517. var self=this;
  8518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8519. return $core.withContext(function($ctx1) {
  8520. //>>excludeEnd("ctx");
  8521. return $recv(self._position()).__eq(self._size());
  8522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8523. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8524. //>>excludeEnd("ctx");
  8525. },
  8526. //>>excludeStart("ide", pragmas.excludeIdeData);
  8527. args: [],
  8528. source: "atEnd\x0a\x09^ self position = self size",
  8529. referencedClasses: [],
  8530. //>>excludeEnd("ide");
  8531. messageSends: ["=", "position", "size"]
  8532. }),
  8533. $globals.Stream);
  8534. $core.addMethod(
  8535. $core.method({
  8536. selector: "atStart",
  8537. protocol: 'testing',
  8538. fn: function (){
  8539. var self=this;
  8540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8541. return $core.withContext(function($ctx1) {
  8542. //>>excludeEnd("ctx");
  8543. return $recv(self._position()).__eq((0));
  8544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8545. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8546. //>>excludeEnd("ctx");
  8547. },
  8548. //>>excludeStart("ide", pragmas.excludeIdeData);
  8549. args: [],
  8550. source: "atStart\x0a\x09^ self position = 0",
  8551. referencedClasses: [],
  8552. //>>excludeEnd("ide");
  8553. messageSends: ["=", "position"]
  8554. }),
  8555. $globals.Stream);
  8556. $core.addMethod(
  8557. $core.method({
  8558. selector: "close",
  8559. protocol: 'actions',
  8560. fn: function (){
  8561. var self=this;
  8562. return self;
  8563. },
  8564. //>>excludeStart("ide", pragmas.excludeIdeData);
  8565. args: [],
  8566. source: "close",
  8567. referencedClasses: [],
  8568. //>>excludeEnd("ide");
  8569. messageSends: []
  8570. }),
  8571. $globals.Stream);
  8572. $core.addMethod(
  8573. $core.method({
  8574. selector: "collection",
  8575. protocol: 'accessing',
  8576. fn: function (){
  8577. var self=this;
  8578. return self["@collection"];
  8579. },
  8580. //>>excludeStart("ide", pragmas.excludeIdeData);
  8581. args: [],
  8582. source: "collection\x0a\x09^ collection",
  8583. referencedClasses: [],
  8584. //>>excludeEnd("ide");
  8585. messageSends: []
  8586. }),
  8587. $globals.Stream);
  8588. $core.addMethod(
  8589. $core.method({
  8590. selector: "contents",
  8591. protocol: 'accessing',
  8592. fn: function (){
  8593. var self=this;
  8594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8595. return $core.withContext(function($ctx1) {
  8596. //>>excludeEnd("ctx");
  8597. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  8598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8599. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8600. //>>excludeEnd("ctx");
  8601. },
  8602. //>>excludeStart("ide", pragmas.excludeIdeData);
  8603. args: [],
  8604. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8605. referencedClasses: [],
  8606. //>>excludeEnd("ide");
  8607. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8608. }),
  8609. $globals.Stream);
  8610. $core.addMethod(
  8611. $core.method({
  8612. selector: "flush",
  8613. protocol: 'actions',
  8614. fn: function (){
  8615. var self=this;
  8616. return self;
  8617. },
  8618. //>>excludeStart("ide", pragmas.excludeIdeData);
  8619. args: [],
  8620. source: "flush",
  8621. referencedClasses: [],
  8622. //>>excludeEnd("ide");
  8623. messageSends: []
  8624. }),
  8625. $globals.Stream);
  8626. $core.addMethod(
  8627. $core.method({
  8628. selector: "isEmpty",
  8629. protocol: 'testing',
  8630. fn: function (){
  8631. var self=this;
  8632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8633. return $core.withContext(function($ctx1) {
  8634. //>>excludeEnd("ctx");
  8635. return $recv(self._size()).__eq((0));
  8636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8637. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8638. //>>excludeEnd("ctx");
  8639. },
  8640. //>>excludeStart("ide", pragmas.excludeIdeData);
  8641. args: [],
  8642. source: "isEmpty\x0a\x09^ self size = 0",
  8643. referencedClasses: [],
  8644. //>>excludeEnd("ide");
  8645. messageSends: ["=", "size"]
  8646. }),
  8647. $globals.Stream);
  8648. $core.addMethod(
  8649. $core.method({
  8650. selector: "next",
  8651. protocol: 'reading',
  8652. fn: function (){
  8653. var self=this;
  8654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8655. return $core.withContext(function($ctx1) {
  8656. //>>excludeEnd("ctx");
  8657. var $1,$3,$2;
  8658. $1=self._atEnd();
  8659. if($core.assert($1)){
  8660. return nil;
  8661. } else {
  8662. $3=self._position();
  8663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8664. $ctx1.sendIdx["position"]=1;
  8665. //>>excludeEnd("ctx");
  8666. $2=$recv($3).__plus((1));
  8667. self._position_($2);
  8668. return $recv(self["@collection"])._at_(self._position());
  8669. };
  8670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8671. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8672. //>>excludeEnd("ctx");
  8673. },
  8674. //>>excludeStart("ide", pragmas.excludeIdeData);
  8675. args: [],
  8676. 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 ]",
  8677. referencedClasses: [],
  8678. //>>excludeEnd("ide");
  8679. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8680. }),
  8681. $globals.Stream);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "next:",
  8685. protocol: 'reading',
  8686. fn: function (anInteger){
  8687. var self=this;
  8688. var tempCollection;
  8689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8690. return $core.withContext(function($ctx1) {
  8691. //>>excludeEnd("ctx");
  8692. var $1;
  8693. tempCollection=$recv($recv(self._collection())._class())._new();
  8694. $recv(anInteger)._timesRepeat_((function(){
  8695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8696. return $core.withContext(function($ctx2) {
  8697. //>>excludeEnd("ctx");
  8698. $1=self._atEnd();
  8699. if(!$core.assert($1)){
  8700. return $recv(tempCollection)._add_(self._next());
  8701. };
  8702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8704. //>>excludeEnd("ctx");
  8705. }));
  8706. return tempCollection;
  8707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8708. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8709. //>>excludeEnd("ctx");
  8710. },
  8711. //>>excludeStart("ide", pragmas.excludeIdeData);
  8712. args: ["anInteger"],
  8713. 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",
  8714. referencedClasses: [],
  8715. //>>excludeEnd("ide");
  8716. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8717. }),
  8718. $globals.Stream);
  8719. $core.addMethod(
  8720. $core.method({
  8721. selector: "nextPut:",
  8722. protocol: 'writing',
  8723. fn: function (anObject){
  8724. var self=this;
  8725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8726. return $core.withContext(function($ctx1) {
  8727. //>>excludeEnd("ctx");
  8728. var $2,$1,$3,$4;
  8729. $2=self._position();
  8730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8731. $ctx1.sendIdx["position"]=1;
  8732. //>>excludeEnd("ctx");
  8733. $1=$recv($2).__plus((1));
  8734. self._position_($1);
  8735. $3=self._collection();
  8736. $4=self._position();
  8737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8738. $ctx1.sendIdx["position"]=2;
  8739. //>>excludeEnd("ctx");
  8740. $recv($3)._at_put_($4,anObject);
  8741. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  8742. return self;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8745. //>>excludeEnd("ctx");
  8746. },
  8747. //>>excludeStart("ide", pragmas.excludeIdeData);
  8748. args: ["anObject"],
  8749. 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)",
  8750. referencedClasses: [],
  8751. //>>excludeEnd("ide");
  8752. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8753. }),
  8754. $globals.Stream);
  8755. $core.addMethod(
  8756. $core.method({
  8757. selector: "peek",
  8758. protocol: 'reading',
  8759. fn: function (){
  8760. var self=this;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. return $core.withContext(function($ctx1) {
  8763. //>>excludeEnd("ctx");
  8764. var $1;
  8765. $1=self._atEnd();
  8766. if(!$core.assert($1)){
  8767. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  8768. };
  8769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8770. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8771. //>>excludeEnd("ctx");
  8772. },
  8773. //>>excludeStart("ide", pragmas.excludeIdeData);
  8774. args: [],
  8775. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8776. referencedClasses: [],
  8777. //>>excludeEnd("ide");
  8778. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8779. }),
  8780. $globals.Stream);
  8781. $core.addMethod(
  8782. $core.method({
  8783. selector: "position",
  8784. protocol: 'accessing',
  8785. fn: function (){
  8786. var self=this;
  8787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8788. return $core.withContext(function($ctx1) {
  8789. //>>excludeEnd("ctx");
  8790. var $1,$receiver;
  8791. $1=self["@position"];
  8792. if(($receiver = $1) == null || $receiver.isNil){
  8793. self["@position"]=(0);
  8794. return self["@position"];
  8795. } else {
  8796. return $1;
  8797. };
  8798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8799. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8800. //>>excludeEnd("ctx");
  8801. },
  8802. //>>excludeStart("ide", pragmas.excludeIdeData);
  8803. args: [],
  8804. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8805. referencedClasses: [],
  8806. //>>excludeEnd("ide");
  8807. messageSends: ["ifNil:"]
  8808. }),
  8809. $globals.Stream);
  8810. $core.addMethod(
  8811. $core.method({
  8812. selector: "position:",
  8813. protocol: 'accessing',
  8814. fn: function (anInteger){
  8815. var self=this;
  8816. self["@position"]=anInteger;
  8817. return self;
  8818. },
  8819. //>>excludeStart("ide", pragmas.excludeIdeData);
  8820. args: ["anInteger"],
  8821. source: "position: anInteger\x0a\x09position := anInteger",
  8822. referencedClasses: [],
  8823. //>>excludeEnd("ide");
  8824. messageSends: []
  8825. }),
  8826. $globals.Stream);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "reset",
  8830. protocol: 'actions',
  8831. fn: function (){
  8832. var self=this;
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. return $core.withContext(function($ctx1) {
  8835. //>>excludeEnd("ctx");
  8836. self._position_((0));
  8837. return self;
  8838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8839. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8840. //>>excludeEnd("ctx");
  8841. },
  8842. //>>excludeStart("ide", pragmas.excludeIdeData);
  8843. args: [],
  8844. source: "reset\x0a\x09self position: 0",
  8845. referencedClasses: [],
  8846. //>>excludeEnd("ide");
  8847. messageSends: ["position:"]
  8848. }),
  8849. $globals.Stream);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "resetContents",
  8853. protocol: 'actions',
  8854. fn: function (){
  8855. var self=this;
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. return $core.withContext(function($ctx1) {
  8858. //>>excludeEnd("ctx");
  8859. self._reset();
  8860. self._setStreamSize_((0));
  8861. return self;
  8862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8863. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8864. //>>excludeEnd("ctx");
  8865. },
  8866. //>>excludeStart("ide", pragmas.excludeIdeData);
  8867. args: [],
  8868. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8869. referencedClasses: [],
  8870. //>>excludeEnd("ide");
  8871. messageSends: ["reset", "setStreamSize:"]
  8872. }),
  8873. $globals.Stream);
  8874. $core.addMethod(
  8875. $core.method({
  8876. selector: "setCollection:",
  8877. protocol: 'accessing',
  8878. fn: function (aCollection){
  8879. var self=this;
  8880. self["@collection"]=aCollection;
  8881. return self;
  8882. },
  8883. //>>excludeStart("ide", pragmas.excludeIdeData);
  8884. args: ["aCollection"],
  8885. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8886. referencedClasses: [],
  8887. //>>excludeEnd("ide");
  8888. messageSends: []
  8889. }),
  8890. $globals.Stream);
  8891. $core.addMethod(
  8892. $core.method({
  8893. selector: "setStreamSize:",
  8894. protocol: 'accessing',
  8895. fn: function (anInteger){
  8896. var self=this;
  8897. self["@streamSize"]=anInteger;
  8898. return self;
  8899. },
  8900. //>>excludeStart("ide", pragmas.excludeIdeData);
  8901. args: ["anInteger"],
  8902. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8903. referencedClasses: [],
  8904. //>>excludeEnd("ide");
  8905. messageSends: []
  8906. }),
  8907. $globals.Stream);
  8908. $core.addMethod(
  8909. $core.method({
  8910. selector: "setToEnd",
  8911. protocol: 'positioning',
  8912. fn: function (){
  8913. var self=this;
  8914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8915. return $core.withContext(function($ctx1) {
  8916. //>>excludeEnd("ctx");
  8917. self._position_(self._size());
  8918. return self;
  8919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8920. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8921. //>>excludeEnd("ctx");
  8922. },
  8923. //>>excludeStart("ide", pragmas.excludeIdeData);
  8924. args: [],
  8925. source: "setToEnd\x0a\x09self position: self size",
  8926. referencedClasses: [],
  8927. //>>excludeEnd("ide");
  8928. messageSends: ["position:", "size"]
  8929. }),
  8930. $globals.Stream);
  8931. $core.addMethod(
  8932. $core.method({
  8933. selector: "size",
  8934. protocol: 'accessing',
  8935. fn: function (){
  8936. var self=this;
  8937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8938. return $core.withContext(function($ctx1) {
  8939. //>>excludeEnd("ctx");
  8940. return self._streamSize();
  8941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8942. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8943. //>>excludeEnd("ctx");
  8944. },
  8945. //>>excludeStart("ide", pragmas.excludeIdeData);
  8946. args: [],
  8947. source: "size\x0a\x09^ self streamSize",
  8948. referencedClasses: [],
  8949. //>>excludeEnd("ide");
  8950. messageSends: ["streamSize"]
  8951. }),
  8952. $globals.Stream);
  8953. $core.addMethod(
  8954. $core.method({
  8955. selector: "skip:",
  8956. protocol: 'positioning',
  8957. fn: function (anInteger){
  8958. var self=this;
  8959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8960. return $core.withContext(function($ctx1) {
  8961. //>>excludeEnd("ctx");
  8962. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  8963. return self;
  8964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8965. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8966. //>>excludeEnd("ctx");
  8967. },
  8968. //>>excludeStart("ide", pragmas.excludeIdeData);
  8969. args: ["anInteger"],
  8970. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8971. referencedClasses: [],
  8972. //>>excludeEnd("ide");
  8973. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8974. }),
  8975. $globals.Stream);
  8976. $core.addMethod(
  8977. $core.method({
  8978. selector: "streamSize",
  8979. protocol: 'accessing',
  8980. fn: function (){
  8981. var self=this;
  8982. return self["@streamSize"];
  8983. },
  8984. //>>excludeStart("ide", pragmas.excludeIdeData);
  8985. args: [],
  8986. source: "streamSize\x0a\x09^ streamSize",
  8987. referencedClasses: [],
  8988. //>>excludeEnd("ide");
  8989. messageSends: []
  8990. }),
  8991. $globals.Stream);
  8992. $core.addMethod(
  8993. $core.method({
  8994. selector: "on:",
  8995. protocol: 'instance creation',
  8996. fn: function (aCollection){
  8997. var self=this;
  8998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8999. return $core.withContext(function($ctx1) {
  9000. //>>excludeEnd("ctx");
  9001. var $1;
  9002. $1=self._new();
  9003. $recv($1)._setCollection_(aCollection);
  9004. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9005. return $recv($1)._yourself();
  9006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9007. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  9008. //>>excludeEnd("ctx");
  9009. },
  9010. //>>excludeStart("ide", pragmas.excludeIdeData);
  9011. args: ["aCollection"],
  9012. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9013. referencedClasses: [],
  9014. //>>excludeEnd("ide");
  9015. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9016. }),
  9017. $globals.Stream.klass);
  9018. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  9019. //>>excludeStart("ide", pragmas.excludeIdeData);
  9020. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9021. //>>excludeEnd("ide");
  9022. $core.addMethod(
  9023. $core.method({
  9024. selector: "cr",
  9025. protocol: 'writing',
  9026. fn: function (){
  9027. var self=this;
  9028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9029. return $core.withContext(function($ctx1) {
  9030. //>>excludeEnd("ctx");
  9031. return self._nextPutAll_($recv($globals.String)._cr());
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9034. //>>excludeEnd("ctx");
  9035. },
  9036. //>>excludeStart("ide", pragmas.excludeIdeData);
  9037. args: [],
  9038. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9039. referencedClasses: ["String"],
  9040. //>>excludeEnd("ide");
  9041. messageSends: ["nextPutAll:", "cr"]
  9042. }),
  9043. $globals.StringStream);
  9044. $core.addMethod(
  9045. $core.method({
  9046. selector: "crlf",
  9047. protocol: 'writing',
  9048. fn: function (){
  9049. var self=this;
  9050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9051. return $core.withContext(function($ctx1) {
  9052. //>>excludeEnd("ctx");
  9053. return self._nextPutAll_($recv($globals.String)._crlf());
  9054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9055. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9056. //>>excludeEnd("ctx");
  9057. },
  9058. //>>excludeStart("ide", pragmas.excludeIdeData);
  9059. args: [],
  9060. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9061. referencedClasses: ["String"],
  9062. //>>excludeEnd("ide");
  9063. messageSends: ["nextPutAll:", "crlf"]
  9064. }),
  9065. $globals.StringStream);
  9066. $core.addMethod(
  9067. $core.method({
  9068. selector: "lf",
  9069. protocol: 'writing',
  9070. fn: function (){
  9071. var self=this;
  9072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9073. return $core.withContext(function($ctx1) {
  9074. //>>excludeEnd("ctx");
  9075. return self._nextPutAll_($recv($globals.String)._lf());
  9076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9077. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9078. //>>excludeEnd("ctx");
  9079. },
  9080. //>>excludeStart("ide", pragmas.excludeIdeData);
  9081. args: [],
  9082. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9083. referencedClasses: ["String"],
  9084. //>>excludeEnd("ide");
  9085. messageSends: ["nextPutAll:", "lf"]
  9086. }),
  9087. $globals.StringStream);
  9088. $core.addMethod(
  9089. $core.method({
  9090. selector: "next:",
  9091. protocol: 'reading',
  9092. fn: function (anInteger){
  9093. var self=this;
  9094. var tempCollection;
  9095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9096. return $core.withContext(function($ctx1) {
  9097. //>>excludeEnd("ctx");
  9098. var $1;
  9099. tempCollection=$recv($recv(self._collection())._class())._new();
  9100. $recv(anInteger)._timesRepeat_((function(){
  9101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9102. return $core.withContext(function($ctx2) {
  9103. //>>excludeEnd("ctx");
  9104. $1=self._atEnd();
  9105. if(!$core.assert($1)){
  9106. tempCollection=$recv(tempCollection).__comma(self._next());
  9107. return tempCollection;
  9108. };
  9109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9111. //>>excludeEnd("ctx");
  9112. }));
  9113. return tempCollection;
  9114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9115. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9116. //>>excludeEnd("ctx");
  9117. },
  9118. //>>excludeStart("ide", pragmas.excludeIdeData);
  9119. args: ["anInteger"],
  9120. 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",
  9121. referencedClasses: [],
  9122. //>>excludeEnd("ide");
  9123. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9124. }),
  9125. $globals.StringStream);
  9126. $core.addMethod(
  9127. $core.method({
  9128. selector: "nextPut:",
  9129. protocol: 'writing',
  9130. fn: function (aString){
  9131. var self=this;
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. return $core.withContext(function($ctx1) {
  9134. //>>excludeEnd("ctx");
  9135. self._nextPutAll_(aString);
  9136. return self;
  9137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9138. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9139. //>>excludeEnd("ctx");
  9140. },
  9141. //>>excludeStart("ide", pragmas.excludeIdeData);
  9142. args: ["aString"],
  9143. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9144. referencedClasses: [],
  9145. //>>excludeEnd("ide");
  9146. messageSends: ["nextPutAll:"]
  9147. }),
  9148. $globals.StringStream);
  9149. $core.addMethod(
  9150. $core.method({
  9151. selector: "nextPutAll:",
  9152. protocol: 'writing',
  9153. fn: function (aString){
  9154. var self=this;
  9155. var pre,post;
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. return $core.withContext(function($ctx1) {
  9158. //>>excludeEnd("ctx");
  9159. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9160. $1=self._atEnd();
  9161. if($core.assert($1)){
  9162. $3=self._collection();
  9163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9164. $ctx1.sendIdx["collection"]=1;
  9165. //>>excludeEnd("ctx");
  9166. $2=$recv($3).__comma(aString);
  9167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9168. $ctx1.sendIdx[","]=1;
  9169. //>>excludeEnd("ctx");
  9170. self._setCollection_($2);
  9171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9172. $ctx1.sendIdx["setCollection:"]=1;
  9173. //>>excludeEnd("ctx");
  9174. } else {
  9175. $4=self._collection();
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. $ctx1.sendIdx["collection"]=2;
  9178. //>>excludeEnd("ctx");
  9179. $5=self._position();
  9180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9181. $ctx1.sendIdx["position"]=1;
  9182. //>>excludeEnd("ctx");
  9183. pre=$recv($4)._copyFrom_to_((1),$5);
  9184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9185. $ctx1.sendIdx["copyFrom:to:"]=1;
  9186. //>>excludeEnd("ctx");
  9187. pre;
  9188. $6=self._collection();
  9189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9190. $ctx1.sendIdx["collection"]=3;
  9191. //>>excludeEnd("ctx");
  9192. $9=self._position();
  9193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9194. $ctx1.sendIdx["position"]=2;
  9195. //>>excludeEnd("ctx");
  9196. $8=$recv($9).__plus((1));
  9197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9198. $ctx1.sendIdx["+"]=2;
  9199. //>>excludeEnd("ctx");
  9200. $10=$recv(aString)._size();
  9201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9202. $ctx1.sendIdx["size"]=1;
  9203. //>>excludeEnd("ctx");
  9204. $7=$recv($8).__plus($10);
  9205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9206. $ctx1.sendIdx["+"]=1;
  9207. //>>excludeEnd("ctx");
  9208. $11=$recv(self._collection())._size();
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. $ctx1.sendIdx["size"]=2;
  9211. //>>excludeEnd("ctx");
  9212. post=$recv($6)._copyFrom_to_($7,$11);
  9213. post;
  9214. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9216. $ctx1.sendIdx[","]=2;
  9217. //>>excludeEnd("ctx");
  9218. self._setCollection_($12);
  9219. };
  9220. $14=self._position();
  9221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9222. $ctx1.sendIdx["position"]=3;
  9223. //>>excludeEnd("ctx");
  9224. $13=$recv($14).__plus($recv(aString)._size());
  9225. self._position_($13);
  9226. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  9227. return self;
  9228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9229. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9230. //>>excludeEnd("ctx");
  9231. },
  9232. //>>excludeStart("ide", pragmas.excludeIdeData);
  9233. args: ["aString"],
  9234. 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)",
  9235. referencedClasses: [],
  9236. //>>excludeEnd("ide");
  9237. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9238. }),
  9239. $globals.StringStream);
  9240. $core.addMethod(
  9241. $core.method({
  9242. selector: "nextPutString:",
  9243. protocol: 'writing',
  9244. fn: function (aString){
  9245. var self=this;
  9246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9247. return $core.withContext(function($ctx1) {
  9248. //>>excludeEnd("ctx");
  9249. self._nextPutAll_(aString);
  9250. return self;
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9253. //>>excludeEnd("ctx");
  9254. },
  9255. //>>excludeStart("ide", pragmas.excludeIdeData);
  9256. args: ["aString"],
  9257. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9258. referencedClasses: [],
  9259. //>>excludeEnd("ide");
  9260. messageSends: ["nextPutAll:"]
  9261. }),
  9262. $globals.StringStream);
  9263. $core.addMethod(
  9264. $core.method({
  9265. selector: "space",
  9266. protocol: 'writing',
  9267. fn: function (){
  9268. var self=this;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. return $core.withContext(function($ctx1) {
  9271. //>>excludeEnd("ctx");
  9272. self._nextPut_(" ");
  9273. return self;
  9274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9275. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9276. //>>excludeEnd("ctx");
  9277. },
  9278. //>>excludeStart("ide", pragmas.excludeIdeData);
  9279. args: [],
  9280. source: "space\x0a\x09self nextPut: ' '",
  9281. referencedClasses: [],
  9282. //>>excludeEnd("ide");
  9283. messageSends: ["nextPut:"]
  9284. }),
  9285. $globals.StringStream);
  9286. $core.addMethod(
  9287. $core.method({
  9288. selector: "tab",
  9289. protocol: 'writing',
  9290. fn: function (){
  9291. var self=this;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. return $core.withContext(function($ctx1) {
  9294. //>>excludeEnd("ctx");
  9295. return self._nextPutAll_($recv($globals.String)._tab());
  9296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9297. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9298. //>>excludeEnd("ctx");
  9299. },
  9300. //>>excludeStart("ide", pragmas.excludeIdeData);
  9301. args: [],
  9302. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9303. referencedClasses: ["String"],
  9304. //>>excludeEnd("ide");
  9305. messageSends: ["nextPutAll:", "tab"]
  9306. }),
  9307. $globals.StringStream);
  9308. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  9309. //>>excludeStart("ide", pragmas.excludeIdeData);
  9310. $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.";
  9311. //>>excludeEnd("ide");
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "initialize",
  9315. protocol: 'initialization',
  9316. fn: function (){
  9317. var self=this;
  9318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9319. return $core.withContext(function($ctx1) {
  9320. //>>excludeEnd("ctx");
  9321. (
  9322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9323. $ctx1.supercall = true,
  9324. //>>excludeEnd("ctx");
  9325. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9327. $ctx1.supercall = false;
  9328. //>>excludeEnd("ctx");;
  9329. self["@read"]=$recv($globals.OrderedCollection)._new();
  9330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9331. $ctx1.sendIdx["new"]=1;
  9332. //>>excludeEnd("ctx");
  9333. self["@write"]=$recv($globals.OrderedCollection)._new();
  9334. self["@readIndex"]=(1);
  9335. return self;
  9336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9337. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9338. //>>excludeEnd("ctx");
  9339. },
  9340. //>>excludeStart("ide", pragmas.excludeIdeData);
  9341. args: [],
  9342. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9343. referencedClasses: ["OrderedCollection"],
  9344. //>>excludeEnd("ide");
  9345. messageSends: ["initialize", "new"]
  9346. }),
  9347. $globals.Queue);
  9348. $core.addMethod(
  9349. $core.method({
  9350. selector: "next",
  9351. protocol: 'accessing',
  9352. fn: function (){
  9353. var self=this;
  9354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9355. return $core.withContext(function($ctx1) {
  9356. //>>excludeEnd("ctx");
  9357. return self._nextIfAbsent_((function(){
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. return $core.withContext(function($ctx2) {
  9360. //>>excludeEnd("ctx");
  9361. return self._error_("Cannot read from empty Queue.");
  9362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9364. //>>excludeEnd("ctx");
  9365. }));
  9366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9367. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9368. //>>excludeEnd("ctx");
  9369. },
  9370. //>>excludeStart("ide", pragmas.excludeIdeData);
  9371. args: [],
  9372. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9373. referencedClasses: [],
  9374. //>>excludeEnd("ide");
  9375. messageSends: ["nextIfAbsent:", "error:"]
  9376. }),
  9377. $globals.Queue);
  9378. $core.addMethod(
  9379. $core.method({
  9380. selector: "nextIfAbsent:",
  9381. protocol: 'accessing',
  9382. fn: function (aBlock){
  9383. var self=this;
  9384. var result;
  9385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9386. return $core.withContext(function($ctx1) {
  9387. //>>excludeEnd("ctx");
  9388. var $1,$2;
  9389. var $early={};
  9390. try {
  9391. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  9392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9393. return $core.withContext(function($ctx2) {
  9394. //>>excludeEnd("ctx");
  9395. $1=$recv(self["@write"])._isEmpty();
  9396. if($core.assert($1)){
  9397. $2=$recv(self["@readIndex"]).__gt((1));
  9398. if($core.assert($2)){
  9399. self["@read"]=[];
  9400. self["@read"];
  9401. self["@readIndex"]=(1);
  9402. self["@readIndex"];
  9403. };
  9404. throw $early=[$recv(aBlock)._value()];
  9405. };
  9406. self["@read"]=self["@write"];
  9407. self["@read"];
  9408. self["@readIndex"]=(1);
  9409. self["@readIndex"];
  9410. self["@write"]=$recv($globals.OrderedCollection)._new();
  9411. self["@write"];
  9412. return $recv(self["@read"])._first();
  9413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9415. //>>excludeEnd("ctx");
  9416. }));
  9417. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  9418. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  9419. return result;
  9420. }
  9421. catch(e) {if(e===$early)return e[0]; throw e}
  9422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9423. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9424. //>>excludeEnd("ctx");
  9425. },
  9426. //>>excludeStart("ide", pragmas.excludeIdeData);
  9427. args: ["aBlock"],
  9428. 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",
  9429. referencedClasses: ["OrderedCollection"],
  9430. //>>excludeEnd("ide");
  9431. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  9432. }),
  9433. $globals.Queue);
  9434. $core.addMethod(
  9435. $core.method({
  9436. selector: "nextPut:",
  9437. protocol: 'accessing',
  9438. fn: function (anObject){
  9439. var self=this;
  9440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9441. return $core.withContext(function($ctx1) {
  9442. //>>excludeEnd("ctx");
  9443. $recv(self["@write"])._add_(anObject);
  9444. return self;
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9447. //>>excludeEnd("ctx");
  9448. },
  9449. //>>excludeStart("ide", pragmas.excludeIdeData);
  9450. args: ["anObject"],
  9451. source: "nextPut: anObject\x0a\x09write add: anObject",
  9452. referencedClasses: [],
  9453. //>>excludeEnd("ide");
  9454. messageSends: ["add:"]
  9455. }),
  9456. $globals.Queue);
  9457. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  9458. //>>excludeStart("ide", pragmas.excludeIdeData);
  9459. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9460. //>>excludeEnd("ide");
  9461. $core.addMethod(
  9462. $core.method({
  9463. selector: "compile:",
  9464. protocol: 'evaluating',
  9465. fn: function (aString){
  9466. var self=this;
  9467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9468. return $core.withContext(function($ctx1) {
  9469. //>>excludeEnd("ctx");
  9470. return self.compile(aString);
  9471. return self;
  9472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9473. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9474. //>>excludeEnd("ctx");
  9475. },
  9476. //>>excludeStart("ide", pragmas.excludeIdeData);
  9477. args: ["aString"],
  9478. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  9479. referencedClasses: [],
  9480. //>>excludeEnd("ide");
  9481. messageSends: []
  9482. }),
  9483. $globals.RegularExpression);
  9484. $core.addMethod(
  9485. $core.method({
  9486. selector: "exec:",
  9487. protocol: 'evaluating',
  9488. fn: function (aString){
  9489. var self=this;
  9490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9491. return $core.withContext(function($ctx1) {
  9492. //>>excludeEnd("ctx");
  9493. return self.exec(aString) || nil;
  9494. return self;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9497. //>>excludeEnd("ctx");
  9498. },
  9499. //>>excludeStart("ide", pragmas.excludeIdeData);
  9500. args: ["aString"],
  9501. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  9502. referencedClasses: [],
  9503. //>>excludeEnd("ide");
  9504. messageSends: []
  9505. }),
  9506. $globals.RegularExpression);
  9507. $core.addMethod(
  9508. $core.method({
  9509. selector: "test:",
  9510. protocol: 'evaluating',
  9511. fn: function (aString){
  9512. var self=this;
  9513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9514. return $core.withContext(function($ctx1) {
  9515. //>>excludeEnd("ctx");
  9516. return self.test(aString);
  9517. return self;
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9520. //>>excludeEnd("ctx");
  9521. },
  9522. //>>excludeStart("ide", pragmas.excludeIdeData);
  9523. args: ["aString"],
  9524. source: "test: aString\x0a\x09<return self.test(aString)>",
  9525. referencedClasses: [],
  9526. //>>excludeEnd("ide");
  9527. messageSends: []
  9528. }),
  9529. $globals.RegularExpression);
  9530. $core.addMethod(
  9531. $core.method({
  9532. selector: "fromString:",
  9533. protocol: 'instance creation',
  9534. fn: function (aString){
  9535. var self=this;
  9536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9537. return $core.withContext(function($ctx1) {
  9538. //>>excludeEnd("ctx");
  9539. return self._fromString_flag_(aString,"");
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  9542. //>>excludeEnd("ctx");
  9543. },
  9544. //>>excludeStart("ide", pragmas.excludeIdeData);
  9545. args: ["aString"],
  9546. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9547. referencedClasses: [],
  9548. //>>excludeEnd("ide");
  9549. messageSends: ["fromString:flag:"]
  9550. }),
  9551. $globals.RegularExpression.klass);
  9552. $core.addMethod(
  9553. $core.method({
  9554. selector: "fromString:flag:",
  9555. protocol: 'instance creation',
  9556. fn: function (aString,anotherString){
  9557. var self=this;
  9558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9559. return $core.withContext(function($ctx1) {
  9560. //>>excludeEnd("ctx");
  9561. return new RegExp(aString, anotherString);
  9562. return self;
  9563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9564. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  9565. //>>excludeEnd("ctx");
  9566. },
  9567. //>>excludeStart("ide", pragmas.excludeIdeData);
  9568. args: ["aString", "anotherString"],
  9569. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  9570. referencedClasses: [],
  9571. //>>excludeEnd("ide");
  9572. messageSends: []
  9573. }),
  9574. $globals.RegularExpression.klass);
  9575. });