Kernel-Collections.js 361 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.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. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. return [$recv([$recv([$self._class()
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. ,$ctx1.sendIdx["class"]=1
  29. //>>excludeEnd("ctx");
  30. ][0]).__eq($recv(anAssociation)._class())
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. ,$ctx1.sendIdx["="]=1
  33. //>>excludeEnd("ctx");
  34. ][0])._and_((function(){
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. return $core.withContext(function($ctx2) {
  37. //>>excludeEnd("ctx");
  38. return $recv([$recv([$self._key()
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. ,$ctx2.sendIdx["key"]=1
  41. //>>excludeEnd("ctx");
  42. ][0]).__eq($recv(anAssociation)._key())
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. ,$ctx2.sendIdx["="]=2
  45. //>>excludeEnd("ctx");
  46. ][0])._and_((function(){
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. return $core.withContext(function($ctx3) {
  49. //>>excludeEnd("ctx");
  50. return $recv([$self._value()
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. ,$ctx3.sendIdx["value"]=1
  53. //>>excludeEnd("ctx");
  54. ][0]).__eq($recv(anAssociation)._value());
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57. //>>excludeEnd("ctx");
  58. }));
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61. //>>excludeEnd("ctx");
  62. }))
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. ,$ctx1.sendIdx["and:"]=1
  65. //>>excludeEnd("ctx");
  66. ][0];
  67. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  69. //>>excludeEnd("ctx");
  70. }; }),
  71. $globals.Association);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "key",
  75. protocol: "accessing",
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "key\x0a\x09^ key",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. pragmas: [],
  82. messageSends: []
  83. }, function ($methodClass){ return function (){
  84. var self=this,$self=this;
  85. return $self.key;
  86. }; }),
  87. $globals.Association);
  88. $core.addMethod(
  89. $core.method({
  90. selector: "key:",
  91. protocol: "accessing",
  92. //>>excludeStart("ide", pragmas.excludeIdeData);
  93. args: ["aKey"],
  94. source: "key: aKey\x0a\x09key := aKey",
  95. referencedClasses: [],
  96. //>>excludeEnd("ide");
  97. pragmas: [],
  98. messageSends: []
  99. }, function ($methodClass){ return function (aKey){
  100. var self=this,$self=this;
  101. $self.key=aKey;
  102. return self;
  103. }; }),
  104. $globals.Association);
  105. $core.addMethod(
  106. $core.method({
  107. selector: "printOn:",
  108. protocol: "printing",
  109. //>>excludeStart("ide", pragmas.excludeIdeData);
  110. args: ["aStream"],
  111. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  112. referencedClasses: [],
  113. //>>excludeEnd("ide");
  114. pragmas: [],
  115. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  116. }, function ($methodClass){ return function (aStream){
  117. var self=this,$self=this;
  118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  119. return $core.withContext(function($ctx1) {
  120. //>>excludeEnd("ctx");
  121. [$recv($self._key())._printOn_(aStream)
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. ,$ctx1.sendIdx["printOn:"]=1
  124. //>>excludeEnd("ctx");
  125. ][0];
  126. $recv(aStream)._nextPutAll_(" -> ");
  127. $recv($self._value())._printOn_(aStream);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: [],
  140. source: "value\x0a\x09^ value",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: []
  145. }, function ($methodClass){ return function (){
  146. var self=this,$self=this;
  147. return $self.value;
  148. }; }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. //>>excludeStart("ide", pragmas.excludeIdeData);
  155. args: ["aValue"],
  156. source: "value: aValue\x0a\x09value := aValue",
  157. referencedClasses: [],
  158. //>>excludeEnd("ide");
  159. pragmas: [],
  160. messageSends: []
  161. }, function ($methodClass){ return function (aValue){
  162. var self=this,$self=this;
  163. $self.value=aValue;
  164. return self;
  165. }; }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["aKey", "aValue"],
  173. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [],
  177. messageSends: ["key:", "new", "value:", "yourself"]
  178. }, function ($methodClass){ return function (aKey,aValue){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. var $1;
  184. $1=$self._new();
  185. $recv($1)._key_(aKey);
  186. $recv($1)._value_(aValue);
  187. return $recv($1)._yourself();
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  190. //>>excludeEnd("ctx");
  191. }; }),
  192. $globals.Association.a$cls);
  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. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. args: ["anObject"],
  203. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\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'>",
  204. referencedClasses: [],
  205. //>>excludeEnd("ide");
  206. pragmas: [["inlineJS:", ["\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"]]],
  207. messageSends: []
  208. }, function ($methodClass){ return function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. }; }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. source: "do: aBlock\x0a\x09<inlineJS: '\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'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. pragmas: [["inlineJS:", ["\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"]]],
  236. messageSends: []
  237. }, function ($methodClass){ return function (aBlock){
  238. var self=this,$self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return $core.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. var buckets = $self.buckets;
  243. var keys = Object.keys(buckets);
  244. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  245. ;
  246. return self;
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  249. //>>excludeEnd("ctx");
  250. }; }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aBlock"],
  258. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: []
  263. }, function ($methodClass){ return function (aBlock){
  264. var self=this,$self=this;
  265. $self.hashBlock=aBlock;
  266. return self;
  267. }; }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. pragmas: [],
  279. messageSends: ["initialize", "removeAll"]
  280. }, function ($methodClass){ return function (){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. [(
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = true,
  288. //>>excludeEnd("ctx");
  289. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. ,$ctx1.supercall = false
  292. //>>excludeEnd("ctx");
  293. ][0];
  294. $self._removeAll();
  295. return self;
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  298. //>>excludeEnd("ctx");
  299. }; }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. //>>excludeStart("ide", pragmas.excludeIdeData);
  306. args: [],
  307. source: "newBucket\x0a\x09self subclassResponsibility",
  308. referencedClasses: [],
  309. //>>excludeEnd("ide");
  310. pragmas: [],
  311. messageSends: ["subclassResponsibility"]
  312. }, function ($methodClass){ return function (){
  313. var self=this,$self=this;
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. return $core.withContext(function($ctx1) {
  316. //>>excludeEnd("ctx");
  317. $self._subclassResponsibility();
  318. return self;
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  321. //>>excludeEnd("ctx");
  322. }; }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. //>>excludeStart("ide", pragmas.excludeIdeData);
  329. args: [],
  330. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  331. referencedClasses: [],
  332. //>>excludeEnd("ide");
  333. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  334. messageSends: []
  335. }, function ($methodClass){ return function (){
  336. var self=this,$self=this;
  337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  338. return $core.withContext(function($ctx1) {
  339. //>>excludeEnd("ctx");
  340. $self.buckets = Object.create(null);;
  341. return self;
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  344. //>>excludeEnd("ctx");
  345. }; }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. //>>excludeStart("ide", pragmas.excludeIdeData);
  352. args: ["aBlock"],
  353. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  354. referencedClasses: [],
  355. //>>excludeEnd("ide");
  356. pragmas: [],
  357. messageSends: ["hashBlock:", "new", "yourself"]
  358. }, function ($methodClass){ return function (aBlock){
  359. var self=this,$self=this;
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. return $core.withContext(function($ctx1) {
  362. //>>excludeEnd("ctx");
  363. var $1;
  364. $1=$self._new();
  365. $recv($1)._hashBlock_(aBlock);
  366. return $recv($1)._yourself();
  367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  368. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  369. //>>excludeEnd("ctx");
  370. }; }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. //>>excludeStart("ide", pragmas.excludeIdeData);
  381. args: [],
  382. source: "newBucket\x0a\x09^ #()",
  383. referencedClasses: [],
  384. //>>excludeEnd("ide");
  385. pragmas: [],
  386. messageSends: []
  387. }, function ($methodClass){ return function (){
  388. var self=this,$self=this;
  389. return [];
  390. }; }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $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.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. //>>excludeStart("ide", pragmas.excludeIdeData);
  401. args: ["aCollection"],
  402. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  403. referencedClasses: [],
  404. //>>excludeEnd("ide");
  405. pragmas: [],
  406. messageSends: ["addAll:", "copy", "yourself"]
  407. }, function ($methodClass){ return function (aCollection){
  408. var self=this,$self=this;
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. return $core.withContext(function($ctx1) {
  411. //>>excludeEnd("ctx");
  412. var $1;
  413. $1=$self._copy();
  414. $recv($1)._addAll_(aCollection);
  415. return $recv($1)._yourself();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  418. //>>excludeEnd("ctx");
  419. }; }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. //>>excludeStart("ide", pragmas.excludeIdeData);
  426. args: ["anObject"],
  427. source: "add: anObject\x0a\x09self subclassResponsibility",
  428. referencedClasses: [],
  429. //>>excludeEnd("ide");
  430. pragmas: [],
  431. messageSends: ["subclassResponsibility"]
  432. }, function ($methodClass){ return function (anObject){
  433. var self=this,$self=this;
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. return $core.withContext(function($ctx1) {
  436. //>>excludeEnd("ctx");
  437. $self._subclassResponsibility();
  438. return self;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  441. //>>excludeEnd("ctx");
  442. }; }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. //>>excludeStart("ide", pragmas.excludeIdeData);
  449. args: ["aCollection"],
  450. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  451. referencedClasses: [],
  452. //>>excludeEnd("ide");
  453. pragmas: [],
  454. messageSends: ["do:", "add:"]
  455. }, function ($methodClass){ return function (aCollection){
  456. var self=this,$self=this;
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. return $core.withContext(function($ctx1) {
  459. //>>excludeEnd("ctx");
  460. $recv(aCollection)._do_((function(each){
  461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  462. return $core.withContext(function($ctx2) {
  463. //>>excludeEnd("ctx");
  464. return $self._add_(each);
  465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  467. //>>excludeEnd("ctx");
  468. }));
  469. return aCollection;
  470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  471. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  472. //>>excludeEnd("ctx");
  473. }; }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. //>>excludeStart("ide", pragmas.excludeIdeData);
  480. args: ["aBlock"],
  481. 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",
  482. referencedClasses: [],
  483. //>>excludeEnd("ide");
  484. pragmas: [],
  485. messageSends: ["do:", "ifFalse:", "value:"]
  486. }, function ($methodClass){ return function (aBlock){
  487. var self=this,$self=this;
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx1) {
  490. //>>excludeEnd("ctx");
  491. var $early={};
  492. try {
  493. $self._do_((function(each){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. if(!$core.assert($recv(aBlock)._value_(each))){
  498. throw $early=[false];
  499. }
  500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  502. //>>excludeEnd("ctx");
  503. }));
  504. return true;
  505. }
  506. catch(e) {if(e===$early)return e[0]; throw e}
  507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  508. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  509. //>>excludeEnd("ctx");
  510. }; }),
  511. $globals.Collection);
  512. $core.addMethod(
  513. $core.method({
  514. selector: "anyOne",
  515. protocol: "accessing",
  516. //>>excludeStart("ide", pragmas.excludeIdeData);
  517. args: [],
  518. 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 ]",
  519. referencedClasses: [],
  520. //>>excludeEnd("ide");
  521. pragmas: [],
  522. messageSends: ["ifEmpty:", "error:", "do:"]
  523. }, function ($methodClass){ return function (){
  524. var self=this,$self=this;
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx1) {
  527. //>>excludeEnd("ctx");
  528. var $early={};
  529. try {
  530. $self._ifEmpty_((function(){
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. return $core.withContext(function($ctx2) {
  533. //>>excludeEnd("ctx");
  534. return $self._error_("Collection is empty");
  535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  537. //>>excludeEnd("ctx");
  538. }));
  539. $self._do_((function(each){
  540. throw $early=[each];
  541. }));
  542. return self;
  543. }
  544. catch(e) {if(e===$early)return e[0]; throw e}
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  547. //>>excludeEnd("ctx");
  548. }; }),
  549. $globals.Collection);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "anySatisfy:",
  553. protocol: "enumerating",
  554. //>>excludeStart("ide", pragmas.excludeIdeData);
  555. args: ["aBlock"],
  556. 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",
  557. referencedClasses: [],
  558. //>>excludeEnd("ide");
  559. pragmas: [],
  560. messageSends: ["do:", "ifTrue:", "value:"]
  561. }, function ($methodClass){ return function (aBlock){
  562. var self=this,$self=this;
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. return $core.withContext(function($ctx1) {
  565. //>>excludeEnd("ctx");
  566. var $early={};
  567. try {
  568. $self._do_((function(each){
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. return $core.withContext(function($ctx2) {
  571. //>>excludeEnd("ctx");
  572. if($core.assert($recv(aBlock)._value_(each))){
  573. throw $early=[true];
  574. }
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  577. //>>excludeEnd("ctx");
  578. }));
  579. return false;
  580. }
  581. catch(e) {if(e===$early)return e[0]; throw e}
  582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  583. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  584. //>>excludeEnd("ctx");
  585. }; }),
  586. $globals.Collection);
  587. $core.addMethod(
  588. $core.method({
  589. selector: "asArray",
  590. protocol: "converting",
  591. //>>excludeStart("ide", pragmas.excludeIdeData);
  592. args: [],
  593. source: "asArray\x0a\x09^ Array withAll: self",
  594. referencedClasses: ["Array"],
  595. //>>excludeEnd("ide");
  596. pragmas: [],
  597. messageSends: ["withAll:"]
  598. }, function ($methodClass){ return function (){
  599. var self=this,$self=this;
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. return $core.withContext(function($ctx1) {
  602. //>>excludeEnd("ctx");
  603. return $recv($globals.Array)._withAll_(self);
  604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  605. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  606. //>>excludeEnd("ctx");
  607. }; }),
  608. $globals.Collection);
  609. $core.addMethod(
  610. $core.method({
  611. selector: "asJavaScriptObject",
  612. protocol: "converting",
  613. //>>excludeStart("ide", pragmas.excludeIdeData);
  614. args: [],
  615. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  616. referencedClasses: [],
  617. //>>excludeEnd("ide");
  618. pragmas: [],
  619. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  620. }, function ($methodClass){ return function (){
  621. var self=this,$self=this;
  622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  623. return $core.withContext(function($ctx1) {
  624. //>>excludeEnd("ctx");
  625. return $recv($self._asArray())._collect_((function(each){
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. return $core.withContext(function($ctx2) {
  628. //>>excludeEnd("ctx");
  629. return $recv(each)._asJavaScriptObject();
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  632. //>>excludeEnd("ctx");
  633. }));
  634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  635. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  636. //>>excludeEnd("ctx");
  637. }; }),
  638. $globals.Collection);
  639. $core.addMethod(
  640. $core.method({
  641. selector: "asOrderedCollection",
  642. protocol: "converting",
  643. //>>excludeStart("ide", pragmas.excludeIdeData);
  644. args: [],
  645. source: "asOrderedCollection\x0a\x09^ self asArray",
  646. referencedClasses: [],
  647. //>>excludeEnd("ide");
  648. pragmas: [],
  649. messageSends: ["asArray"]
  650. }, function ($methodClass){ return function (){
  651. var self=this,$self=this;
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. return $core.withContext(function($ctx1) {
  654. //>>excludeEnd("ctx");
  655. return $self._asArray();
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  658. //>>excludeEnd("ctx");
  659. }; }),
  660. $globals.Collection);
  661. $core.addMethod(
  662. $core.method({
  663. selector: "asSet",
  664. protocol: "converting",
  665. //>>excludeStart("ide", pragmas.excludeIdeData);
  666. args: [],
  667. source: "asSet\x0a\x09^ Set withAll: self",
  668. referencedClasses: ["Set"],
  669. //>>excludeEnd("ide");
  670. pragmas: [],
  671. messageSends: ["withAll:"]
  672. }, function ($methodClass){ return function (){
  673. var self=this,$self=this;
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. return $core.withContext(function($ctx1) {
  676. //>>excludeEnd("ctx");
  677. return $recv($globals.Set)._withAll_(self);
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  680. //>>excludeEnd("ctx");
  681. }; }),
  682. $globals.Collection);
  683. $core.addMethod(
  684. $core.method({
  685. selector: "collect:",
  686. protocol: "enumerating",
  687. //>>excludeStart("ide", pragmas.excludeIdeData);
  688. args: ["aBlock"],
  689. 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",
  690. referencedClasses: [],
  691. //>>excludeEnd("ide");
  692. pragmas: [],
  693. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  694. }, function ($methodClass){ return function (aBlock){
  695. var self=this,$self=this;
  696. var stream;
  697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  698. return $core.withContext(function($ctx1) {
  699. //>>excludeEnd("ctx");
  700. stream=$recv($recv($self._class())._new())._writeStream();
  701. $self._do_((function(each){
  702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  703. return $core.withContext(function($ctx2) {
  704. //>>excludeEnd("ctx");
  705. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  708. //>>excludeEnd("ctx");
  709. }));
  710. return $recv(stream)._contents();
  711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  712. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  713. //>>excludeEnd("ctx");
  714. }; }),
  715. $globals.Collection);
  716. $core.addMethod(
  717. $core.method({
  718. selector: "copyEmpty",
  719. protocol: "copying",
  720. //>>excludeStart("ide", pragmas.excludeIdeData);
  721. args: [],
  722. source: "copyEmpty\x0a\x09^ self class new",
  723. referencedClasses: [],
  724. //>>excludeEnd("ide");
  725. pragmas: [],
  726. messageSends: ["new", "class"]
  727. }, function ($methodClass){ return function (){
  728. var self=this,$self=this;
  729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  730. return $core.withContext(function($ctx1) {
  731. //>>excludeEnd("ctx");
  732. return $recv($self._class())._new();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyEmpty",{})});
  735. //>>excludeEnd("ctx");
  736. }; }),
  737. $globals.Collection);
  738. $core.addMethod(
  739. $core.method({
  740. selector: "copyWith:",
  741. protocol: "copying",
  742. //>>excludeStart("ide", pragmas.excludeIdeData);
  743. args: ["anObject"],
  744. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  745. referencedClasses: [],
  746. //>>excludeEnd("ide");
  747. pragmas: [],
  748. messageSends: ["add:", "copy", "yourself"]
  749. }, function ($methodClass){ return function (anObject){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._add_(anObject);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  760. //>>excludeEnd("ctx");
  761. }; }),
  762. $globals.Collection);
  763. $core.addMethod(
  764. $core.method({
  765. selector: "copyWithAll:",
  766. protocol: "copying",
  767. //>>excludeStart("ide", pragmas.excludeIdeData);
  768. args: ["aCollection"],
  769. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  770. referencedClasses: [],
  771. //>>excludeEnd("ide");
  772. pragmas: [],
  773. messageSends: ["deprecatedAPI:", ","]
  774. }, function ($methodClass){ return function (aCollection){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. $self._deprecatedAPI_("Use #, instead.");
  780. return $self.__comma(aCollection);
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  783. //>>excludeEnd("ctx");
  784. }; }),
  785. $globals.Collection);
  786. $core.addMethod(
  787. $core.method({
  788. selector: "copyWithout:",
  789. protocol: "copying",
  790. //>>excludeStart("ide", pragmas.excludeIdeData);
  791. args: ["anObject"],
  792. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  793. referencedClasses: [],
  794. //>>excludeEnd("ide");
  795. pragmas: [],
  796. messageSends: ["reject:", "="]
  797. }, function ($methodClass){ return function (anObject){
  798. var self=this,$self=this;
  799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  800. return $core.withContext(function($ctx1) {
  801. //>>excludeEnd("ctx");
  802. return $self._reject_((function(each){
  803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  804. return $core.withContext(function($ctx2) {
  805. //>>excludeEnd("ctx");
  806. return $recv(each).__eq(anObject);
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  809. //>>excludeEnd("ctx");
  810. }));
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  813. //>>excludeEnd("ctx");
  814. }; }),
  815. $globals.Collection);
  816. $core.addMethod(
  817. $core.method({
  818. selector: "copyWithoutAll:",
  819. protocol: "copying",
  820. //>>excludeStart("ide", pragmas.excludeIdeData);
  821. args: ["aCollection"],
  822. 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 ]",
  823. referencedClasses: [],
  824. //>>excludeEnd("ide");
  825. pragmas: [],
  826. messageSends: ["reject:", "includes:"]
  827. }, function ($methodClass){ return function (aCollection){
  828. var self=this,$self=this;
  829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  830. return $core.withContext(function($ctx1) {
  831. //>>excludeEnd("ctx");
  832. return $self._reject_((function(each){
  833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  834. return $core.withContext(function($ctx2) {
  835. //>>excludeEnd("ctx");
  836. return $recv(aCollection)._includes_(each);
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  839. //>>excludeEnd("ctx");
  840. }));
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  843. //>>excludeEnd("ctx");
  844. }; }),
  845. $globals.Collection);
  846. $core.addMethod(
  847. $core.method({
  848. selector: "deepCopy",
  849. protocol: "copying",
  850. //>>excludeStart("ide", pragmas.excludeIdeData);
  851. args: [],
  852. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  853. referencedClasses: [],
  854. //>>excludeEnd("ide");
  855. pragmas: [],
  856. messageSends: ["collect:", "deepCopy"]
  857. }, function ($methodClass){ return function (){
  858. var self=this,$self=this;
  859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  860. return $core.withContext(function($ctx1) {
  861. //>>excludeEnd("ctx");
  862. return $self._collect_((function(each){
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. return $core.withContext(function($ctx2) {
  865. //>>excludeEnd("ctx");
  866. return $recv(each)._deepCopy();
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  869. //>>excludeEnd("ctx");
  870. }));
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  873. //>>excludeEnd("ctx");
  874. }; }),
  875. $globals.Collection);
  876. $core.addMethod(
  877. $core.method({
  878. selector: "detect:",
  879. protocol: "enumerating",
  880. //>>excludeStart("ide", pragmas.excludeIdeData);
  881. args: ["aBlock"],
  882. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  883. referencedClasses: [],
  884. //>>excludeEnd("ide");
  885. pragmas: [],
  886. messageSends: ["detect:ifNone:", "errorNotFound"]
  887. }, function ($methodClass){ return function (aBlock){
  888. var self=this,$self=this;
  889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  890. return $core.withContext(function($ctx1) {
  891. //>>excludeEnd("ctx");
  892. return $self._detect_ifNone_(aBlock,(function(){
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. return $core.withContext(function($ctx2) {
  895. //>>excludeEnd("ctx");
  896. return $self._errorNotFound();
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  899. //>>excludeEnd("ctx");
  900. }));
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  903. //>>excludeEnd("ctx");
  904. }; }),
  905. $globals.Collection);
  906. $core.addMethod(
  907. $core.method({
  908. selector: "detect:ifNone:",
  909. protocol: "enumerating",
  910. //>>excludeStart("ide", pragmas.excludeIdeData);
  911. args: ["aBlock", "anotherBlock"],
  912. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  913. referencedClasses: [],
  914. //>>excludeEnd("ide");
  915. pragmas: [],
  916. messageSends: ["do:", "ifTrue:", "value:", "value"]
  917. }, function ($methodClass){ return function (aBlock,anotherBlock){
  918. var self=this,$self=this;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. return $core.withContext(function($ctx1) {
  921. //>>excludeEnd("ctx");
  922. var $early={};
  923. try {
  924. $self._do_((function(each){
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. return $core.withContext(function($ctx2) {
  927. //>>excludeEnd("ctx");
  928. if($core.assert($recv(aBlock)._value_(each))){
  929. throw $early=[each];
  930. }
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  933. //>>excludeEnd("ctx");
  934. }));
  935. return $recv(anotherBlock)._value();
  936. }
  937. catch(e) {if(e===$early)return e[0]; throw e}
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  940. //>>excludeEnd("ctx");
  941. }; }),
  942. $globals.Collection);
  943. $core.addMethod(
  944. $core.method({
  945. selector: "do:",
  946. protocol: "enumerating",
  947. //>>excludeStart("ide", pragmas.excludeIdeData);
  948. args: ["aBlock"],
  949. source: "do: aBlock\x0a\x09self subclassResponsibility",
  950. referencedClasses: [],
  951. //>>excludeEnd("ide");
  952. pragmas: [],
  953. messageSends: ["subclassResponsibility"]
  954. }, function ($methodClass){ return function (aBlock){
  955. var self=this,$self=this;
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. return $core.withContext(function($ctx1) {
  958. //>>excludeEnd("ctx");
  959. $self._subclassResponsibility();
  960. return self;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  963. //>>excludeEnd("ctx");
  964. }; }),
  965. $globals.Collection);
  966. $core.addMethod(
  967. $core.method({
  968. selector: "do:separatedBy:",
  969. protocol: "enumerating",
  970. //>>excludeStart("ide", pragmas.excludeIdeData);
  971. args: ["aBlock", "anotherBlock"],
  972. 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 ]",
  973. referencedClasses: [],
  974. //>>excludeEnd("ide");
  975. pragmas: [],
  976. messageSends: ["do:", "value", "value:"]
  977. }, function ($methodClass){ return function (aBlock,anotherBlock){
  978. var self=this,$self=this;
  979. var actionBeforeElement;
  980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  981. return $core.withContext(function($ctx1) {
  982. //>>excludeEnd("ctx");
  983. actionBeforeElement=(function(){
  984. actionBeforeElement=anotherBlock;
  985. return actionBeforeElement;
  986. });
  987. $self._do_((function(each){
  988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  989. return $core.withContext(function($ctx2) {
  990. //>>excludeEnd("ctx");
  991. $recv(actionBeforeElement)._value();
  992. return $recv(aBlock)._value_(each);
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  995. //>>excludeEnd("ctx");
  996. }));
  997. return self;
  998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  999. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  1000. //>>excludeEnd("ctx");
  1001. }; }),
  1002. $globals.Collection);
  1003. $core.addMethod(
  1004. $core.method({
  1005. selector: "errorNotFound",
  1006. protocol: "error handling",
  1007. //>>excludeStart("ide", pragmas.excludeIdeData);
  1008. args: [],
  1009. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1010. referencedClasses: [],
  1011. //>>excludeEnd("ide");
  1012. pragmas: [],
  1013. messageSends: ["error:"]
  1014. }, function ($methodClass){ return function (){
  1015. var self=this,$self=this;
  1016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1017. return $core.withContext(function($ctx1) {
  1018. //>>excludeEnd("ctx");
  1019. $self._error_("Object is not in the collection");
  1020. return self;
  1021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1022. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1023. //>>excludeEnd("ctx");
  1024. }; }),
  1025. $globals.Collection);
  1026. $core.addMethod(
  1027. $core.method({
  1028. selector: "ifEmpty:",
  1029. protocol: "testing",
  1030. //>>excludeStart("ide", pragmas.excludeIdeData);
  1031. args: ["aBlock"],
  1032. 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: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  1033. referencedClasses: [],
  1034. //>>excludeEnd("ide");
  1035. pragmas: [],
  1036. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1037. }, function ($methodClass){ return function (aBlock){
  1038. var self=this,$self=this;
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. return $core.withContext(function($ctx1) {
  1041. //>>excludeEnd("ctx");
  1042. if($core.assert($self._isEmpty())){
  1043. return $recv(aBlock)._value();
  1044. } else {
  1045. return self;
  1046. }
  1047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1048. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1049. //>>excludeEnd("ctx");
  1050. }; }),
  1051. $globals.Collection);
  1052. $core.addMethod(
  1053. $core.method({
  1054. selector: "ifEmpty:ifNotEmpty:",
  1055. protocol: "testing",
  1056. //>>excludeStart("ide", pragmas.excludeIdeData);
  1057. args: ["aBlock", "anotherBlock"],
  1058. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1059. referencedClasses: [],
  1060. //>>excludeEnd("ide");
  1061. pragmas: [],
  1062. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1063. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1064. var self=this,$self=this;
  1065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1066. return $core.withContext(function($ctx1) {
  1067. //>>excludeEnd("ctx");
  1068. if($core.assert($self._isEmpty())){
  1069. return $recv(aBlock)._value();
  1070. } else {
  1071. return $recv(anotherBlock)._value_(self);
  1072. }
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1075. //>>excludeEnd("ctx");
  1076. }; }),
  1077. $globals.Collection);
  1078. $core.addMethod(
  1079. $core.method({
  1080. selector: "ifNotEmpty:",
  1081. protocol: "testing",
  1082. //>>excludeStart("ide", pragmas.excludeIdeData);
  1083. args: ["aBlock"],
  1084. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1085. referencedClasses: [],
  1086. //>>excludeEnd("ide");
  1087. pragmas: [],
  1088. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1089. }, function ($methodClass){ return function (aBlock){
  1090. var self=this,$self=this;
  1091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1092. return $core.withContext(function($ctx1) {
  1093. //>>excludeEnd("ctx");
  1094. if($core.assert($self._notEmpty())){
  1095. return $recv(aBlock)._value_(self);
  1096. } else {
  1097. return self;
  1098. }
  1099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1100. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1101. //>>excludeEnd("ctx");
  1102. }; }),
  1103. $globals.Collection);
  1104. $core.addMethod(
  1105. $core.method({
  1106. selector: "ifNotEmpty:ifEmpty:",
  1107. protocol: "testing",
  1108. //>>excludeStart("ide", pragmas.excludeIdeData);
  1109. args: ["aBlock", "anotherBlock"],
  1110. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1111. referencedClasses: [],
  1112. //>>excludeEnd("ide");
  1113. pragmas: [],
  1114. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1115. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1116. var self=this,$self=this;
  1117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1118. return $core.withContext(function($ctx1) {
  1119. //>>excludeEnd("ctx");
  1120. if($core.assert($self._notEmpty())){
  1121. return $recv(aBlock)._value_(self);
  1122. } else {
  1123. return $recv(anotherBlock)._value();
  1124. }
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1127. //>>excludeEnd("ctx");
  1128. }; }),
  1129. $globals.Collection);
  1130. $core.addMethod(
  1131. $core.method({
  1132. selector: "includes:",
  1133. protocol: "testing",
  1134. //>>excludeStart("ide", pragmas.excludeIdeData);
  1135. args: ["anObject"],
  1136. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1137. referencedClasses: [],
  1138. //>>excludeEnd("ide");
  1139. pragmas: [],
  1140. messageSends: ["anySatisfy:", "="]
  1141. }, function ($methodClass){ return function (anObject){
  1142. var self=this,$self=this;
  1143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1144. return $core.withContext(function($ctx1) {
  1145. //>>excludeEnd("ctx");
  1146. return $self._anySatisfy_((function(each){
  1147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1148. return $core.withContext(function($ctx2) {
  1149. //>>excludeEnd("ctx");
  1150. return $recv(each).__eq(anObject);
  1151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1153. //>>excludeEnd("ctx");
  1154. }));
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1157. //>>excludeEnd("ctx");
  1158. }; }),
  1159. $globals.Collection);
  1160. $core.addMethod(
  1161. $core.method({
  1162. selector: "inject:into:",
  1163. protocol: "enumerating",
  1164. //>>excludeStart("ide", pragmas.excludeIdeData);
  1165. args: ["anObject", "aBlock"],
  1166. 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",
  1167. referencedClasses: [],
  1168. //>>excludeEnd("ide");
  1169. pragmas: [],
  1170. messageSends: ["do:", "value:value:"]
  1171. }, function ($methodClass){ return function (anObject,aBlock){
  1172. var self=this,$self=this;
  1173. var result;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. return $core.withContext(function($ctx1) {
  1176. //>>excludeEnd("ctx");
  1177. result=anObject;
  1178. $self._do_((function(each){
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. return $core.withContext(function($ctx2) {
  1181. //>>excludeEnd("ctx");
  1182. result=$recv(aBlock)._value_value_(result,each);
  1183. return result;
  1184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1186. //>>excludeEnd("ctx");
  1187. }));
  1188. return result;
  1189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1190. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1191. //>>excludeEnd("ctx");
  1192. }; }),
  1193. $globals.Collection);
  1194. $core.addMethod(
  1195. $core.method({
  1196. selector: "intersection:",
  1197. protocol: "enumerating",
  1198. //>>excludeStart("ide", pragmas.excludeIdeData);
  1199. args: ["aCollection"],
  1200. 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",
  1201. referencedClasses: ["Set"],
  1202. //>>excludeEnd("ide");
  1203. pragmas: [],
  1204. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1205. }, function ($methodClass){ return function (aCollection){
  1206. var self=this,$self=this;
  1207. var set,outputSet;
  1208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1209. return $core.withContext(function($ctx1) {
  1210. //>>excludeEnd("ctx");
  1211. set=$self._asSet();
  1212. outputSet=$recv($globals.Set)._new();
  1213. $recv(aCollection)._do_((function(each){
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. return $core.withContext(function($ctx2) {
  1216. //>>excludeEnd("ctx");
  1217. if($core.assert($recv([$recv(set)._includes_(each)
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. ,$ctx2.sendIdx["includes:"]=1
  1220. //>>excludeEnd("ctx");
  1221. ][0])._and_((function(){
  1222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1223. return $core.withContext(function($ctx3) {
  1224. //>>excludeEnd("ctx");
  1225. return $recv($recv(outputSet)._includes_(each))._not();
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1228. //>>excludeEnd("ctx");
  1229. })))){
  1230. return $recv(outputSet)._add_(each);
  1231. }
  1232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1233. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1234. //>>excludeEnd("ctx");
  1235. }));
  1236. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1239. //>>excludeEnd("ctx");
  1240. }; }),
  1241. $globals.Collection);
  1242. $core.addMethod(
  1243. $core.method({
  1244. selector: "isEmpty",
  1245. protocol: "testing",
  1246. //>>excludeStart("ide", pragmas.excludeIdeData);
  1247. args: [],
  1248. source: "isEmpty\x0a\x09^ self size = 0",
  1249. referencedClasses: [],
  1250. //>>excludeEnd("ide");
  1251. pragmas: [],
  1252. messageSends: ["=", "size"]
  1253. }, function ($methodClass){ return function (){
  1254. var self=this,$self=this;
  1255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1256. return $core.withContext(function($ctx1) {
  1257. //>>excludeEnd("ctx");
  1258. return $recv($self._size()).__eq((0));
  1259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1260. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1261. //>>excludeEnd("ctx");
  1262. }; }),
  1263. $globals.Collection);
  1264. $core.addMethod(
  1265. $core.method({
  1266. selector: "noneSatisfy:",
  1267. protocol: "enumerating",
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. args: ["aBlock"],
  1270. 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",
  1271. referencedClasses: [],
  1272. //>>excludeEnd("ide");
  1273. pragmas: [],
  1274. messageSends: ["do:", "ifTrue:", "value:"]
  1275. }, function ($methodClass){ return function (aBlock){
  1276. var self=this,$self=this;
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. return $core.withContext(function($ctx1) {
  1279. //>>excludeEnd("ctx");
  1280. var $early={};
  1281. try {
  1282. $self._do_((function(item){
  1283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1284. return $core.withContext(function($ctx2) {
  1285. //>>excludeEnd("ctx");
  1286. if($core.assert($recv(aBlock)._value_(item))){
  1287. throw $early=[false];
  1288. }
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1291. //>>excludeEnd("ctx");
  1292. }));
  1293. return true;
  1294. }
  1295. catch(e) {if(e===$early)return e[0]; throw e}
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1298. //>>excludeEnd("ctx");
  1299. }; }),
  1300. $globals.Collection);
  1301. $core.addMethod(
  1302. $core.method({
  1303. selector: "notEmpty",
  1304. protocol: "testing",
  1305. //>>excludeStart("ide", pragmas.excludeIdeData);
  1306. args: [],
  1307. source: "notEmpty\x0a\x09^ self isEmpty not",
  1308. referencedClasses: [],
  1309. //>>excludeEnd("ide");
  1310. pragmas: [],
  1311. messageSends: ["not", "isEmpty"]
  1312. }, function ($methodClass){ return function (){
  1313. var self=this,$self=this;
  1314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1315. return $core.withContext(function($ctx1) {
  1316. //>>excludeEnd("ctx");
  1317. return $recv($self._isEmpty())._not();
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1320. //>>excludeEnd("ctx");
  1321. }; }),
  1322. $globals.Collection);
  1323. $core.addMethod(
  1324. $core.method({
  1325. selector: "occurrencesOf:",
  1326. protocol: "accessing",
  1327. //>>excludeStart("ide", pragmas.excludeIdeData);
  1328. args: ["anObject"],
  1329. 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",
  1330. referencedClasses: [],
  1331. //>>excludeEnd("ide");
  1332. pragmas: [],
  1333. messageSends: ["do:", "ifTrue:", "=", "+"]
  1334. }, function ($methodClass){ return function (anObject){
  1335. var self=this,$self=this;
  1336. var tally;
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. return $core.withContext(function($ctx1) {
  1339. //>>excludeEnd("ctx");
  1340. tally=(0);
  1341. $self._do_((function(each){
  1342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1343. return $core.withContext(function($ctx2) {
  1344. //>>excludeEnd("ctx");
  1345. if($core.assert($recv(anObject).__eq(each))){
  1346. tally=$recv(tally).__plus((1));
  1347. return tally;
  1348. }
  1349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1351. //>>excludeEnd("ctx");
  1352. }));
  1353. return tally;
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1356. //>>excludeEnd("ctx");
  1357. }; }),
  1358. $globals.Collection);
  1359. $core.addMethod(
  1360. $core.method({
  1361. selector: "putOn:",
  1362. protocol: "streaming",
  1363. //>>excludeStart("ide", pragmas.excludeIdeData);
  1364. args: ["aStream"],
  1365. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1366. referencedClasses: [],
  1367. //>>excludeEnd("ide");
  1368. pragmas: [],
  1369. messageSends: ["do:", "putOn:"]
  1370. }, function ($methodClass){ return function (aStream){
  1371. var self=this,$self=this;
  1372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1373. return $core.withContext(function($ctx1) {
  1374. //>>excludeEnd("ctx");
  1375. $self._do_((function(each){
  1376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1377. return $core.withContext(function($ctx2) {
  1378. //>>excludeEnd("ctx");
  1379. return $recv(each)._putOn_(aStream);
  1380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1382. //>>excludeEnd("ctx");
  1383. }));
  1384. return self;
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1387. //>>excludeEnd("ctx");
  1388. }; }),
  1389. $globals.Collection);
  1390. $core.addMethod(
  1391. $core.method({
  1392. selector: "reject:",
  1393. protocol: "enumerating",
  1394. //>>excludeStart("ide", pragmas.excludeIdeData);
  1395. args: ["aBlock"],
  1396. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1397. referencedClasses: [],
  1398. //>>excludeEnd("ide");
  1399. pragmas: [],
  1400. messageSends: ["select:", "=", "value:"]
  1401. }, function ($methodClass){ return function (aBlock){
  1402. var self=this,$self=this;
  1403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1404. return $core.withContext(function($ctx1) {
  1405. //>>excludeEnd("ctx");
  1406. return $self._select_((function(each){
  1407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1408. return $core.withContext(function($ctx2) {
  1409. //>>excludeEnd("ctx");
  1410. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1413. //>>excludeEnd("ctx");
  1414. }));
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1417. //>>excludeEnd("ctx");
  1418. }; }),
  1419. $globals.Collection);
  1420. $core.addMethod(
  1421. $core.method({
  1422. selector: "remove:",
  1423. protocol: "adding/removing",
  1424. //>>excludeStart("ide", pragmas.excludeIdeData);
  1425. args: ["anObject"],
  1426. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1427. referencedClasses: [],
  1428. //>>excludeEnd("ide");
  1429. pragmas: [],
  1430. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1431. }, function ($methodClass){ return function (anObject){
  1432. var self=this,$self=this;
  1433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1434. return $core.withContext(function($ctx1) {
  1435. //>>excludeEnd("ctx");
  1436. return $self._remove_ifAbsent_(anObject,(function(){
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx2) {
  1439. //>>excludeEnd("ctx");
  1440. return $self._errorNotFound();
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1443. //>>excludeEnd("ctx");
  1444. }));
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1447. //>>excludeEnd("ctx");
  1448. }; }),
  1449. $globals.Collection);
  1450. $core.addMethod(
  1451. $core.method({
  1452. selector: "remove:ifAbsent:",
  1453. protocol: "adding/removing",
  1454. //>>excludeStart("ide", pragmas.excludeIdeData);
  1455. args: ["anObject", "aBlock"],
  1456. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1457. referencedClasses: [],
  1458. //>>excludeEnd("ide");
  1459. pragmas: [],
  1460. messageSends: ["subclassResponsibility"]
  1461. }, function ($methodClass){ return function (anObject,aBlock){
  1462. var self=this,$self=this;
  1463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1464. return $core.withContext(function($ctx1) {
  1465. //>>excludeEnd("ctx");
  1466. $self._subclassResponsibility();
  1467. return self;
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1470. //>>excludeEnd("ctx");
  1471. }; }),
  1472. $globals.Collection);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "removeAll",
  1476. protocol: "adding/removing",
  1477. //>>excludeStart("ide", pragmas.excludeIdeData);
  1478. args: [],
  1479. source: "removeAll\x0a\x09self subclassResponsibility",
  1480. referencedClasses: [],
  1481. //>>excludeEnd("ide");
  1482. pragmas: [],
  1483. messageSends: ["subclassResponsibility"]
  1484. }, function ($methodClass){ return function (){
  1485. var self=this,$self=this;
  1486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1487. return $core.withContext(function($ctx1) {
  1488. //>>excludeEnd("ctx");
  1489. $self._subclassResponsibility();
  1490. return self;
  1491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1492. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1493. //>>excludeEnd("ctx");
  1494. }; }),
  1495. $globals.Collection);
  1496. $core.addMethod(
  1497. $core.method({
  1498. selector: "select:",
  1499. protocol: "enumerating",
  1500. //>>excludeStart("ide", pragmas.excludeIdeData);
  1501. args: ["aBlock"],
  1502. 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",
  1503. referencedClasses: [],
  1504. //>>excludeEnd("ide");
  1505. pragmas: [],
  1506. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1507. }, function ($methodClass){ return function (aBlock){
  1508. var self=this,$self=this;
  1509. var stream;
  1510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1511. return $core.withContext(function($ctx1) {
  1512. //>>excludeEnd("ctx");
  1513. stream=$recv($recv($self._class())._new())._writeStream();
  1514. $self._do_((function(each){
  1515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1516. return $core.withContext(function($ctx2) {
  1517. //>>excludeEnd("ctx");
  1518. if($core.assert($recv(aBlock)._value_(each))){
  1519. return $recv(stream)._nextPut_(each);
  1520. }
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1523. //>>excludeEnd("ctx");
  1524. }));
  1525. return $recv(stream)._contents();
  1526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1527. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1528. //>>excludeEnd("ctx");
  1529. }; }),
  1530. $globals.Collection);
  1531. $core.addMethod(
  1532. $core.method({
  1533. selector: "select:thenCollect:",
  1534. protocol: "enumerating",
  1535. //>>excludeStart("ide", pragmas.excludeIdeData);
  1536. args: ["selectBlock", "collectBlock"],
  1537. 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",
  1538. referencedClasses: [],
  1539. //>>excludeEnd("ide");
  1540. pragmas: [],
  1541. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1542. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1543. var self=this,$self=this;
  1544. var stream;
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return $core.withContext(function($ctx1) {
  1547. //>>excludeEnd("ctx");
  1548. stream=$recv($recv($self._class())._new())._writeStream();
  1549. $self._do_((function(each){
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. return $core.withContext(function($ctx2) {
  1552. //>>excludeEnd("ctx");
  1553. if($core.assert([$recv(selectBlock)._value_(each)
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. ,$ctx2.sendIdx["value:"]=1
  1556. //>>excludeEnd("ctx");
  1557. ][0])){
  1558. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1559. }
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1562. //>>excludeEnd("ctx");
  1563. }));
  1564. return $recv(stream)._contents();
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1567. //>>excludeEnd("ctx");
  1568. }; }),
  1569. $globals.Collection);
  1570. $core.addMethod(
  1571. $core.method({
  1572. selector: "shallowCopy",
  1573. protocol: "copying",
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. pragmas: [],
  1580. messageSends: ["collect:"]
  1581. }, function ($methodClass){ return function (){
  1582. var self=this,$self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. return $self._collect_((function(each){
  1587. return each;
  1588. }));
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1591. //>>excludeEnd("ctx");
  1592. }; }),
  1593. $globals.Collection);
  1594. $core.addMethod(
  1595. $core.method({
  1596. selector: "shortenedPrintString",
  1597. protocol: "printing",
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. args: [],
  1600. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ (self copyEmpty copyWith: self anyOne) printString, ' ... ', (self size - 1) asString, ' more items' ]",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. pragmas: [],
  1604. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", ",", "copyWith:", "copyEmpty", "anyOne", "asString", "-"]
  1605. }, function ($methodClass){ return function (){
  1606. var self=this,$self=this;
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. return $core.withContext(function($ctx1) {
  1609. //>>excludeEnd("ctx");
  1610. if($core.assert($recv([$self._size()
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. ,$ctx1.sendIdx["size"]=1
  1613. //>>excludeEnd("ctx");
  1614. ][0]).__lt_eq((1)))){
  1615. return [$self._printString()
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. ,$ctx1.sendIdx["printString"]=1
  1618. //>>excludeEnd("ctx");
  1619. ][0];
  1620. } else {
  1621. return [$recv([$recv($recv($recv($recv($self._copyEmpty())._copyWith_($self._anyOne()))._printString()).__comma(" ... ")).__comma($recv($recv($self._size()).__minus((1)))._asString())
  1622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1623. ,$ctx1.sendIdx[","]=2
  1624. //>>excludeEnd("ctx");
  1625. ][0]).__comma(" more items")
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. ,$ctx1.sendIdx[","]=1
  1628. //>>excludeEnd("ctx");
  1629. ][0];
  1630. }
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  1633. //>>excludeEnd("ctx");
  1634. }; }),
  1635. $globals.Collection);
  1636. $core.addMethod(
  1637. $core.method({
  1638. selector: "single",
  1639. protocol: "accessing",
  1640. //>>excludeStart("ide", pragmas.excludeIdeData);
  1641. args: [],
  1642. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  1643. referencedClasses: [],
  1644. //>>excludeEnd("ide");
  1645. pragmas: [],
  1646. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1647. }, function ($methodClass){ return function (){
  1648. var self=this,$self=this;
  1649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1650. return $core.withContext(function($ctx1) {
  1651. //>>excludeEnd("ctx");
  1652. $self._ifEmpty_((function(){
  1653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1654. return $core.withContext(function($ctx2) {
  1655. //>>excludeEnd("ctx");
  1656. return [$self._error_("Collection is empty")
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. ,$ctx2.sendIdx["error:"]=1
  1659. //>>excludeEnd("ctx");
  1660. ][0];
  1661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1663. //>>excludeEnd("ctx");
  1664. }));
  1665. if($core.assert($recv($self._size()).__gt((1)))){
  1666. $self._error_("Collection holds more than one element");
  1667. }
  1668. return $self._anyOne();
  1669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1670. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1671. //>>excludeEnd("ctx");
  1672. }; }),
  1673. $globals.Collection);
  1674. $core.addMethod(
  1675. $core.method({
  1676. selector: "size",
  1677. protocol: "accessing",
  1678. //>>excludeStart("ide", pragmas.excludeIdeData);
  1679. args: [],
  1680. source: "size\x0a\x09self subclassResponsibility",
  1681. referencedClasses: [],
  1682. //>>excludeEnd("ide");
  1683. pragmas: [],
  1684. messageSends: ["subclassResponsibility"]
  1685. }, function ($methodClass){ return function (){
  1686. var self=this,$self=this;
  1687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1688. return $core.withContext(function($ctx1) {
  1689. //>>excludeEnd("ctx");
  1690. $self._subclassResponsibility();
  1691. return self;
  1692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1693. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1694. //>>excludeEnd("ctx");
  1695. }; }),
  1696. $globals.Collection);
  1697. $core.addMethod(
  1698. $core.method({
  1699. selector: "classTag",
  1700. protocol: "accessing",
  1701. //>>excludeStart("ide", pragmas.excludeIdeData);
  1702. args: [],
  1703. 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'",
  1704. referencedClasses: [],
  1705. //>>excludeEnd("ide");
  1706. pragmas: [],
  1707. messageSends: []
  1708. }, function ($methodClass){ return function (){
  1709. var self=this,$self=this;
  1710. return "collection";
  1711. }; }),
  1712. $globals.Collection.a$cls);
  1713. $core.addMethod(
  1714. $core.method({
  1715. selector: "new:",
  1716. protocol: "instance creation",
  1717. //>>excludeStart("ide", pragmas.excludeIdeData);
  1718. args: ["anInteger"],
  1719. source: "new: anInteger\x0a\x09^ self new",
  1720. referencedClasses: [],
  1721. //>>excludeEnd("ide");
  1722. pragmas: [],
  1723. messageSends: ["new"]
  1724. }, function ($methodClass){ return function (anInteger){
  1725. var self=this,$self=this;
  1726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1727. return $core.withContext(function($ctx1) {
  1728. //>>excludeEnd("ctx");
  1729. return $self._new();
  1730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1731. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1732. //>>excludeEnd("ctx");
  1733. }; }),
  1734. $globals.Collection.a$cls);
  1735. $core.addMethod(
  1736. $core.method({
  1737. selector: "with:",
  1738. protocol: "instance creation",
  1739. //>>excludeStart("ide", pragmas.excludeIdeData);
  1740. args: ["anObject"],
  1741. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1742. referencedClasses: [],
  1743. //>>excludeEnd("ide");
  1744. pragmas: [],
  1745. messageSends: ["add:", "new", "yourself"]
  1746. }, function ($methodClass){ return function (anObject){
  1747. var self=this,$self=this;
  1748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1749. return $core.withContext(function($ctx1) {
  1750. //>>excludeEnd("ctx");
  1751. var $1;
  1752. $1=$self._new();
  1753. $recv($1)._add_(anObject);
  1754. return $recv($1)._yourself();
  1755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1756. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1757. //>>excludeEnd("ctx");
  1758. }; }),
  1759. $globals.Collection.a$cls);
  1760. $core.addMethod(
  1761. $core.method({
  1762. selector: "with:with:",
  1763. protocol: "instance creation",
  1764. //>>excludeStart("ide", pragmas.excludeIdeData);
  1765. args: ["anObject", "anotherObject"],
  1766. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1767. referencedClasses: [],
  1768. //>>excludeEnd("ide");
  1769. pragmas: [],
  1770. messageSends: ["add:", "new", "yourself"]
  1771. }, function ($methodClass){ return function (anObject,anotherObject){
  1772. var self=this,$self=this;
  1773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1774. return $core.withContext(function($ctx1) {
  1775. //>>excludeEnd("ctx");
  1776. var $1;
  1777. $1=$self._new();
  1778. [$recv($1)._add_(anObject)
  1779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1780. ,$ctx1.sendIdx["add:"]=1
  1781. //>>excludeEnd("ctx");
  1782. ][0];
  1783. $recv($1)._add_(anotherObject);
  1784. return $recv($1)._yourself();
  1785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1786. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1787. //>>excludeEnd("ctx");
  1788. }; }),
  1789. $globals.Collection.a$cls);
  1790. $core.addMethod(
  1791. $core.method({
  1792. selector: "with:with:with:",
  1793. protocol: "instance creation",
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. args: ["firstObject", "secondObject", "thirdObject"],
  1796. 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",
  1797. referencedClasses: [],
  1798. //>>excludeEnd("ide");
  1799. pragmas: [],
  1800. messageSends: ["add:", "new", "yourself"]
  1801. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1802. var self=this,$self=this;
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx1) {
  1805. //>>excludeEnd("ctx");
  1806. var $1;
  1807. $1=$self._new();
  1808. [$recv($1)._add_(firstObject)
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. ,$ctx1.sendIdx["add:"]=1
  1811. //>>excludeEnd("ctx");
  1812. ][0];
  1813. [$recv($1)._add_(secondObject)
  1814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1815. ,$ctx1.sendIdx["add:"]=2
  1816. //>>excludeEnd("ctx");
  1817. ][0];
  1818. $recv($1)._add_(thirdObject);
  1819. return $recv($1)._yourself();
  1820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1821. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1822. //>>excludeEnd("ctx");
  1823. }; }),
  1824. $globals.Collection.a$cls);
  1825. $core.addMethod(
  1826. $core.method({
  1827. selector: "withAll:",
  1828. protocol: "instance creation",
  1829. //>>excludeStart("ide", pragmas.excludeIdeData);
  1830. args: ["aCollection"],
  1831. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1832. referencedClasses: [],
  1833. //>>excludeEnd("ide");
  1834. pragmas: [],
  1835. messageSends: ["addAll:", "new", "yourself"]
  1836. }, function ($methodClass){ return function (aCollection){
  1837. var self=this,$self=this;
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. return $core.withContext(function($ctx1) {
  1840. //>>excludeEnd("ctx");
  1841. var $1;
  1842. $1=$self._new();
  1843. $recv($1)._addAll_(aCollection);
  1844. return $recv($1)._yourself();
  1845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1846. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1847. //>>excludeEnd("ctx");
  1848. }; }),
  1849. $globals.Collection.a$cls);
  1850. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1851. //>>excludeStart("ide", pragmas.excludeIdeData);
  1852. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1853. //>>excludeEnd("ide");
  1854. $core.addMethod(
  1855. $core.method({
  1856. selector: "=",
  1857. protocol: "comparing",
  1858. //>>excludeStart("ide", pragmas.excludeIdeData);
  1859. args: ["anAssociativeCollection"],
  1860. source: "= anAssociativeCollection\x0a\x09| comparisons |\x0a\x09self class = anAssociativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssociativeCollection size ifFalse: [ ^ false ].\x0a\x09comparisons := OrderedCollection new.\x0a\x09(self associations allSatisfy: [ :each |\x0a\x09\x09anAssociativeCollection at: each key\x0a\x09\x09\x09ifPresent: [ :otherValue | comparisons add: { each value. otherValue }. true ]\x0a\x09\x09\x09ifAbsent: [ false ] ]) ifFalse: [ ^ false ].\x0a\x09^ comparisons allSatisfy: [ :each | each first = each second ]",
  1861. referencedClasses: ["OrderedCollection"],
  1862. //>>excludeEnd("ide");
  1863. pragmas: [],
  1864. messageSends: ["ifFalse:", "=", "class", "size", "new", "allSatisfy:", "associations", "at:ifPresent:ifAbsent:", "key", "add:", "value", "first", "second"]
  1865. }, function ($methodClass){ return function (anAssociativeCollection){
  1866. var self=this,$self=this;
  1867. var comparisons;
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. return $core.withContext(function($ctx1) {
  1870. //>>excludeEnd("ctx");
  1871. if(!$core.assert([$recv([$self._class()
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. ,$ctx1.sendIdx["class"]=1
  1874. //>>excludeEnd("ctx");
  1875. ][0]).__eq($recv(anAssociativeCollection)._class())
  1876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1877. ,$ctx1.sendIdx["="]=1
  1878. //>>excludeEnd("ctx");
  1879. ][0])){
  1880. return false;
  1881. }
  1882. if(!$core.assert([$recv([$self._size()
  1883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1884. ,$ctx1.sendIdx["size"]=1
  1885. //>>excludeEnd("ctx");
  1886. ][0]).__eq($recv(anAssociativeCollection)._size())
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. ,$ctx1.sendIdx["="]=2
  1889. //>>excludeEnd("ctx");
  1890. ][0])){
  1891. return false;
  1892. }
  1893. comparisons=$recv($globals.OrderedCollection)._new();
  1894. if(!$core.assert([$recv($self._associations())._allSatisfy_((function(each){
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx2) {
  1897. //>>excludeEnd("ctx");
  1898. return $recv(anAssociativeCollection)._at_ifPresent_ifAbsent_($recv(each)._key(),(function(otherValue){
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. return $core.withContext(function($ctx3) {
  1901. //>>excludeEnd("ctx");
  1902. $recv(comparisons)._add_([$recv(each)._value(),otherValue]);
  1903. return true;
  1904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1905. }, function($ctx3) {$ctx3.fillBlock({otherValue:otherValue},$ctx2,4)});
  1906. //>>excludeEnd("ctx");
  1907. }),(function(){
  1908. return false;
  1909. }));
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1912. //>>excludeEnd("ctx");
  1913. }))
  1914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1915. ,$ctx1.sendIdx["allSatisfy:"]=1
  1916. //>>excludeEnd("ctx");
  1917. ][0])){
  1918. return false;
  1919. }
  1920. return $recv(comparisons)._allSatisfy_((function(each){
  1921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1922. return $core.withContext(function($ctx2) {
  1923. //>>excludeEnd("ctx");
  1924. return $recv($recv(each)._first()).__eq($recv(each)._second());
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  1927. //>>excludeEnd("ctx");
  1928. }));
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociativeCollection:anAssociativeCollection,comparisons:comparisons})});
  1931. //>>excludeEnd("ctx");
  1932. }; }),
  1933. $globals.AssociativeCollection);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "add:",
  1937. protocol: "adding/removing",
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: ["anAssociation"],
  1940. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1941. referencedClasses: [],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["at:put:", "key", "value"]
  1945. }, function ($methodClass){ return function (anAssociation){
  1946. var self=this,$self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return $core.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1951. return self;
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1954. //>>excludeEnd("ctx");
  1955. }; }),
  1956. $globals.AssociativeCollection);
  1957. $core.addMethod(
  1958. $core.method({
  1959. selector: "addAll:",
  1960. protocol: "adding/removing",
  1961. //>>excludeStart("ide", pragmas.excludeIdeData);
  1962. args: ["anAssociativeCollection"],
  1963. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1964. referencedClasses: [],
  1965. //>>excludeEnd("ide");
  1966. pragmas: [],
  1967. messageSends: ["addAll:", "associations"]
  1968. }, function ($methodClass){ return function (anAssociativeCollection){
  1969. var self=this,$self=this;
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. return $core.withContext(function($ctx1) {
  1972. //>>excludeEnd("ctx");
  1973. [(
  1974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1975. $ctx1.supercall = true,
  1976. //>>excludeEnd("ctx");
  1977. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1979. ,$ctx1.supercall = false
  1980. //>>excludeEnd("ctx");
  1981. ][0];
  1982. return anAssociativeCollection;
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1985. //>>excludeEnd("ctx");
  1986. }; }),
  1987. $globals.AssociativeCollection);
  1988. $core.addMethod(
  1989. $core.method({
  1990. selector: "asDictionary",
  1991. protocol: "converting",
  1992. //>>excludeStart("ide", pragmas.excludeIdeData);
  1993. args: [],
  1994. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1995. referencedClasses: ["Dictionary"],
  1996. //>>excludeEnd("ide");
  1997. pragmas: [],
  1998. messageSends: ["from:", "associations"]
  1999. }, function ($methodClass){ return function (){
  2000. var self=this,$self=this;
  2001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2002. return $core.withContext(function($ctx1) {
  2003. //>>excludeEnd("ctx");
  2004. return $recv($globals.Dictionary)._from_($self._associations());
  2005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2006. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  2007. //>>excludeEnd("ctx");
  2008. }; }),
  2009. $globals.AssociativeCollection);
  2010. $core.addMethod(
  2011. $core.method({
  2012. selector: "asHashedCollection",
  2013. protocol: "converting",
  2014. //>>excludeStart("ide", pragmas.excludeIdeData);
  2015. args: [],
  2016. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2017. referencedClasses: ["HashedCollection"],
  2018. //>>excludeEnd("ide");
  2019. pragmas: [],
  2020. messageSends: ["from:", "associations"]
  2021. }, function ($methodClass){ return function (){
  2022. var self=this,$self=this;
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. return $core.withContext(function($ctx1) {
  2025. //>>excludeEnd("ctx");
  2026. return $recv($globals.HashedCollection)._from_($self._associations());
  2027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2028. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  2029. //>>excludeEnd("ctx");
  2030. }; }),
  2031. $globals.AssociativeCollection);
  2032. $core.addMethod(
  2033. $core.method({
  2034. selector: "asJavaScriptObject",
  2035. protocol: "converting",
  2036. //>>excludeStart("ide", pragmas.excludeIdeData);
  2037. args: [],
  2038. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  2039. referencedClasses: ["HashedCollection"],
  2040. //>>excludeEnd("ide");
  2041. pragmas: [],
  2042. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2043. }, function ($methodClass){ return function (){
  2044. var self=this,$self=this;
  2045. var hash;
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. return $core.withContext(function($ctx1) {
  2048. //>>excludeEnd("ctx");
  2049. hash=$recv($globals.HashedCollection)._new();
  2050. $self._keysAndValuesDo_((function(key,value){
  2051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2052. return $core.withContext(function($ctx2) {
  2053. //>>excludeEnd("ctx");
  2054. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2056. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2057. //>>excludeEnd("ctx");
  2058. }));
  2059. return hash;
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  2062. //>>excludeEnd("ctx");
  2063. }; }),
  2064. $globals.AssociativeCollection);
  2065. $core.addMethod(
  2066. $core.method({
  2067. selector: "associations",
  2068. protocol: "accessing",
  2069. //>>excludeStart("ide", pragmas.excludeIdeData);
  2070. args: [],
  2071. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2072. referencedClasses: [],
  2073. //>>excludeEnd("ide");
  2074. pragmas: [],
  2075. messageSends: ["associationsDo:", "add:"]
  2076. }, function ($methodClass){ return function (){
  2077. var self=this,$self=this;
  2078. var associations;
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. return $core.withContext(function($ctx1) {
  2081. //>>excludeEnd("ctx");
  2082. associations=[];
  2083. $self._associationsDo_((function(each){
  2084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2085. return $core.withContext(function($ctx2) {
  2086. //>>excludeEnd("ctx");
  2087. return $recv(associations)._add_(each);
  2088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2090. //>>excludeEnd("ctx");
  2091. }));
  2092. return associations;
  2093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2094. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2095. //>>excludeEnd("ctx");
  2096. }; }),
  2097. $globals.AssociativeCollection);
  2098. $core.addMethod(
  2099. $core.method({
  2100. selector: "associationsDo:",
  2101. protocol: "enumerating",
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: ["aBlock"],
  2104. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2105. referencedClasses: ["Association"],
  2106. //>>excludeEnd("ide");
  2107. pragmas: [],
  2108. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2109. }, function ($methodClass){ return function (aBlock){
  2110. var self=this,$self=this;
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. return $core.withContext(function($ctx1) {
  2113. //>>excludeEnd("ctx");
  2114. $self._keysAndValuesDo_((function(key,value){
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. return $core.withContext(function($ctx2) {
  2117. //>>excludeEnd("ctx");
  2118. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2120. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2121. //>>excludeEnd("ctx");
  2122. }));
  2123. return self;
  2124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2125. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2126. //>>excludeEnd("ctx");
  2127. }; }),
  2128. $globals.AssociativeCollection);
  2129. $core.addMethod(
  2130. $core.method({
  2131. selector: "at:ifPresent:ifAbsent:",
  2132. protocol: "accessing",
  2133. //>>excludeStart("ide", pragmas.excludeIdeData);
  2134. args: ["aKey", "aBlock", "anotherBlock"],
  2135. 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 ]",
  2136. referencedClasses: [],
  2137. //>>excludeEnd("ide");
  2138. pragmas: [],
  2139. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2140. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2141. var self=this,$self=this;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx1) {
  2144. //>>excludeEnd("ctx");
  2145. if($core.assert($self._includesKey_(aKey))){
  2146. return $recv(aBlock)._value_($self._at_(aKey));
  2147. } else {
  2148. return $recv(anotherBlock)._value();
  2149. }
  2150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2151. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2152. //>>excludeEnd("ctx");
  2153. }; }),
  2154. $globals.AssociativeCollection);
  2155. $core.addMethod(
  2156. $core.method({
  2157. selector: "collect:",
  2158. protocol: "enumerating",
  2159. //>>excludeStart("ide", pragmas.excludeIdeData);
  2160. args: ["aBlock"],
  2161. 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",
  2162. referencedClasses: [],
  2163. //>>excludeEnd("ide");
  2164. pragmas: [],
  2165. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2166. }, function ($methodClass){ return function (aBlock){
  2167. var self=this,$self=this;
  2168. var newDict;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. return $core.withContext(function($ctx1) {
  2171. //>>excludeEnd("ctx");
  2172. newDict=$recv($self._class())._new();
  2173. $self._keysAndValuesDo_((function(key,value){
  2174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2175. return $core.withContext(function($ctx2) {
  2176. //>>excludeEnd("ctx");
  2177. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2179. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2180. //>>excludeEnd("ctx");
  2181. }));
  2182. return newDict;
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2185. //>>excludeEnd("ctx");
  2186. }; }),
  2187. $globals.AssociativeCollection);
  2188. $core.addMethod(
  2189. $core.method({
  2190. selector: "deepCopy",
  2191. protocol: "copying",
  2192. //>>excludeStart("ide", pragmas.excludeIdeData);
  2193. args: [],
  2194. 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",
  2195. referencedClasses: [],
  2196. //>>excludeEnd("ide");
  2197. pragmas: [],
  2198. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2199. }, function ($methodClass){ return function (){
  2200. var self=this,$self=this;
  2201. var copy;
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. return $core.withContext(function($ctx1) {
  2204. //>>excludeEnd("ctx");
  2205. copy=$recv($self._class())._new();
  2206. $self._keysAndValuesDo_((function(key,value){
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. return $core.withContext(function($ctx2) {
  2209. //>>excludeEnd("ctx");
  2210. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2213. //>>excludeEnd("ctx");
  2214. }));
  2215. return copy;
  2216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2217. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2218. //>>excludeEnd("ctx");
  2219. }; }),
  2220. $globals.AssociativeCollection);
  2221. $core.addMethod(
  2222. $core.method({
  2223. selector: "detect:ifNone:",
  2224. protocol: "enumerating",
  2225. //>>excludeStart("ide", pragmas.excludeIdeData);
  2226. args: ["aBlock", "anotherBlock"],
  2227. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2228. referencedClasses: [],
  2229. //>>excludeEnd("ide");
  2230. pragmas: [],
  2231. messageSends: ["detect:ifNone:", "values"]
  2232. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2233. var self=this,$self=this;
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. return $core.withContext(function($ctx1) {
  2236. //>>excludeEnd("ctx");
  2237. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2239. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2240. //>>excludeEnd("ctx");
  2241. }; }),
  2242. $globals.AssociativeCollection);
  2243. $core.addMethod(
  2244. $core.method({
  2245. selector: "do:",
  2246. protocol: "enumerating",
  2247. //>>excludeStart("ide", pragmas.excludeIdeData);
  2248. args: ["aBlock"],
  2249. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2250. referencedClasses: [],
  2251. //>>excludeEnd("ide");
  2252. pragmas: [],
  2253. messageSends: ["valuesDo:"]
  2254. }, function ($methodClass){ return function (aBlock){
  2255. var self=this,$self=this;
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. return $core.withContext(function($ctx1) {
  2258. //>>excludeEnd("ctx");
  2259. $self._valuesDo_(aBlock);
  2260. return self;
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2263. //>>excludeEnd("ctx");
  2264. }; }),
  2265. $globals.AssociativeCollection);
  2266. $core.addMethod(
  2267. $core.method({
  2268. selector: "includes:",
  2269. protocol: "enumerating",
  2270. //>>excludeStart("ide", pragmas.excludeIdeData);
  2271. args: ["anObject"],
  2272. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2273. referencedClasses: [],
  2274. //>>excludeEnd("ide");
  2275. pragmas: [],
  2276. messageSends: ["includes:", "values"]
  2277. }, function ($methodClass){ return function (anObject){
  2278. var self=this,$self=this;
  2279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2280. return $core.withContext(function($ctx1) {
  2281. //>>excludeEnd("ctx");
  2282. return $recv($self._values())._includes_(anObject);
  2283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2284. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2285. //>>excludeEnd("ctx");
  2286. }; }),
  2287. $globals.AssociativeCollection);
  2288. $core.addMethod(
  2289. $core.method({
  2290. selector: "includesKey:",
  2291. protocol: "testing",
  2292. //>>excludeStart("ide", pragmas.excludeIdeData);
  2293. args: ["aKey"],
  2294. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2295. referencedClasses: [],
  2296. //>>excludeEnd("ide");
  2297. pragmas: [],
  2298. messageSends: ["subclassResponsibility"]
  2299. }, function ($methodClass){ return function (aKey){
  2300. var self=this,$self=this;
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. return $core.withContext(function($ctx1) {
  2303. //>>excludeEnd("ctx");
  2304. $self._subclassResponsibility();
  2305. return self;
  2306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2307. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2308. //>>excludeEnd("ctx");
  2309. }; }),
  2310. $globals.AssociativeCollection);
  2311. $core.addMethod(
  2312. $core.method({
  2313. selector: "indexOf:ifAbsent:",
  2314. protocol: "accessing",
  2315. //>>excludeStart("ide", pragmas.excludeIdeData);
  2316. args: ["anObject", "aBlock"],
  2317. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2318. referencedClasses: [],
  2319. //>>excludeEnd("ide");
  2320. pragmas: [],
  2321. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2322. }, function ($methodClass){ return function (anObject,aBlock){
  2323. var self=this,$self=this;
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. return $core.withContext(function($ctx1) {
  2326. //>>excludeEnd("ctx");
  2327. return $recv($self._keys())._detect_ifNone_((function(each){
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. return $core.withContext(function($ctx2) {
  2330. //>>excludeEnd("ctx");
  2331. return $recv($self._at_(each)).__eq(anObject);
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2334. //>>excludeEnd("ctx");
  2335. }),aBlock);
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2338. //>>excludeEnd("ctx");
  2339. }; }),
  2340. $globals.AssociativeCollection);
  2341. $core.addMethod(
  2342. $core.method({
  2343. selector: "keyAtValue:",
  2344. protocol: "accessing",
  2345. //>>excludeStart("ide", pragmas.excludeIdeData);
  2346. args: ["anObject"],
  2347. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2348. referencedClasses: [],
  2349. //>>excludeEnd("ide");
  2350. pragmas: [],
  2351. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2352. }, function ($methodClass){ return function (anObject){
  2353. var self=this,$self=this;
  2354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2355. return $core.withContext(function($ctx1) {
  2356. //>>excludeEnd("ctx");
  2357. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2359. return $core.withContext(function($ctx2) {
  2360. //>>excludeEnd("ctx");
  2361. return $self._errorNotFound();
  2362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2364. //>>excludeEnd("ctx");
  2365. }));
  2366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2367. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2368. //>>excludeEnd("ctx");
  2369. }; }),
  2370. $globals.AssociativeCollection);
  2371. $core.addMethod(
  2372. $core.method({
  2373. selector: "keyAtValue:ifAbsent:",
  2374. protocol: "accessing",
  2375. //>>excludeStart("ide", pragmas.excludeIdeData);
  2376. args: ["anObject", "aBlock"],
  2377. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2378. referencedClasses: [],
  2379. //>>excludeEnd("ide");
  2380. pragmas: [],
  2381. messageSends: ["indexOf:ifAbsent:"]
  2382. }, function ($methodClass){ return function (anObject,aBlock){
  2383. var self=this,$self=this;
  2384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2385. return $core.withContext(function($ctx1) {
  2386. //>>excludeEnd("ctx");
  2387. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2389. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2390. //>>excludeEnd("ctx");
  2391. }; }),
  2392. $globals.AssociativeCollection);
  2393. $core.addMethod(
  2394. $core.method({
  2395. selector: "keys",
  2396. protocol: "accessing",
  2397. //>>excludeStart("ide", pragmas.excludeIdeData);
  2398. args: [],
  2399. source: "keys\x0a\x09self subclassResponsibility",
  2400. referencedClasses: [],
  2401. //>>excludeEnd("ide");
  2402. pragmas: [],
  2403. messageSends: ["subclassResponsibility"]
  2404. }, function ($methodClass){ return function (){
  2405. var self=this,$self=this;
  2406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2407. return $core.withContext(function($ctx1) {
  2408. //>>excludeEnd("ctx");
  2409. $self._subclassResponsibility();
  2410. return self;
  2411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2412. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2413. //>>excludeEnd("ctx");
  2414. }; }),
  2415. $globals.AssociativeCollection);
  2416. $core.addMethod(
  2417. $core.method({
  2418. selector: "keysAndValuesDo:",
  2419. protocol: "enumerating",
  2420. //>>excludeStart("ide", pragmas.excludeIdeData);
  2421. args: ["aBlock"],
  2422. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2423. referencedClasses: [],
  2424. //>>excludeEnd("ide");
  2425. pragmas: [],
  2426. messageSends: ["keysDo:", "value:value:", "at:"]
  2427. }, function ($methodClass){ return function (aBlock){
  2428. var self=this,$self=this;
  2429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2430. return $core.withContext(function($ctx1) {
  2431. //>>excludeEnd("ctx");
  2432. $self._keysDo_((function(each){
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. return $core.withContext(function($ctx2) {
  2435. //>>excludeEnd("ctx");
  2436. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2439. //>>excludeEnd("ctx");
  2440. }));
  2441. return self;
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2444. //>>excludeEnd("ctx");
  2445. }; }),
  2446. $globals.AssociativeCollection);
  2447. $core.addMethod(
  2448. $core.method({
  2449. selector: "keysDo:",
  2450. protocol: "enumerating",
  2451. //>>excludeStart("ide", pragmas.excludeIdeData);
  2452. args: ["aBlock"],
  2453. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2454. referencedClasses: [],
  2455. //>>excludeEnd("ide");
  2456. pragmas: [],
  2457. messageSends: ["subclassResponsibility"]
  2458. }, function ($methodClass){ return function (aBlock){
  2459. var self=this,$self=this;
  2460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2461. return $core.withContext(function($ctx1) {
  2462. //>>excludeEnd("ctx");
  2463. $self._subclassResponsibility();
  2464. return self;
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2467. //>>excludeEnd("ctx");
  2468. }; }),
  2469. $globals.AssociativeCollection);
  2470. $core.addMethod(
  2471. $core.method({
  2472. selector: "printOn:",
  2473. protocol: "printing",
  2474. //>>excludeStart("ide", pragmas.excludeIdeData);
  2475. args: ["aStream"],
  2476. 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: ')'",
  2477. referencedClasses: [],
  2478. //>>excludeEnd("ide");
  2479. pragmas: [],
  2480. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2481. }, function ($methodClass){ return function (aStream){
  2482. var self=this,$self=this;
  2483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2484. return $core.withContext(function($ctx1) {
  2485. //>>excludeEnd("ctx");
  2486. [(
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. $ctx1.supercall = true,
  2489. //>>excludeEnd("ctx");
  2490. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2493. //>>excludeEnd("ctx");
  2494. ][0];
  2495. [$recv(aStream)._nextPutAll_(" (")
  2496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2497. ,$ctx1.sendIdx["nextPutAll:"]=1
  2498. //>>excludeEnd("ctx");
  2499. ][0];
  2500. $recv($self._associations())._do_separatedBy_((function(each){
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. return $core.withContext(function($ctx2) {
  2503. //>>excludeEnd("ctx");
  2504. return $recv(each)._printOn_(aStream);
  2505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2507. //>>excludeEnd("ctx");
  2508. }),(function(){
  2509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2510. return $core.withContext(function($ctx2) {
  2511. //>>excludeEnd("ctx");
  2512. return [$recv(aStream)._nextPutAll_(" , ")
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. ,$ctx2.sendIdx["nextPutAll:"]=2
  2515. //>>excludeEnd("ctx");
  2516. ][0];
  2517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2519. //>>excludeEnd("ctx");
  2520. }));
  2521. $recv(aStream)._nextPutAll_(")");
  2522. return self;
  2523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2524. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2525. //>>excludeEnd("ctx");
  2526. }; }),
  2527. $globals.AssociativeCollection);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "remove:ifAbsent:",
  2531. protocol: "adding/removing",
  2532. //>>excludeStart("ide", pragmas.excludeIdeData);
  2533. args: ["aKey", "aBlock"],
  2534. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2535. referencedClasses: [],
  2536. //>>excludeEnd("ide");
  2537. pragmas: [],
  2538. messageSends: ["removeKey:ifAbsent:"]
  2539. }, function ($methodClass){ return function (aKey,aBlock){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2546. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2547. //>>excludeEnd("ctx");
  2548. }; }),
  2549. $globals.AssociativeCollection);
  2550. $core.addMethod(
  2551. $core.method({
  2552. selector: "removeAll",
  2553. protocol: "adding/removing",
  2554. //>>excludeStart("ide", pragmas.excludeIdeData);
  2555. args: [],
  2556. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2557. referencedClasses: [],
  2558. //>>excludeEnd("ide");
  2559. pragmas: [],
  2560. messageSends: ["do:", "keys", "removeKey:"]
  2561. }, function ($methodClass){ return function (){
  2562. var self=this,$self=this;
  2563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2564. return $core.withContext(function($ctx1) {
  2565. //>>excludeEnd("ctx");
  2566. return $recv($self._keys())._do_((function(each){
  2567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2568. return $core.withContext(function($ctx2) {
  2569. //>>excludeEnd("ctx");
  2570. return $self._removeKey_(each);
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2573. //>>excludeEnd("ctx");
  2574. }));
  2575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2576. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2577. //>>excludeEnd("ctx");
  2578. }; }),
  2579. $globals.AssociativeCollection);
  2580. $core.addMethod(
  2581. $core.method({
  2582. selector: "removeKey:",
  2583. protocol: "adding/removing",
  2584. //>>excludeStart("ide", pragmas.excludeIdeData);
  2585. args: ["aKey"],
  2586. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2587. referencedClasses: [],
  2588. //>>excludeEnd("ide");
  2589. pragmas: [],
  2590. messageSends: ["remove:"]
  2591. }, function ($methodClass){ return function (aKey){
  2592. var self=this,$self=this;
  2593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2594. return $core.withContext(function($ctx1) {
  2595. //>>excludeEnd("ctx");
  2596. return $self._remove_(aKey);
  2597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2598. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2599. //>>excludeEnd("ctx");
  2600. }; }),
  2601. $globals.AssociativeCollection);
  2602. $core.addMethod(
  2603. $core.method({
  2604. selector: "removeKey:ifAbsent:",
  2605. protocol: "adding/removing",
  2606. //>>excludeStart("ide", pragmas.excludeIdeData);
  2607. args: ["aKey", "aBlock"],
  2608. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2609. referencedClasses: [],
  2610. //>>excludeEnd("ide");
  2611. pragmas: [],
  2612. messageSends: ["subclassResponsibility"]
  2613. }, function ($methodClass){ return function (aKey,aBlock){
  2614. var self=this,$self=this;
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. return $core.withContext(function($ctx1) {
  2617. //>>excludeEnd("ctx");
  2618. $self._subclassResponsibility();
  2619. return self;
  2620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2621. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2622. //>>excludeEnd("ctx");
  2623. }; }),
  2624. $globals.AssociativeCollection);
  2625. $core.addMethod(
  2626. $core.method({
  2627. selector: "select:",
  2628. protocol: "enumerating",
  2629. //>>excludeStart("ide", pragmas.excludeIdeData);
  2630. args: ["aBlock"],
  2631. 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",
  2632. referencedClasses: [],
  2633. //>>excludeEnd("ide");
  2634. pragmas: [],
  2635. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2636. }, function ($methodClass){ return function (aBlock){
  2637. var self=this,$self=this;
  2638. var newDict;
  2639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2640. return $core.withContext(function($ctx1) {
  2641. //>>excludeEnd("ctx");
  2642. newDict=$recv($self._class())._new();
  2643. $self._keysAndValuesDo_((function(key,value){
  2644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2645. return $core.withContext(function($ctx2) {
  2646. //>>excludeEnd("ctx");
  2647. if($core.assert($recv(aBlock)._value_(value))){
  2648. return $recv(newDict)._at_put_(key,value);
  2649. }
  2650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2651. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2652. //>>excludeEnd("ctx");
  2653. }));
  2654. return newDict;
  2655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2656. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2657. //>>excludeEnd("ctx");
  2658. }; }),
  2659. $globals.AssociativeCollection);
  2660. $core.addMethod(
  2661. $core.method({
  2662. selector: "select:thenCollect:",
  2663. protocol: "enumerating",
  2664. //>>excludeStart("ide", pragmas.excludeIdeData);
  2665. args: ["selectBlock", "collectBlock"],
  2666. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  2667. referencedClasses: [],
  2668. //>>excludeEnd("ide");
  2669. pragmas: [],
  2670. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2671. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2672. var self=this,$self=this;
  2673. var newDict;
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx1) {
  2676. //>>excludeEnd("ctx");
  2677. newDict=$recv($self._class())._new();
  2678. $self._keysAndValuesDo_((function(key,value){
  2679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2680. return $core.withContext(function($ctx2) {
  2681. //>>excludeEnd("ctx");
  2682. if($core.assert([$recv(selectBlock)._value_(value)
  2683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2684. ,$ctx2.sendIdx["value:"]=1
  2685. //>>excludeEnd("ctx");
  2686. ][0])){
  2687. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2688. }
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2691. //>>excludeEnd("ctx");
  2692. }));
  2693. return newDict;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2696. //>>excludeEnd("ctx");
  2697. }; }),
  2698. $globals.AssociativeCollection);
  2699. $core.addMethod(
  2700. $core.method({
  2701. selector: "shallowCopy",
  2702. protocol: "copying",
  2703. //>>excludeStart("ide", pragmas.excludeIdeData);
  2704. args: [],
  2705. 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",
  2706. referencedClasses: [],
  2707. //>>excludeEnd("ide");
  2708. pragmas: [],
  2709. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2710. }, function ($methodClass){ return function (){
  2711. var self=this,$self=this;
  2712. var copy;
  2713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2714. return $core.withContext(function($ctx1) {
  2715. //>>excludeEnd("ctx");
  2716. copy=$recv($self._class())._new();
  2717. $self._keysAndValuesDo_((function(key,value){
  2718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2719. return $core.withContext(function($ctx2) {
  2720. //>>excludeEnd("ctx");
  2721. return $recv(copy)._at_put_(key,value);
  2722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2723. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2724. //>>excludeEnd("ctx");
  2725. }));
  2726. return copy;
  2727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2728. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2729. //>>excludeEnd("ctx");
  2730. }; }),
  2731. $globals.AssociativeCollection);
  2732. $core.addMethod(
  2733. $core.method({
  2734. selector: "shortenedPrintString",
  2735. protocol: "printing",
  2736. //>>excludeStart("ide", pragmas.excludeIdeData);
  2737. args: [],
  2738. source: "shortenedPrintString\x0a\x09^ self size <= 1\x0a\x09\x09ifTrue: [ self printString ]\x0a\x09\x09ifFalse: [ | key | key := self keys anyOne. (self copyEmpty at: key put: (self at: key); yourself) printString, ' ... ', (self size - 1) asString, ' more items' ]",
  2739. referencedClasses: [],
  2740. //>>excludeEnd("ide");
  2741. pragmas: [],
  2742. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", "anyOne", "keys", ",", "at:put:", "copyEmpty", "at:", "yourself", "asString", "-"]
  2743. }, function ($methodClass){ return function (){
  2744. var self=this,$self=this;
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. return $core.withContext(function($ctx1) {
  2747. //>>excludeEnd("ctx");
  2748. var $1;
  2749. if($core.assert($recv([$self._size()
  2750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2751. ,$ctx1.sendIdx["size"]=1
  2752. //>>excludeEnd("ctx");
  2753. ][0]).__lt_eq((1)))){
  2754. return [$self._printString()
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. ,$ctx1.sendIdx["printString"]=1
  2757. //>>excludeEnd("ctx");
  2758. ][0];
  2759. } else {
  2760. var key;
  2761. key=$recv($self._keys())._anyOne();
  2762. $1=$self._copyEmpty();
  2763. $recv($1)._at_put_(key,$self._at_(key));
  2764. return [$recv([$recv($recv($recv($recv($1)._yourself())._printString()).__comma(" ... ")).__comma($recv($recv($self._size()).__minus((1)))._asString())
  2765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2766. ,$ctx1.sendIdx[","]=2
  2767. //>>excludeEnd("ctx");
  2768. ][0]).__comma(" more items")
  2769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2770. ,$ctx1.sendIdx[","]=1
  2771. //>>excludeEnd("ctx");
  2772. ][0];
  2773. }
  2774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2775. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  2776. //>>excludeEnd("ctx");
  2777. }; }),
  2778. $globals.AssociativeCollection);
  2779. $core.addMethod(
  2780. $core.method({
  2781. selector: "size",
  2782. protocol: "accessing",
  2783. //>>excludeStart("ide", pragmas.excludeIdeData);
  2784. args: [],
  2785. source: "size\x0a\x09^ self keys size",
  2786. referencedClasses: [],
  2787. //>>excludeEnd("ide");
  2788. pragmas: [],
  2789. messageSends: ["size", "keys"]
  2790. }, function ($methodClass){ return function (){
  2791. var self=this,$self=this;
  2792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2793. return $core.withContext(function($ctx1) {
  2794. //>>excludeEnd("ctx");
  2795. return $recv($self._keys())._size();
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2798. //>>excludeEnd("ctx");
  2799. }; }),
  2800. $globals.AssociativeCollection);
  2801. $core.addMethod(
  2802. $core.method({
  2803. selector: "values",
  2804. protocol: "accessing",
  2805. //>>excludeStart("ide", pragmas.excludeIdeData);
  2806. args: [],
  2807. source: "values\x0a\x09self subclassResponsibility",
  2808. referencedClasses: [],
  2809. //>>excludeEnd("ide");
  2810. pragmas: [],
  2811. messageSends: ["subclassResponsibility"]
  2812. }, function ($methodClass){ return function (){
  2813. var self=this,$self=this;
  2814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2815. return $core.withContext(function($ctx1) {
  2816. //>>excludeEnd("ctx");
  2817. $self._subclassResponsibility();
  2818. return self;
  2819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2820. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2821. //>>excludeEnd("ctx");
  2822. }; }),
  2823. $globals.AssociativeCollection);
  2824. $core.addMethod(
  2825. $core.method({
  2826. selector: "valuesDo:",
  2827. protocol: "enumerating",
  2828. //>>excludeStart("ide", pragmas.excludeIdeData);
  2829. args: ["aBlock"],
  2830. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2831. referencedClasses: [],
  2832. //>>excludeEnd("ide");
  2833. pragmas: [],
  2834. messageSends: ["subclassResponsibility"]
  2835. }, function ($methodClass){ return function (aBlock){
  2836. var self=this,$self=this;
  2837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2838. return $core.withContext(function($ctx1) {
  2839. //>>excludeEnd("ctx");
  2840. $self._subclassResponsibility();
  2841. return self;
  2842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2843. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2844. //>>excludeEnd("ctx");
  2845. }; }),
  2846. $globals.AssociativeCollection);
  2847. $core.addMethod(
  2848. $core.method({
  2849. selector: "withIndexDo:",
  2850. protocol: "enumerating",
  2851. //>>excludeStart("ide", pragmas.excludeIdeData);
  2852. args: ["aBlock"],
  2853. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2854. referencedClasses: [],
  2855. //>>excludeEnd("ide");
  2856. pragmas: [],
  2857. messageSends: ["keysAndValuesDo:", "value:value:"]
  2858. }, function ($methodClass){ return function (aBlock){
  2859. var self=this,$self=this;
  2860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2861. return $core.withContext(function($ctx1) {
  2862. //>>excludeEnd("ctx");
  2863. $self._keysAndValuesDo_((function(key,value){
  2864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2865. return $core.withContext(function($ctx2) {
  2866. //>>excludeEnd("ctx");
  2867. return $recv(aBlock)._value_value_(value,key);
  2868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2869. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2870. //>>excludeEnd("ctx");
  2871. }));
  2872. return self;
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2875. //>>excludeEnd("ctx");
  2876. }; }),
  2877. $globals.AssociativeCollection);
  2878. $core.addMethod(
  2879. $core.method({
  2880. selector: "from:",
  2881. protocol: "instance creation",
  2882. //>>excludeStart("ide", pragmas.excludeIdeData);
  2883. args: ["aCollection"],
  2884. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2885. referencedClasses: [],
  2886. //>>excludeEnd("ide");
  2887. pragmas: [],
  2888. messageSends: ["new", "do:", "add:"]
  2889. }, function ($methodClass){ return function (aCollection){
  2890. var self=this,$self=this;
  2891. var newCollection;
  2892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2893. return $core.withContext(function($ctx1) {
  2894. //>>excludeEnd("ctx");
  2895. newCollection=$self._new();
  2896. $recv(aCollection)._do_((function(each){
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. return $core.withContext(function($ctx2) {
  2899. //>>excludeEnd("ctx");
  2900. return $recv(newCollection)._add_(each);
  2901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2903. //>>excludeEnd("ctx");
  2904. }));
  2905. return newCollection;
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2908. //>>excludeEnd("ctx");
  2909. }; }),
  2910. $globals.AssociativeCollection.a$cls);
  2911. $core.addMethod(
  2912. $core.method({
  2913. selector: "fromPairs:",
  2914. protocol: "instance creation",
  2915. //>>excludeStart("ide", pragmas.excludeIdeData);
  2916. args: ["aCollection"],
  2917. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2918. referencedClasses: [],
  2919. //>>excludeEnd("ide");
  2920. pragmas: [],
  2921. messageSends: ["from:"]
  2922. }, function ($methodClass){ return function (aCollection){
  2923. var self=this,$self=this;
  2924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2925. return $core.withContext(function($ctx1) {
  2926. //>>excludeEnd("ctx");
  2927. return $self._from_(aCollection);
  2928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2929. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2930. //>>excludeEnd("ctx");
  2931. }; }),
  2932. $globals.AssociativeCollection.a$cls);
  2933. $core.addMethod(
  2934. $core.method({
  2935. selector: "newFromPairs:",
  2936. protocol: "instance creation",
  2937. //>>excludeStart("ide", pragmas.excludeIdeData);
  2938. args: ["aCollection"],
  2939. 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",
  2940. referencedClasses: [],
  2941. //>>excludeEnd("ide");
  2942. pragmas: [],
  2943. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2944. }, function ($methodClass){ return function (aCollection){
  2945. var self=this,$self=this;
  2946. var newCollection;
  2947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2948. return $core.withContext(function($ctx1) {
  2949. //>>excludeEnd("ctx");
  2950. if(!$core.assert($recv([$recv(aCollection)._size()
  2951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2952. ,$ctx1.sendIdx["size"]=1
  2953. //>>excludeEnd("ctx");
  2954. ][0])._even())){
  2955. $self._error_("#newFromPairs only accepts arrays of an even length");
  2956. }
  2957. newCollection=$self._new();
  2958. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2960. return $core.withContext(function($ctx2) {
  2961. //>>excludeEnd("ctx");
  2962. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. ,$ctx2.sendIdx["at:"]=1
  2965. //>>excludeEnd("ctx");
  2966. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2969. //>>excludeEnd("ctx");
  2970. }));
  2971. return newCollection;
  2972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2973. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2974. //>>excludeEnd("ctx");
  2975. }; }),
  2976. $globals.AssociativeCollection.a$cls);
  2977. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2978. //>>excludeStart("ide", pragmas.excludeIdeData);
  2979. $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.";
  2980. //>>excludeEnd("ide");
  2981. $core.addMethod(
  2982. $core.method({
  2983. selector: "at:ifAbsent:",
  2984. protocol: "accessing",
  2985. //>>excludeStart("ide", pragmas.excludeIdeData);
  2986. args: ["aKey", "aBlock"],
  2987. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09'>",
  2988. referencedClasses: [],
  2989. //>>excludeEnd("ide");
  2990. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2991. messageSends: []
  2992. }, function ($methodClass){ return function (aKey,aBlock){
  2993. var self=this,$self=this;
  2994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2995. return $core.withContext(function($ctx1) {
  2996. //>>excludeEnd("ctx");
  2997. var index = $self._positionOfKey_(aKey);
  2998. return index >=0 ? $self.values[index] : aBlock._value();
  2999. ;
  3000. return self;
  3001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3002. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3003. //>>excludeEnd("ctx");
  3004. }; }),
  3005. $globals.Dictionary);
  3006. $core.addMethod(
  3007. $core.method({
  3008. selector: "at:put:",
  3009. protocol: "accessing",
  3010. //>>excludeStart("ide", pragmas.excludeIdeData);
  3011. args: ["aKey", "aValue"],
  3012. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\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'>",
  3013. referencedClasses: [],
  3014. //>>excludeEnd("ide");
  3015. pragmas: [["inlineJS:", ["\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"]]],
  3016. messageSends: []
  3017. }, function ($methodClass){ return function (aKey,aValue){
  3018. var self=this,$self=this;
  3019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3020. return $core.withContext(function($ctx1) {
  3021. //>>excludeEnd("ctx");
  3022. var index = $self._positionOfKey_(aKey);
  3023. if(index === -1) {
  3024. var keys = $self.keys;
  3025. index = keys.length;
  3026. keys.push(aKey);
  3027. }
  3028. return $self.values[index] = aValue;
  3029. ;
  3030. return self;
  3031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3032. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3033. //>>excludeEnd("ctx");
  3034. }; }),
  3035. $globals.Dictionary);
  3036. $core.addMethod(
  3037. $core.method({
  3038. selector: "includesKey:",
  3039. protocol: "testing",
  3040. //>>excludeStart("ide", pragmas.excludeIdeData);
  3041. args: ["aKey"],
  3042. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3043. referencedClasses: [],
  3044. //>>excludeEnd("ide");
  3045. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  3046. messageSends: []
  3047. }, function ($methodClass){ return function (aKey){
  3048. var self=this,$self=this;
  3049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3050. return $core.withContext(function($ctx1) {
  3051. //>>excludeEnd("ctx");
  3052. return $self._positionOfKey_(aKey) >= 0;;
  3053. return self;
  3054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3055. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3056. //>>excludeEnd("ctx");
  3057. }; }),
  3058. $globals.Dictionary);
  3059. $core.addMethod(
  3060. $core.method({
  3061. selector: "indexOf:ifAbsent:",
  3062. protocol: "accessing",
  3063. //>>excludeStart("ide", pragmas.excludeIdeData);
  3064. args: ["anObject", "aBlock"],
  3065. 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 ]",
  3066. referencedClasses: [],
  3067. //>>excludeEnd("ide");
  3068. pragmas: [],
  3069. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3070. }, function ($methodClass){ return function (anObject,aBlock){
  3071. var self=this,$self=this;
  3072. var index;
  3073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3074. return $core.withContext(function($ctx1) {
  3075. //>>excludeEnd("ctx");
  3076. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  3077. return (0);
  3078. }));
  3079. if($core.assert($recv(index).__eq((0)))){
  3080. return $recv(aBlock)._value();
  3081. } else {
  3082. return $recv($self.keys)._at_(index);
  3083. }
  3084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3085. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  3086. //>>excludeEnd("ctx");
  3087. }; }),
  3088. $globals.Dictionary);
  3089. $core.addMethod(
  3090. $core.method({
  3091. selector: "initialize",
  3092. protocol: "initialization",
  3093. //>>excludeStart("ide", pragmas.excludeIdeData);
  3094. args: [],
  3095. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3096. referencedClasses: [],
  3097. //>>excludeEnd("ide");
  3098. pragmas: [],
  3099. messageSends: ["initialize"]
  3100. }, function ($methodClass){ return function (){
  3101. var self=this,$self=this;
  3102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3103. return $core.withContext(function($ctx1) {
  3104. //>>excludeEnd("ctx");
  3105. [(
  3106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3107. $ctx1.supercall = true,
  3108. //>>excludeEnd("ctx");
  3109. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  3110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3111. ,$ctx1.supercall = false
  3112. //>>excludeEnd("ctx");
  3113. ][0];
  3114. $self.keys=[];
  3115. $self.values=[];
  3116. return self;
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3119. //>>excludeEnd("ctx");
  3120. }; }),
  3121. $globals.Dictionary);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "keys",
  3125. protocol: "accessing",
  3126. //>>excludeStart("ide", pragmas.excludeIdeData);
  3127. args: [],
  3128. source: "keys\x0a\x09^ keys copy",
  3129. referencedClasses: [],
  3130. //>>excludeEnd("ide");
  3131. pragmas: [],
  3132. messageSends: ["copy"]
  3133. }, function ($methodClass){ return function (){
  3134. var self=this,$self=this;
  3135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3136. return $core.withContext(function($ctx1) {
  3137. //>>excludeEnd("ctx");
  3138. return $recv($self.keys)._copy();
  3139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3140. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3141. //>>excludeEnd("ctx");
  3142. }; }),
  3143. $globals.Dictionary);
  3144. $core.addMethod(
  3145. $core.method({
  3146. selector: "keysAndValuesDo:",
  3147. protocol: "enumerating",
  3148. //>>excludeStart("ide", pragmas.excludeIdeData);
  3149. args: ["aBlock"],
  3150. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3151. referencedClasses: [],
  3152. //>>excludeEnd("ide");
  3153. pragmas: [],
  3154. messageSends: ["with:do:"]
  3155. }, function ($methodClass){ return function (aBlock){
  3156. var self=this,$self=this;
  3157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3158. return $core.withContext(function($ctx1) {
  3159. //>>excludeEnd("ctx");
  3160. return $recv($self.keys)._with_do_($self.values,aBlock);
  3161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3162. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3163. //>>excludeEnd("ctx");
  3164. }; }),
  3165. $globals.Dictionary);
  3166. $core.addMethod(
  3167. $core.method({
  3168. selector: "keysDo:",
  3169. protocol: "enumerating",
  3170. //>>excludeStart("ide", pragmas.excludeIdeData);
  3171. args: ["aBlock"],
  3172. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3173. referencedClasses: [],
  3174. //>>excludeEnd("ide");
  3175. pragmas: [],
  3176. messageSends: ["do:"]
  3177. }, function ($methodClass){ return function (aBlock){
  3178. var self=this,$self=this;
  3179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3180. return $core.withContext(function($ctx1) {
  3181. //>>excludeEnd("ctx");
  3182. return $recv($self.keys)._do_(aBlock);
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3185. //>>excludeEnd("ctx");
  3186. }; }),
  3187. $globals.Dictionary);
  3188. $core.addMethod(
  3189. $core.method({
  3190. selector: "positionOfKey:",
  3191. protocol: "private",
  3192. //>>excludeStart("ide", pragmas.excludeIdeData);
  3193. args: ["anObject"],
  3194. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\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'>",
  3195. referencedClasses: [],
  3196. //>>excludeEnd("ide");
  3197. pragmas: [["inlineJS:", ["\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"]]],
  3198. messageSends: []
  3199. }, function ($methodClass){ return function (anObject){
  3200. var self=this,$self=this;
  3201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3202. return $core.withContext(function($ctx1) {
  3203. //>>excludeEnd("ctx");
  3204. var keys = $self.keys;
  3205. for(var i=0;i<keys.length;i++){
  3206. if(keys[i].__eq(anObject)) { return i;}
  3207. }
  3208. return -1;
  3209. ;
  3210. return self;
  3211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3212. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3213. //>>excludeEnd("ctx");
  3214. }; }),
  3215. $globals.Dictionary);
  3216. $core.addMethod(
  3217. $core.method({
  3218. selector: "removeAll",
  3219. protocol: "adding/removing",
  3220. //>>excludeStart("ide", pragmas.excludeIdeData);
  3221. args: [],
  3222. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3223. referencedClasses: [],
  3224. //>>excludeEnd("ide");
  3225. pragmas: [],
  3226. messageSends: ["removeAll"]
  3227. }, function ($methodClass){ return function (){
  3228. var self=this,$self=this;
  3229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3230. return $core.withContext(function($ctx1) {
  3231. //>>excludeEnd("ctx");
  3232. [$recv($self.keys)._removeAll()
  3233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3234. ,$ctx1.sendIdx["removeAll"]=1
  3235. //>>excludeEnd("ctx");
  3236. ][0];
  3237. $recv($self.values)._removeAll();
  3238. return self;
  3239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3240. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3241. //>>excludeEnd("ctx");
  3242. }; }),
  3243. $globals.Dictionary);
  3244. $core.addMethod(
  3245. $core.method({
  3246. selector: "removeKey:ifAbsent:",
  3247. protocol: "adding/removing",
  3248. //>>excludeStart("ide", pragmas.excludeIdeData);
  3249. args: ["aKey", "aBlock"],
  3250. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\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'>",
  3251. referencedClasses: [],
  3252. //>>excludeEnd("ide");
  3253. pragmas: [["inlineJS:", ["\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"]]],
  3254. messageSends: []
  3255. }, function ($methodClass){ return function (aKey,aBlock){
  3256. var self=this,$self=this;
  3257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3258. return $core.withContext(function($ctx1) {
  3259. //>>excludeEnd("ctx");
  3260. var index = $self._positionOfKey_(aKey);
  3261. if(index === -1) {
  3262. return aBlock._value()
  3263. } else {
  3264. var keys = $self.keys, values = $self.values;
  3265. var value = values[index], l = keys.length;
  3266. keys[index] = keys[l-1];
  3267. keys.pop();
  3268. values[index] = values[l-1];
  3269. values.pop();
  3270. return value;
  3271. }
  3272. ;
  3273. return self;
  3274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3275. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3276. //>>excludeEnd("ctx");
  3277. }; }),
  3278. $globals.Dictionary);
  3279. $core.addMethod(
  3280. $core.method({
  3281. selector: "values",
  3282. protocol: "accessing",
  3283. //>>excludeStart("ide", pragmas.excludeIdeData);
  3284. args: [],
  3285. source: "values\x0a\x09^ values",
  3286. referencedClasses: [],
  3287. //>>excludeEnd("ide");
  3288. pragmas: [],
  3289. messageSends: []
  3290. }, function ($methodClass){ return function (){
  3291. var self=this,$self=this;
  3292. return $self.values;
  3293. }; }),
  3294. $globals.Dictionary);
  3295. $core.addMethod(
  3296. $core.method({
  3297. selector: "valuesDo:",
  3298. protocol: "enumerating",
  3299. //>>excludeStart("ide", pragmas.excludeIdeData);
  3300. args: ["aBlock"],
  3301. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3302. referencedClasses: [],
  3303. //>>excludeEnd("ide");
  3304. pragmas: [],
  3305. messageSends: ["do:"]
  3306. }, function ($methodClass){ return function (aBlock){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. return $recv($self.values)._do_(aBlock);
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3314. //>>excludeEnd("ctx");
  3315. }; }),
  3316. $globals.Dictionary);
  3317. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3318. //>>excludeStart("ide", pragmas.excludeIdeData);
  3319. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3320. //>>excludeEnd("ide");
  3321. $core.addMethod(
  3322. $core.method({
  3323. selector: "asJavaScriptSource",
  3324. protocol: "accessing",
  3325. //>>excludeStart("ide", pragmas.excludeIdeData);
  3326. args: [],
  3327. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str nextPut: '{'.\x0a\x09\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09str nextPutAll: key asJavaScriptSource; nextPut: ':'; nextPutAll: value asJavaScriptSource; nextPut: ',' ].\x0a\x09\x09str skip: -1; nextPut: '}' ]",
  3328. referencedClasses: ["String"],
  3329. //>>excludeEnd("ide");
  3330. pragmas: [],
  3331. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3332. }, function ($methodClass){ return function (){
  3333. var self=this,$self=this;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. return $core.withContext(function($ctx1) {
  3336. //>>excludeEnd("ctx");
  3337. return $recv($globals.String)._streamContents_((function(str){
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. return $core.withContext(function($ctx2) {
  3340. //>>excludeEnd("ctx");
  3341. [$recv(str)._nextPut_("{")
  3342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3343. ,$ctx2.sendIdx["nextPut:"]=1
  3344. //>>excludeEnd("ctx");
  3345. ][0];
  3346. $self._keysAndValuesDo_((function(key,value){
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. return $core.withContext(function($ctx3) {
  3349. //>>excludeEnd("ctx");
  3350. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3353. //>>excludeEnd("ctx");
  3354. ][0])
  3355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3356. ,$ctx3.sendIdx["nextPutAll:"]=1
  3357. //>>excludeEnd("ctx");
  3358. ][0];
  3359. [$recv(str)._nextPut_(":")
  3360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3361. ,$ctx3.sendIdx["nextPut:"]=2
  3362. //>>excludeEnd("ctx");
  3363. ][0];
  3364. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3365. return [$recv(str)._nextPut_(",")
  3366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3367. ,$ctx3.sendIdx["nextPut:"]=3
  3368. //>>excludeEnd("ctx");
  3369. ][0];
  3370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3371. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3372. //>>excludeEnd("ctx");
  3373. }));
  3374. $recv(str)._skip_((-1));
  3375. return $recv(str)._nextPut_("}");
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3378. //>>excludeEnd("ctx");
  3379. }));
  3380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3381. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3382. //>>excludeEnd("ctx");
  3383. }; }),
  3384. $globals.HashedCollection);
  3385. $core.addMethod(
  3386. $core.method({
  3387. selector: "at:ifAbsent:",
  3388. protocol: "accessing",
  3389. //>>excludeStart("ide", pragmas.excludeIdeData);
  3390. args: ["aKey", "aBlock"],
  3391. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3392. referencedClasses: [],
  3393. //>>excludeEnd("ide");
  3394. pragmas: [],
  3395. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3396. }, function ($methodClass){ return function (aKey,aBlock){
  3397. var self=this,$self=this;
  3398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3399. return $core.withContext(function($ctx1) {
  3400. //>>excludeEnd("ctx");
  3401. if($core.assert($self._includesKey_(aKey))){
  3402. return $self._basicAt_(aKey);
  3403. } else {
  3404. return $recv(aBlock)._value();
  3405. }
  3406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3407. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3408. //>>excludeEnd("ctx");
  3409. }; }),
  3410. $globals.HashedCollection);
  3411. $core.addMethod(
  3412. $core.method({
  3413. selector: "at:put:",
  3414. protocol: "accessing",
  3415. //>>excludeStart("ide", pragmas.excludeIdeData);
  3416. args: ["aKey", "aValue"],
  3417. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3418. referencedClasses: [],
  3419. //>>excludeEnd("ide");
  3420. pragmas: [],
  3421. messageSends: ["basicAt:put:"]
  3422. }, function ($methodClass){ return function (aKey,aValue){
  3423. var self=this,$self=this;
  3424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3425. return $core.withContext(function($ctx1) {
  3426. //>>excludeEnd("ctx");
  3427. return $self._basicAt_put_(aKey,aValue);
  3428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3429. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3430. //>>excludeEnd("ctx");
  3431. }; }),
  3432. $globals.HashedCollection);
  3433. $core.addMethod(
  3434. $core.method({
  3435. selector: "includesKey:",
  3436. protocol: "testing",
  3437. //>>excludeStart("ide", pragmas.excludeIdeData);
  3438. args: ["aKey"],
  3439. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3440. referencedClasses: [],
  3441. //>>excludeEnd("ide");
  3442. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3443. messageSends: []
  3444. }, function ($methodClass){ return function (aKey){
  3445. var self=this,$self=this;
  3446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3447. return $core.withContext(function($ctx1) {
  3448. //>>excludeEnd("ctx");
  3449. return self.hasOwnProperty(aKey);
  3450. return self;
  3451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3452. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3453. //>>excludeEnd("ctx");
  3454. }; }),
  3455. $globals.HashedCollection);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "keys",
  3459. protocol: "accessing",
  3460. //>>excludeStart("ide", pragmas.excludeIdeData);
  3461. args: [],
  3462. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3463. referencedClasses: [],
  3464. //>>excludeEnd("ide");
  3465. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3466. messageSends: []
  3467. }, function ($methodClass){ return function (){
  3468. var self=this,$self=this;
  3469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3470. return $core.withContext(function($ctx1) {
  3471. //>>excludeEnd("ctx");
  3472. return Object.keys(self);
  3473. return self;
  3474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3475. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3476. //>>excludeEnd("ctx");
  3477. }; }),
  3478. $globals.HashedCollection);
  3479. $core.addMethod(
  3480. $core.method({
  3481. selector: "keysDo:",
  3482. protocol: "enumerating",
  3483. //>>excludeStart("ide", pragmas.excludeIdeData);
  3484. args: ["aBlock"],
  3485. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3486. referencedClasses: [],
  3487. //>>excludeEnd("ide");
  3488. pragmas: [],
  3489. messageSends: ["do:", "keys"]
  3490. }, function ($methodClass){ return function (aBlock){
  3491. var self=this,$self=this;
  3492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3493. return $core.withContext(function($ctx1) {
  3494. //>>excludeEnd("ctx");
  3495. $recv($self._keys())._do_(aBlock);
  3496. return self;
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3499. //>>excludeEnd("ctx");
  3500. }; }),
  3501. $globals.HashedCollection);
  3502. $core.addMethod(
  3503. $core.method({
  3504. selector: "removeKey:ifAbsent:",
  3505. protocol: "adding/removing",
  3506. //>>excludeStart("ide", pragmas.excludeIdeData);
  3507. args: ["aKey", "aBlock"],
  3508. 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 ]",
  3509. referencedClasses: [],
  3510. //>>excludeEnd("ide");
  3511. pragmas: [],
  3512. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3513. }, function ($methodClass){ return function (aKey,aBlock){
  3514. var self=this,$self=this;
  3515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3516. return $core.withContext(function($ctx1) {
  3517. //>>excludeEnd("ctx");
  3518. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. return $core.withContext(function($ctx2) {
  3521. //>>excludeEnd("ctx");
  3522. $self._basicDelete_(aKey);
  3523. return removed;
  3524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3525. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3526. //>>excludeEnd("ctx");
  3527. }),(function(){
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. return $core.withContext(function($ctx2) {
  3530. //>>excludeEnd("ctx");
  3531. return $recv(aBlock)._value();
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3534. //>>excludeEnd("ctx");
  3535. }));
  3536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3537. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3538. //>>excludeEnd("ctx");
  3539. }; }),
  3540. $globals.HashedCollection);
  3541. $core.addMethod(
  3542. $core.method({
  3543. selector: "values",
  3544. protocol: "accessing",
  3545. //>>excludeStart("ide", pragmas.excludeIdeData);
  3546. args: [],
  3547. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  3548. referencedClasses: [],
  3549. //>>excludeEnd("ide");
  3550. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3551. messageSends: []
  3552. }, function ($methodClass){ return function (){
  3553. var self=this,$self=this;
  3554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3555. return $core.withContext(function($ctx1) {
  3556. //>>excludeEnd("ctx");
  3557. return $self._keys().map(function(key){
  3558. return $self._at_(key);
  3559. });
  3560. ;
  3561. return self;
  3562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3563. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3564. //>>excludeEnd("ctx");
  3565. }; }),
  3566. $globals.HashedCollection);
  3567. $core.addMethod(
  3568. $core.method({
  3569. selector: "valuesDo:",
  3570. protocol: "enumerating",
  3571. //>>excludeStart("ide", pragmas.excludeIdeData);
  3572. args: ["aBlock"],
  3573. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3574. referencedClasses: [],
  3575. //>>excludeEnd("ide");
  3576. pragmas: [],
  3577. messageSends: ["do:", "values"]
  3578. }, function ($methodClass){ return function (aBlock){
  3579. var self=this,$self=this;
  3580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3581. return $core.withContext(function($ctx1) {
  3582. //>>excludeEnd("ctx");
  3583. $recv($self._values())._do_(aBlock);
  3584. return self;
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3587. //>>excludeEnd("ctx");
  3588. }; }),
  3589. $globals.HashedCollection);
  3590. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3591. //>>excludeStart("ide", pragmas.excludeIdeData);
  3592. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3593. //>>excludeEnd("ide");
  3594. $core.addMethod(
  3595. $core.method({
  3596. selector: "=",
  3597. protocol: "comparing",
  3598. //>>excludeStart("ide", pragmas.excludeIdeData);
  3599. args: ["aCollection"],
  3600. 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",
  3601. referencedClasses: [],
  3602. //>>excludeEnd("ide");
  3603. pragmas: [],
  3604. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3605. }, function ($methodClass){ return function (aCollection){
  3606. var self=this,$self=this;
  3607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3608. return $core.withContext(function($ctx1) {
  3609. //>>excludeEnd("ctx");
  3610. var $early={};
  3611. try {
  3612. if(!$core.assert($recv([$recv([$self._class()
  3613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3614. ,$ctx1.sendIdx["class"]=1
  3615. //>>excludeEnd("ctx");
  3616. ][0]).__eq($recv(aCollection)._class())
  3617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3618. ,$ctx1.sendIdx["="]=1
  3619. //>>excludeEnd("ctx");
  3620. ][0])._and_((function(){
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. return $core.withContext(function($ctx2) {
  3623. //>>excludeEnd("ctx");
  3624. return [$recv([$self._size()
  3625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3626. ,$ctx2.sendIdx["size"]=1
  3627. //>>excludeEnd("ctx");
  3628. ][0]).__eq($recv(aCollection)._size())
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. ,$ctx2.sendIdx["="]=2
  3631. //>>excludeEnd("ctx");
  3632. ][0];
  3633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3635. //>>excludeEnd("ctx");
  3636. })))){
  3637. return false;
  3638. }
  3639. $self._withIndexDo_((function(each,i){
  3640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3641. return $core.withContext(function($ctx2) {
  3642. //>>excludeEnd("ctx");
  3643. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3644. throw $early=[false];
  3645. }
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3648. //>>excludeEnd("ctx");
  3649. }));
  3650. return true;
  3651. }
  3652. catch(e) {if(e===$early)return e[0]; throw e}
  3653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3654. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3655. //>>excludeEnd("ctx");
  3656. }; }),
  3657. $globals.SequenceableCollection);
  3658. $core.addMethod(
  3659. $core.method({
  3660. selector: "addLast:",
  3661. protocol: "adding/removing",
  3662. //>>excludeStart("ide", pragmas.excludeIdeData);
  3663. args: ["anObject"],
  3664. source: "addLast: anObject\x0a\x09self add: anObject",
  3665. referencedClasses: [],
  3666. //>>excludeEnd("ide");
  3667. pragmas: [],
  3668. messageSends: ["add:"]
  3669. }, function ($methodClass){ return function (anObject){
  3670. var self=this,$self=this;
  3671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3672. return $core.withContext(function($ctx1) {
  3673. //>>excludeEnd("ctx");
  3674. $self._add_(anObject);
  3675. return self;
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3678. //>>excludeEnd("ctx");
  3679. }; }),
  3680. $globals.SequenceableCollection);
  3681. $core.addMethod(
  3682. $core.method({
  3683. selector: "allButFirst",
  3684. protocol: "accessing",
  3685. //>>excludeStart("ide", pragmas.excludeIdeData);
  3686. args: [],
  3687. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3688. referencedClasses: [],
  3689. //>>excludeEnd("ide");
  3690. pragmas: [],
  3691. messageSends: ["copyFrom:to:", "size"]
  3692. }, function ($methodClass){ return function (){
  3693. var self=this,$self=this;
  3694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3695. return $core.withContext(function($ctx1) {
  3696. //>>excludeEnd("ctx");
  3697. return $self._copyFrom_to_((2),$self._size());
  3698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3699. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3700. //>>excludeEnd("ctx");
  3701. }; }),
  3702. $globals.SequenceableCollection);
  3703. $core.addMethod(
  3704. $core.method({
  3705. selector: "allButLast",
  3706. protocol: "accessing",
  3707. //>>excludeStart("ide", pragmas.excludeIdeData);
  3708. args: [],
  3709. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3710. referencedClasses: [],
  3711. //>>excludeEnd("ide");
  3712. pragmas: [],
  3713. messageSends: ["copyFrom:to:", "-", "size"]
  3714. }, function ($methodClass){ return function (){
  3715. var self=this,$self=this;
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. return $core.withContext(function($ctx1) {
  3718. //>>excludeEnd("ctx");
  3719. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3722. //>>excludeEnd("ctx");
  3723. }; }),
  3724. $globals.SequenceableCollection);
  3725. $core.addMethod(
  3726. $core.method({
  3727. selector: "anyOne",
  3728. protocol: "accessing",
  3729. //>>excludeStart("ide", pragmas.excludeIdeData);
  3730. args: [],
  3731. source: "anyOne\x0a\x09^ self at: 1",
  3732. referencedClasses: [],
  3733. //>>excludeEnd("ide");
  3734. pragmas: [],
  3735. messageSends: ["at:"]
  3736. }, function ($methodClass){ return function (){
  3737. var self=this,$self=this;
  3738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3739. return $core.withContext(function($ctx1) {
  3740. //>>excludeEnd("ctx");
  3741. return $self._at_((1));
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3744. //>>excludeEnd("ctx");
  3745. }; }),
  3746. $globals.SequenceableCollection);
  3747. $core.addMethod(
  3748. $core.method({
  3749. selector: "atRandom",
  3750. protocol: "accessing",
  3751. //>>excludeStart("ide", pragmas.excludeIdeData);
  3752. args: [],
  3753. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3754. referencedClasses: [],
  3755. //>>excludeEnd("ide");
  3756. pragmas: [],
  3757. messageSends: ["at:", "atRandom", "size"]
  3758. }, function ($methodClass){ return function (){
  3759. var self=this,$self=this;
  3760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3761. return $core.withContext(function($ctx1) {
  3762. //>>excludeEnd("ctx");
  3763. return $self._at_($recv($self._size())._atRandom());
  3764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3765. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3766. //>>excludeEnd("ctx");
  3767. }; }),
  3768. $globals.SequenceableCollection);
  3769. $core.addMethod(
  3770. $core.method({
  3771. selector: "beginsWith:",
  3772. protocol: "testing",
  3773. //>>excludeStart("ide", pragmas.excludeIdeData);
  3774. args: ["prefix"],
  3775. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3776. referencedClasses: [],
  3777. //>>excludeEnd("ide");
  3778. pragmas: [],
  3779. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3780. }, function ($methodClass){ return function (prefix){
  3781. var self=this,$self=this;
  3782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3783. return $core.withContext(function($ctx1) {
  3784. //>>excludeEnd("ctx");
  3785. if($core.assert($recv([$self._size()
  3786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3787. ,$ctx1.sendIdx["size"]=1
  3788. //>>excludeEnd("ctx");
  3789. ][0]).__lt([$recv(prefix)._size()
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. ,$ctx1.sendIdx["size"]=2
  3792. //>>excludeEnd("ctx");
  3793. ][0]))){
  3794. return false;
  3795. }
  3796. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3798. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3799. //>>excludeEnd("ctx");
  3800. }; }),
  3801. $globals.SequenceableCollection);
  3802. $core.addMethod(
  3803. $core.method({
  3804. selector: "copyFrom:to:",
  3805. protocol: "copying",
  3806. //>>excludeStart("ide", pragmas.excludeIdeData);
  3807. args: ["anIndex", "anotherIndex"],
  3808. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3809. referencedClasses: [],
  3810. //>>excludeEnd("ide");
  3811. pragmas: [],
  3812. messageSends: ["subclassResponsibility"]
  3813. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3814. var self=this,$self=this;
  3815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3816. return $core.withContext(function($ctx1) {
  3817. //>>excludeEnd("ctx");
  3818. $self._subclassResponsibility();
  3819. return self;
  3820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3821. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3822. //>>excludeEnd("ctx");
  3823. }; }),
  3824. $globals.SequenceableCollection);
  3825. $core.addMethod(
  3826. $core.method({
  3827. selector: "copyWithFirst:",
  3828. protocol: "copying",
  3829. //>>excludeStart("ide", pragmas.excludeIdeData);
  3830. args: ["anObject"],
  3831. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3832. referencedClasses: [],
  3833. //>>excludeEnd("ide");
  3834. pragmas: [],
  3835. messageSends: ["addAll:", "with:", "class", "yourself"]
  3836. }, function ($methodClass){ return function (anObject){
  3837. var self=this,$self=this;
  3838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3839. return $core.withContext(function($ctx1) {
  3840. //>>excludeEnd("ctx");
  3841. var $1;
  3842. $1=$recv($self._class())._with_(anObject);
  3843. $recv($1)._addAll_(self);
  3844. return $recv($1)._yourself();
  3845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3846. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3847. //>>excludeEnd("ctx");
  3848. }; }),
  3849. $globals.SequenceableCollection);
  3850. $core.addMethod(
  3851. $core.method({
  3852. selector: "endsWith:",
  3853. protocol: "testing",
  3854. //>>excludeStart("ide", pragmas.excludeIdeData);
  3855. args: ["suffix"],
  3856. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3857. referencedClasses: [],
  3858. //>>excludeEnd("ide");
  3859. pragmas: [],
  3860. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3861. }, function ($methodClass){ return function (suffix){
  3862. var self=this,$self=this;
  3863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3864. return $core.withContext(function($ctx1) {
  3865. //>>excludeEnd("ctx");
  3866. if($core.assert($recv([$self._size()
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. ,$ctx1.sendIdx["size"]=1
  3869. //>>excludeEnd("ctx");
  3870. ][0]).__lt([$recv(suffix)._size()
  3871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3872. ,$ctx1.sendIdx["size"]=2
  3873. //>>excludeEnd("ctx");
  3874. ][0]))){
  3875. return false;
  3876. }
  3877. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3879. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3880. //>>excludeEnd("ctx");
  3881. }; }),
  3882. $globals.SequenceableCollection);
  3883. $core.addMethod(
  3884. $core.method({
  3885. selector: "first",
  3886. protocol: "accessing",
  3887. //>>excludeStart("ide", pragmas.excludeIdeData);
  3888. args: [],
  3889. source: "first\x0a\x09^ self at: 1",
  3890. referencedClasses: [],
  3891. //>>excludeEnd("ide");
  3892. pragmas: [],
  3893. messageSends: ["at:"]
  3894. }, function ($methodClass){ return function (){
  3895. var self=this,$self=this;
  3896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3897. return $core.withContext(function($ctx1) {
  3898. //>>excludeEnd("ctx");
  3899. return $self._at_((1));
  3900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3901. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3902. //>>excludeEnd("ctx");
  3903. }; }),
  3904. $globals.SequenceableCollection);
  3905. $core.addMethod(
  3906. $core.method({
  3907. selector: "first:",
  3908. protocol: "accessing",
  3909. //>>excludeStart("ide", pragmas.excludeIdeData);
  3910. args: ["aNumber"],
  3911. 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",
  3912. referencedClasses: [],
  3913. //>>excludeEnd("ide");
  3914. pragmas: [],
  3915. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3916. }, function ($methodClass){ return function (aNumber){
  3917. var self=this,$self=this;
  3918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3919. return $core.withContext(function($ctx1) {
  3920. //>>excludeEnd("ctx");
  3921. if($core.assert($recv($self._size()).__lt(aNumber))){
  3922. $self._error_("Invalid number of elements");
  3923. }
  3924. return $self._copyFrom_to_((1),aNumber);
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3927. //>>excludeEnd("ctx");
  3928. }; }),
  3929. $globals.SequenceableCollection);
  3930. $core.addMethod(
  3931. $core.method({
  3932. selector: "fourth",
  3933. protocol: "accessing",
  3934. //>>excludeStart("ide", pragmas.excludeIdeData);
  3935. args: [],
  3936. source: "fourth\x0a\x09^ self at: 4",
  3937. referencedClasses: [],
  3938. //>>excludeEnd("ide");
  3939. pragmas: [],
  3940. messageSends: ["at:"]
  3941. }, function ($methodClass){ return function (){
  3942. var self=this,$self=this;
  3943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3944. return $core.withContext(function($ctx1) {
  3945. //>>excludeEnd("ctx");
  3946. return $self._at_((4));
  3947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3948. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3949. //>>excludeEnd("ctx");
  3950. }; }),
  3951. $globals.SequenceableCollection);
  3952. $core.addMethod(
  3953. $core.method({
  3954. selector: "includes:",
  3955. protocol: "testing",
  3956. //>>excludeStart("ide", pragmas.excludeIdeData);
  3957. args: ["anObject"],
  3958. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3959. referencedClasses: [],
  3960. //>>excludeEnd("ide");
  3961. pragmas: [],
  3962. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3963. }, function ($methodClass){ return function (anObject){
  3964. var self=this,$self=this;
  3965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3966. return $core.withContext(function($ctx1) {
  3967. //>>excludeEnd("ctx");
  3968. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3969. return nil;
  3970. })))._notNil();
  3971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3972. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3973. //>>excludeEnd("ctx");
  3974. }; }),
  3975. $globals.SequenceableCollection);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "indexOf:startingAt:",
  3979. protocol: "accessing",
  3980. //>>excludeStart("ide", pragmas.excludeIdeData);
  3981. args: ["anObject", "start"],
  3982. 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 ]",
  3983. referencedClasses: [],
  3984. //>>excludeEnd("ide");
  3985. pragmas: [],
  3986. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3987. }, function ($methodClass){ return function (anObject,start){
  3988. var self=this,$self=this;
  3989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3990. return $core.withContext(function($ctx1) {
  3991. //>>excludeEnd("ctx");
  3992. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3993. return (0);
  3994. }));
  3995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3996. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3997. //>>excludeEnd("ctx");
  3998. }; }),
  3999. $globals.SequenceableCollection);
  4000. $core.addMethod(
  4001. $core.method({
  4002. selector: "indexOf:startingAt:ifAbsent:",
  4003. protocol: "accessing",
  4004. //>>excludeStart("ide", pragmas.excludeIdeData);
  4005. args: ["anObject", "start", "aBlock"],
  4006. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  4007. referencedClasses: [],
  4008. //>>excludeEnd("ide");
  4009. pragmas: [],
  4010. messageSends: ["subclassResponsibility"]
  4011. }, function ($methodClass){ return function (anObject,start,aBlock){
  4012. var self=this,$self=this;
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. return $core.withContext(function($ctx1) {
  4015. //>>excludeEnd("ctx");
  4016. $self._subclassResponsibility();
  4017. return self;
  4018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4019. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  4020. //>>excludeEnd("ctx");
  4021. }; }),
  4022. $globals.SequenceableCollection);
  4023. $core.addMethod(
  4024. $core.method({
  4025. selector: "last",
  4026. protocol: "accessing",
  4027. //>>excludeStart("ide", pragmas.excludeIdeData);
  4028. args: [],
  4029. source: "last\x0a\x09^ self at: self size",
  4030. referencedClasses: [],
  4031. //>>excludeEnd("ide");
  4032. pragmas: [],
  4033. messageSends: ["at:", "size"]
  4034. }, function ($methodClass){ return function (){
  4035. var self=this,$self=this;
  4036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4037. return $core.withContext(function($ctx1) {
  4038. //>>excludeEnd("ctx");
  4039. return $self._at_($self._size());
  4040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4041. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  4042. //>>excludeEnd("ctx");
  4043. }; }),
  4044. $globals.SequenceableCollection);
  4045. $core.addMethod(
  4046. $core.method({
  4047. selector: "last:",
  4048. protocol: "accessing",
  4049. //>>excludeStart("ide", pragmas.excludeIdeData);
  4050. args: ["aNumber"],
  4051. 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",
  4052. referencedClasses: [],
  4053. //>>excludeEnd("ide");
  4054. pragmas: [],
  4055. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4056. }, function ($methodClass){ return function (aNumber){
  4057. var self=this,$self=this;
  4058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4059. return $core.withContext(function($ctx1) {
  4060. //>>excludeEnd("ctx");
  4061. if($core.assert($recv([$self._size()
  4062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4063. ,$ctx1.sendIdx["size"]=1
  4064. //>>excludeEnd("ctx");
  4065. ][0]).__lt(aNumber))){
  4066. $self._error_("Invalid number of elements");
  4067. }
  4068. return $self._copyFrom_to_($recv($recv([$self._size()
  4069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4070. ,$ctx1.sendIdx["size"]=2
  4071. //>>excludeEnd("ctx");
  4072. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  4073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4074. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  4075. //>>excludeEnd("ctx");
  4076. }; }),
  4077. $globals.SequenceableCollection);
  4078. $core.addMethod(
  4079. $core.method({
  4080. selector: "newStream",
  4081. protocol: "streaming",
  4082. //>>excludeStart("ide", pragmas.excludeIdeData);
  4083. args: [],
  4084. source: "newStream\x0a\x09^ self streamClass on: self",
  4085. referencedClasses: [],
  4086. //>>excludeEnd("ide");
  4087. pragmas: [],
  4088. messageSends: ["on:", "streamClass"]
  4089. }, function ($methodClass){ return function (){
  4090. var self=this,$self=this;
  4091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4092. return $core.withContext(function($ctx1) {
  4093. //>>excludeEnd("ctx");
  4094. return $recv($self._streamClass())._on_(self);
  4095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4096. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  4097. //>>excludeEnd("ctx");
  4098. }; }),
  4099. $globals.SequenceableCollection);
  4100. $core.addMethod(
  4101. $core.method({
  4102. selector: "readStream",
  4103. protocol: "streaming",
  4104. //>>excludeStart("ide", pragmas.excludeIdeData);
  4105. args: [],
  4106. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4107. referencedClasses: [],
  4108. //>>excludeEnd("ide");
  4109. pragmas: [],
  4110. messageSends: ["stream"]
  4111. }, function ($methodClass){ return function (){
  4112. var self=this,$self=this;
  4113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4114. return $core.withContext(function($ctx1) {
  4115. //>>excludeEnd("ctx");
  4116. return $self._stream();
  4117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4118. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4119. //>>excludeEnd("ctx");
  4120. }; }),
  4121. $globals.SequenceableCollection);
  4122. $core.addMethod(
  4123. $core.method({
  4124. selector: "removeLast",
  4125. protocol: "adding/removing",
  4126. //>>excludeStart("ide", pragmas.excludeIdeData);
  4127. args: [],
  4128. source: "removeLast\x0a\x09^ self remove: self last",
  4129. referencedClasses: [],
  4130. //>>excludeEnd("ide");
  4131. pragmas: [],
  4132. messageSends: ["remove:", "last"]
  4133. }, function ($methodClass){ return function (){
  4134. var self=this,$self=this;
  4135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4136. return $core.withContext(function($ctx1) {
  4137. //>>excludeEnd("ctx");
  4138. return $self._remove_($self._last());
  4139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4140. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4141. //>>excludeEnd("ctx");
  4142. }; }),
  4143. $globals.SequenceableCollection);
  4144. $core.addMethod(
  4145. $core.method({
  4146. selector: "reverseDo:",
  4147. protocol: "enumerating",
  4148. //>>excludeStart("ide", pragmas.excludeIdeData);
  4149. args: ["aBlock"],
  4150. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4151. referencedClasses: [],
  4152. //>>excludeEnd("ide");
  4153. pragmas: [],
  4154. messageSends: ["do:", "reversed"]
  4155. }, function ($methodClass){ return function (aBlock){
  4156. var self=this,$self=this;
  4157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4158. return $core.withContext(function($ctx1) {
  4159. //>>excludeEnd("ctx");
  4160. $recv($self._reversed())._do_(aBlock);
  4161. return self;
  4162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4163. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4164. //>>excludeEnd("ctx");
  4165. }; }),
  4166. $globals.SequenceableCollection);
  4167. $core.addMethod(
  4168. $core.method({
  4169. selector: "reversed",
  4170. protocol: "converting",
  4171. //>>excludeStart("ide", pragmas.excludeIdeData);
  4172. args: [],
  4173. source: "reversed\x0a\x09self subclassResponsibility",
  4174. referencedClasses: [],
  4175. //>>excludeEnd("ide");
  4176. pragmas: [],
  4177. messageSends: ["subclassResponsibility"]
  4178. }, function ($methodClass){ return function (){
  4179. var self=this,$self=this;
  4180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4181. return $core.withContext(function($ctx1) {
  4182. //>>excludeEnd("ctx");
  4183. $self._subclassResponsibility();
  4184. return self;
  4185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4186. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4187. //>>excludeEnd("ctx");
  4188. }; }),
  4189. $globals.SequenceableCollection);
  4190. $core.addMethod(
  4191. $core.method({
  4192. selector: "second",
  4193. protocol: "accessing",
  4194. //>>excludeStart("ide", pragmas.excludeIdeData);
  4195. args: [],
  4196. source: "second\x0a\x09^ self at: 2",
  4197. referencedClasses: [],
  4198. //>>excludeEnd("ide");
  4199. pragmas: [],
  4200. messageSends: ["at:"]
  4201. }, function ($methodClass){ return function (){
  4202. var self=this,$self=this;
  4203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4204. return $core.withContext(function($ctx1) {
  4205. //>>excludeEnd("ctx");
  4206. return $self._at_((2));
  4207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4208. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4209. //>>excludeEnd("ctx");
  4210. }; }),
  4211. $globals.SequenceableCollection);
  4212. $core.addMethod(
  4213. $core.method({
  4214. selector: "stream",
  4215. protocol: "streaming",
  4216. //>>excludeStart("ide", pragmas.excludeIdeData);
  4217. args: [],
  4218. source: "stream\x0a\x09^ self newStream",
  4219. referencedClasses: [],
  4220. //>>excludeEnd("ide");
  4221. pragmas: [],
  4222. messageSends: ["newStream"]
  4223. }, function ($methodClass){ return function (){
  4224. var self=this,$self=this;
  4225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4226. return $core.withContext(function($ctx1) {
  4227. //>>excludeEnd("ctx");
  4228. return $self._newStream();
  4229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4230. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4231. //>>excludeEnd("ctx");
  4232. }; }),
  4233. $globals.SequenceableCollection);
  4234. $core.addMethod(
  4235. $core.method({
  4236. selector: "streamClass",
  4237. protocol: "streaming",
  4238. //>>excludeStart("ide", pragmas.excludeIdeData);
  4239. args: [],
  4240. source: "streamClass\x0a\x09^ self class streamClass",
  4241. referencedClasses: [],
  4242. //>>excludeEnd("ide");
  4243. pragmas: [],
  4244. messageSends: ["streamClass", "class"]
  4245. }, function ($methodClass){ return function (){
  4246. var self=this,$self=this;
  4247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4248. return $core.withContext(function($ctx1) {
  4249. //>>excludeEnd("ctx");
  4250. return $recv($self._class())._streamClass();
  4251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4252. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4253. //>>excludeEnd("ctx");
  4254. }; }),
  4255. $globals.SequenceableCollection);
  4256. $core.addMethod(
  4257. $core.method({
  4258. selector: "third",
  4259. protocol: "accessing",
  4260. //>>excludeStart("ide", pragmas.excludeIdeData);
  4261. args: [],
  4262. source: "third\x0a\x09^ self at: 3",
  4263. referencedClasses: [],
  4264. //>>excludeEnd("ide");
  4265. pragmas: [],
  4266. messageSends: ["at:"]
  4267. }, function ($methodClass){ return function (){
  4268. var self=this,$self=this;
  4269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4270. return $core.withContext(function($ctx1) {
  4271. //>>excludeEnd("ctx");
  4272. return $self._at_((3));
  4273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4274. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4275. //>>excludeEnd("ctx");
  4276. }; }),
  4277. $globals.SequenceableCollection);
  4278. $core.addMethod(
  4279. $core.method({
  4280. selector: "writeStream",
  4281. protocol: "streaming",
  4282. //>>excludeStart("ide", pragmas.excludeIdeData);
  4283. args: [],
  4284. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4285. referencedClasses: [],
  4286. //>>excludeEnd("ide");
  4287. pragmas: [],
  4288. messageSends: ["stream"]
  4289. }, function ($methodClass){ return function (){
  4290. var self=this,$self=this;
  4291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4292. return $core.withContext(function($ctx1) {
  4293. //>>excludeEnd("ctx");
  4294. return $self._stream();
  4295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4296. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4297. //>>excludeEnd("ctx");
  4298. }; }),
  4299. $globals.SequenceableCollection);
  4300. $core.addMethod(
  4301. $core.method({
  4302. selector: "streamClass",
  4303. protocol: "accessing",
  4304. //>>excludeStart("ide", pragmas.excludeIdeData);
  4305. args: [],
  4306. source: "streamClass\x0a\x09\x09^ Stream",
  4307. referencedClasses: ["Stream"],
  4308. //>>excludeEnd("ide");
  4309. pragmas: [],
  4310. messageSends: []
  4311. }, function ($methodClass){ return function (){
  4312. var self=this,$self=this;
  4313. return $globals.Stream;
  4314. }; }),
  4315. $globals.SequenceableCollection.a$cls);
  4316. $core.addMethod(
  4317. $core.method({
  4318. selector: "streamContents:",
  4319. protocol: "streaming",
  4320. //>>excludeStart("ide", pragmas.excludeIdeData);
  4321. args: ["aBlock"],
  4322. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4323. referencedClasses: [],
  4324. //>>excludeEnd("ide");
  4325. pragmas: [],
  4326. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4327. }, function ($methodClass){ return function (aBlock){
  4328. var self=this,$self=this;
  4329. var stream;
  4330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4331. return $core.withContext(function($ctx1) {
  4332. //>>excludeEnd("ctx");
  4333. stream=$recv($self._streamClass())._on_($self._new());
  4334. $recv(aBlock)._value_(stream);
  4335. return $recv(stream)._contents();
  4336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4337. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4338. //>>excludeEnd("ctx");
  4339. }; }),
  4340. $globals.SequenceableCollection.a$cls);
  4341. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4342. //>>excludeStart("ide", pragmas.excludeIdeData);
  4343. $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`.";
  4344. //>>excludeEnd("ide");
  4345. $core.addMethod(
  4346. $core.method({
  4347. selector: "add:",
  4348. protocol: "adding/removing",
  4349. //>>excludeStart("ide", pragmas.excludeIdeData);
  4350. args: ["anObject"],
  4351. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4352. referencedClasses: [],
  4353. //>>excludeEnd("ide");
  4354. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4355. messageSends: []
  4356. }, function ($methodClass){ return function (anObject){
  4357. var self=this,$self=this;
  4358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4359. return $core.withContext(function($ctx1) {
  4360. //>>excludeEnd("ctx");
  4361. self.push(anObject); return anObject;;
  4362. return self;
  4363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4364. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4365. //>>excludeEnd("ctx");
  4366. }; }),
  4367. $globals.Array);
  4368. $core.addMethod(
  4369. $core.method({
  4370. selector: "addAll:",
  4371. protocol: "adding/removing",
  4372. //>>excludeStart("ide", pragmas.excludeIdeData);
  4373. args: ["aCollection"],
  4374. source: "addAll: aCollection\x0a<inlineJS: '\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'>",
  4375. referencedClasses: [],
  4376. //>>excludeEnd("ide");
  4377. pragmas: [["inlineJS:", ["\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;"]]],
  4378. messageSends: []
  4379. }, function ($methodClass){ return function (aCollection){
  4380. var self=this,$self=this;
  4381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4382. return $core.withContext(function($ctx1) {
  4383. //>>excludeEnd("ctx");
  4384. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4385. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4386. return aCollection;;
  4387. return self;
  4388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4389. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4390. //>>excludeEnd("ctx");
  4391. }; }),
  4392. $globals.Array);
  4393. $core.addMethod(
  4394. $core.method({
  4395. selector: "addFirst:",
  4396. protocol: "adding/removing",
  4397. //>>excludeStart("ide", pragmas.excludeIdeData);
  4398. args: ["anObject"],
  4399. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4400. referencedClasses: [],
  4401. //>>excludeEnd("ide");
  4402. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4403. messageSends: []
  4404. }, function ($methodClass){ return function (anObject){
  4405. var self=this,$self=this;
  4406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4407. return $core.withContext(function($ctx1) {
  4408. //>>excludeEnd("ctx");
  4409. self.unshift(anObject); return anObject;;
  4410. return self;
  4411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4412. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4413. //>>excludeEnd("ctx");
  4414. }; }),
  4415. $globals.Array);
  4416. $core.addMethod(
  4417. $core.method({
  4418. selector: "allIn:",
  4419. protocol: "enumerating",
  4420. //>>excludeStart("ide", pragmas.excludeIdeData);
  4421. args: ["aBlock"],
  4422. source: "allIn: aBlock\x0a\x09^ aBlock valueWithPossibleArguments:\x0a\x09\x09\x22collect to match #in: behaviour\x22\x0a\x09\x09(self collect: [ :each | each in: [ :x | x ] ])",
  4423. referencedClasses: [],
  4424. //>>excludeEnd("ide");
  4425. pragmas: [],
  4426. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  4427. }, function ($methodClass){ return function (aBlock){
  4428. var self=this,$self=this;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. return $core.withContext(function($ctx1) {
  4431. //>>excludeEnd("ctx");
  4432. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  4433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4434. return $core.withContext(function($ctx2) {
  4435. //>>excludeEnd("ctx");
  4436. return $recv(each)._in_((function(x){
  4437. return x;
  4438. }));
  4439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4440. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4441. //>>excludeEnd("ctx");
  4442. })));
  4443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4444. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  4445. //>>excludeEnd("ctx");
  4446. }; }),
  4447. $globals.Array);
  4448. $core.addMethod(
  4449. $core.method({
  4450. selector: "appendToString:",
  4451. protocol: "copying",
  4452. //>>excludeStart("ide", pragmas.excludeIdeData);
  4453. args: ["aString"],
  4454. source: "appendToString: aString\x0a<inlineJS: '\x0a\x09for (var i = 0, l = $self.length; i < l; ++i) {\x0a\x09\x09var el = $self[i];\x0a\x09\x09if ((typeof el === \x22string\x22) || $recv(el)._isString()) {\x0a\x09\x09\x09if (el.length === 1) { aString += el; continue; }\x0a\x09\x09}\x0a\x09\x09$self._error_(\x22Not a character.\x22);\x0a\x09}\x0a\x09return aString'>",
  4455. referencedClasses: [],
  4456. //>>excludeEnd("ide");
  4457. pragmas: [["inlineJS:", ["\x0a\x09for (var i = 0, l = $self.length; i < l; ++i) {\x0a\x09\x09var el = $self[i];\x0a\x09\x09if ((typeof el === \x22string\x22) || $recv(el)._isString()) {\x0a\x09\x09\x09if (el.length === 1) { aString += el; continue; }\x0a\x09\x09}\x0a\x09\x09$self._error_(\x22Not a character.\x22);\x0a\x09}\x0a\x09return aString"]]],
  4458. messageSends: []
  4459. }, function ($methodClass){ return function (aString){
  4460. var self=this,$self=this;
  4461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4462. return $core.withContext(function($ctx1) {
  4463. //>>excludeEnd("ctx");
  4464. for (var i = 0, l = $self.length; i < l; ++i) {
  4465. var el = $self[i];
  4466. if ((typeof el === "string") || $recv(el)._isString()) {
  4467. if (el.length === 1) { aString += el; continue; }
  4468. }
  4469. $self._error_("Not a character.");
  4470. }
  4471. return aString;
  4472. return self;
  4473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4474. }, function($ctx1) {$ctx1.fill(self,"appendToString:",{aString:aString})});
  4475. //>>excludeEnd("ctx");
  4476. }; }),
  4477. $globals.Array);
  4478. $core.addMethod(
  4479. $core.method({
  4480. selector: "asJavaScriptSource",
  4481. protocol: "converting",
  4482. //>>excludeStart("ide", pragmas.excludeIdeData);
  4483. args: [],
  4484. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4485. referencedClasses: [],
  4486. //>>excludeEnd("ide");
  4487. pragmas: [],
  4488. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4489. }, function ($methodClass){ return function (){
  4490. var self=this,$self=this;
  4491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4492. return $core.withContext(function($ctx1) {
  4493. //>>excludeEnd("ctx");
  4494. return [$recv("[".__comma($recv($self._collect_((function(each){
  4495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4496. return $core.withContext(function($ctx2) {
  4497. //>>excludeEnd("ctx");
  4498. return $recv(each)._asJavaScriptSource();
  4499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4501. //>>excludeEnd("ctx");
  4502. })))._join_(", "))).__comma("]")
  4503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4504. ,$ctx1.sendIdx[","]=1
  4505. //>>excludeEnd("ctx");
  4506. ][0];
  4507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4508. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4509. //>>excludeEnd("ctx");
  4510. }; }),
  4511. $globals.Array);
  4512. $core.addMethod(
  4513. $core.method({
  4514. selector: "at:put:",
  4515. protocol: "accessing",
  4516. //>>excludeStart("ide", pragmas.excludeIdeData);
  4517. args: ["anIndex", "anObject"],
  4518. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4519. referencedClasses: [],
  4520. //>>excludeEnd("ide");
  4521. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4522. messageSends: []
  4523. }, function ($methodClass){ return function (anIndex,anObject){
  4524. var self=this,$self=this;
  4525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4526. return $core.withContext(function($ctx1) {
  4527. //>>excludeEnd("ctx");
  4528. return self[anIndex - 1] = anObject;
  4529. return self;
  4530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4531. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4532. //>>excludeEnd("ctx");
  4533. }; }),
  4534. $globals.Array);
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "collect:",
  4538. protocol: "enumerating",
  4539. //>>excludeStart("ide", pragmas.excludeIdeData);
  4540. args: ["aBlock"],
  4541. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4542. referencedClasses: [],
  4543. //>>excludeEnd("ide");
  4544. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4545. messageSends: []
  4546. }, function ($methodClass){ return function (aBlock){
  4547. var self=this,$self=this;
  4548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4549. return $core.withContext(function($ctx1) {
  4550. //>>excludeEnd("ctx");
  4551. return self.map(function(each) {return aBlock._value_(each)});
  4552. return self;
  4553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4554. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4555. //>>excludeEnd("ctx");
  4556. }; }),
  4557. $globals.Array);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "copyFrom:to:",
  4561. protocol: "copying",
  4562. //>>excludeStart("ide", pragmas.excludeIdeData);
  4563. args: ["anIndex", "anotherIndex"],
  4564. source: "copyFrom: anIndex to: anotherIndex\x0a<inlineJS: '\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'>",
  4565. referencedClasses: [],
  4566. //>>excludeEnd("ide");
  4567. pragmas: [["inlineJS:", ["\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}"]]],
  4568. messageSends: []
  4569. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4570. var self=this,$self=this;
  4571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4572. return $core.withContext(function($ctx1) {
  4573. //>>excludeEnd("ctx");
  4574. if (anIndex >= 1 && anotherIndex <= self.length) {
  4575. return self.slice(anIndex - 1, anotherIndex);
  4576. } else {
  4577. self._at_(anIndex);
  4578. self._at_(self.length + 1);
  4579. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4580. };
  4581. return self;
  4582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4583. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4584. //>>excludeEnd("ctx");
  4585. }; }),
  4586. $globals.Array);
  4587. $core.addMethod(
  4588. $core.method({
  4589. selector: "join:",
  4590. protocol: "enumerating",
  4591. //>>excludeStart("ide", pragmas.excludeIdeData);
  4592. args: ["aString"],
  4593. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4594. referencedClasses: [],
  4595. //>>excludeEnd("ide");
  4596. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4597. messageSends: []
  4598. }, function ($methodClass){ return function (aString){
  4599. var self=this,$self=this;
  4600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4601. return $core.withContext(function($ctx1) {
  4602. //>>excludeEnd("ctx");
  4603. return self.join(aString);
  4604. return self;
  4605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4606. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4607. //>>excludeEnd("ctx");
  4608. }; }),
  4609. $globals.Array);
  4610. $core.addMethod(
  4611. $core.method({
  4612. selector: "printOn:",
  4613. protocol: "printing",
  4614. //>>excludeStart("ide", pragmas.excludeIdeData);
  4615. args: ["aStream"],
  4616. 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: ')'",
  4617. referencedClasses: [],
  4618. //>>excludeEnd("ide");
  4619. pragmas: [],
  4620. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4621. }, function ($methodClass){ return function (aStream){
  4622. var self=this,$self=this;
  4623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4624. return $core.withContext(function($ctx1) {
  4625. //>>excludeEnd("ctx");
  4626. [(
  4627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4628. $ctx1.supercall = true,
  4629. //>>excludeEnd("ctx");
  4630. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4632. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4633. //>>excludeEnd("ctx");
  4634. ][0];
  4635. [$recv(aStream)._nextPutAll_(" (")
  4636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4637. ,$ctx1.sendIdx["nextPutAll:"]=1
  4638. //>>excludeEnd("ctx");
  4639. ][0];
  4640. $self._do_separatedBy_((function(each){
  4641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4642. return $core.withContext(function($ctx2) {
  4643. //>>excludeEnd("ctx");
  4644. return $recv(each)._printOn_(aStream);
  4645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4647. //>>excludeEnd("ctx");
  4648. }),(function(){
  4649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4650. return $core.withContext(function($ctx2) {
  4651. //>>excludeEnd("ctx");
  4652. return [$recv(aStream)._nextPutAll_(" ")
  4653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4654. ,$ctx2.sendIdx["nextPutAll:"]=2
  4655. //>>excludeEnd("ctx");
  4656. ][0];
  4657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4658. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4659. //>>excludeEnd("ctx");
  4660. }));
  4661. $recv(aStream)._nextPutAll_(")");
  4662. return self;
  4663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4664. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4665. //>>excludeEnd("ctx");
  4666. }; }),
  4667. $globals.Array);
  4668. $core.addMethod(
  4669. $core.method({
  4670. selector: "remove:ifAbsent:",
  4671. protocol: "adding/removing",
  4672. //>>excludeStart("ide", pragmas.excludeIdeData);
  4673. args: ["anObject", "aBlock"],
  4674. 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 ]",
  4675. referencedClasses: [],
  4676. //>>excludeEnd("ide");
  4677. pragmas: [],
  4678. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4679. }, function ($methodClass){ return function (anObject,aBlock){
  4680. var self=this,$self=this;
  4681. var index;
  4682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4683. return $core.withContext(function($ctx1) {
  4684. //>>excludeEnd("ctx");
  4685. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4686. return (0);
  4687. }));
  4688. if($core.assert($recv(index).__eq((0)))){
  4689. return $recv(aBlock)._value();
  4690. } else {
  4691. $self._removeIndex_(index);
  4692. return anObject;
  4693. }
  4694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4695. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4696. //>>excludeEnd("ctx");
  4697. }; }),
  4698. $globals.Array);
  4699. $core.addMethod(
  4700. $core.method({
  4701. selector: "removeAll",
  4702. protocol: "adding/removing",
  4703. //>>excludeStart("ide", pragmas.excludeIdeData);
  4704. args: [],
  4705. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4706. referencedClasses: [],
  4707. //>>excludeEnd("ide");
  4708. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4709. messageSends: []
  4710. }, function ($methodClass){ return function (){
  4711. var self=this,$self=this;
  4712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4713. return $core.withContext(function($ctx1) {
  4714. //>>excludeEnd("ctx");
  4715. self.length = 0;
  4716. return self;
  4717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4718. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4719. //>>excludeEnd("ctx");
  4720. }; }),
  4721. $globals.Array);
  4722. $core.addMethod(
  4723. $core.method({
  4724. selector: "removeFrom:to:",
  4725. protocol: "adding/removing",
  4726. //>>excludeStart("ide", pragmas.excludeIdeData);
  4727. args: ["aNumber", "anotherNumber"],
  4728. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4729. referencedClasses: [],
  4730. //>>excludeEnd("ide");
  4731. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4732. messageSends: []
  4733. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4734. var self=this,$self=this;
  4735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4736. return $core.withContext(function($ctx1) {
  4737. //>>excludeEnd("ctx");
  4738. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4739. return self;
  4740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4741. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4742. //>>excludeEnd("ctx");
  4743. }; }),
  4744. $globals.Array);
  4745. $core.addMethod(
  4746. $core.method({
  4747. selector: "removeIndex:",
  4748. protocol: "adding/removing",
  4749. //>>excludeStart("ide", pragmas.excludeIdeData);
  4750. args: ["anInteger"],
  4751. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4752. referencedClasses: [],
  4753. //>>excludeEnd("ide");
  4754. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4755. messageSends: []
  4756. }, function ($methodClass){ return function (anInteger){
  4757. var self=this,$self=this;
  4758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4759. return $core.withContext(function($ctx1) {
  4760. //>>excludeEnd("ctx");
  4761. self.splice(anInteger - 1, 1);
  4762. return self;
  4763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4764. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4765. //>>excludeEnd("ctx");
  4766. }; }),
  4767. $globals.Array);
  4768. $core.addMethod(
  4769. $core.method({
  4770. selector: "removeLast",
  4771. protocol: "adding/removing",
  4772. //>>excludeStart("ide", pragmas.excludeIdeData);
  4773. args: [],
  4774. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4775. referencedClasses: [],
  4776. //>>excludeEnd("ide");
  4777. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4778. messageSends: []
  4779. }, function ($methodClass){ return function (){
  4780. var self=this,$self=this;
  4781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4782. return $core.withContext(function($ctx1) {
  4783. //>>excludeEnd("ctx");
  4784. return self.pop();;
  4785. return self;
  4786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4787. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4788. //>>excludeEnd("ctx");
  4789. }; }),
  4790. $globals.Array);
  4791. $core.addMethod(
  4792. $core.method({
  4793. selector: "reversed",
  4794. protocol: "converting",
  4795. //>>excludeStart("ide", pragmas.excludeIdeData);
  4796. args: [],
  4797. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4798. referencedClasses: [],
  4799. //>>excludeEnd("ide");
  4800. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4801. messageSends: []
  4802. }, function ($methodClass){ return function (){
  4803. var self=this,$self=this;
  4804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4805. return $core.withContext(function($ctx1) {
  4806. //>>excludeEnd("ctx");
  4807. return self.slice().reverse();
  4808. return self;
  4809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4810. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4811. //>>excludeEnd("ctx");
  4812. }; }),
  4813. $globals.Array);
  4814. $core.addMethod(
  4815. $core.method({
  4816. selector: "select:",
  4817. protocol: "enumerating",
  4818. //>>excludeStart("ide", pragmas.excludeIdeData);
  4819. args: ["aBlock"],
  4820. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4821. referencedClasses: [],
  4822. //>>excludeEnd("ide");
  4823. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4824. messageSends: []
  4825. }, function ($methodClass){ return function (aBlock){
  4826. var self=this,$self=this;
  4827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4828. return $core.withContext(function($ctx1) {
  4829. //>>excludeEnd("ctx");
  4830. return self.filter(function(each) {return aBlock._value_(each)});
  4831. return self;
  4832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4833. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4834. //>>excludeEnd("ctx");
  4835. }; }),
  4836. $globals.Array);
  4837. $core.addMethod(
  4838. $core.method({
  4839. selector: "shallowCopy",
  4840. protocol: "copying",
  4841. //>>excludeStart("ide", pragmas.excludeIdeData);
  4842. args: [],
  4843. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4844. referencedClasses: [],
  4845. //>>excludeEnd("ide");
  4846. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4847. messageSends: []
  4848. }, function ($methodClass){ return function (){
  4849. var self=this,$self=this;
  4850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4851. return $core.withContext(function($ctx1) {
  4852. //>>excludeEnd("ctx");
  4853. return self.slice();
  4854. return self;
  4855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4856. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4857. //>>excludeEnd("ctx");
  4858. }; }),
  4859. $globals.Array);
  4860. $core.addMethod(
  4861. $core.method({
  4862. selector: "sort",
  4863. protocol: "enumerating",
  4864. //>>excludeStart("ide", pragmas.excludeIdeData);
  4865. args: [],
  4866. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4867. referencedClasses: [],
  4868. //>>excludeEnd("ide");
  4869. pragmas: [],
  4870. messageSends: ["sort:", "<"]
  4871. }, function ($methodClass){ return function (){
  4872. var self=this,$self=this;
  4873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4874. return $core.withContext(function($ctx1) {
  4875. //>>excludeEnd("ctx");
  4876. return $self._sort_((function(a,b){
  4877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4878. return $core.withContext(function($ctx2) {
  4879. //>>excludeEnd("ctx");
  4880. return $recv(a).__lt(b);
  4881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4882. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4883. //>>excludeEnd("ctx");
  4884. }));
  4885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4886. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4887. //>>excludeEnd("ctx");
  4888. }; }),
  4889. $globals.Array);
  4890. $core.addMethod(
  4891. $core.method({
  4892. selector: "sort:",
  4893. protocol: "enumerating",
  4894. //>>excludeStart("ide", pragmas.excludeIdeData);
  4895. args: ["aBlock"],
  4896. source: "sort: aBlock\x0a\x09<inlineJS: '\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'>",
  4897. referencedClasses: [],
  4898. //>>excludeEnd("ide");
  4899. pragmas: [["inlineJS:", ["\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"]]],
  4900. messageSends: []
  4901. }, function ($methodClass){ return function (aBlock){
  4902. var self=this,$self=this;
  4903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4904. return $core.withContext(function($ctx1) {
  4905. //>>excludeEnd("ctx");
  4906. return self.sort(function(a, b) {
  4907. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4908. })
  4909. ;
  4910. return self;
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4913. //>>excludeEnd("ctx");
  4914. }; }),
  4915. $globals.Array);
  4916. $core.addMethod(
  4917. $core.method({
  4918. selector: "sorted",
  4919. protocol: "enumerating",
  4920. //>>excludeStart("ide", pragmas.excludeIdeData);
  4921. args: [],
  4922. source: "sorted\x0a\x09^ self copy sort",
  4923. referencedClasses: [],
  4924. //>>excludeEnd("ide");
  4925. pragmas: [],
  4926. messageSends: ["sort", "copy"]
  4927. }, function ($methodClass){ return function (){
  4928. var self=this,$self=this;
  4929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4930. return $core.withContext(function($ctx1) {
  4931. //>>excludeEnd("ctx");
  4932. return $recv($self._copy())._sort();
  4933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4934. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4935. //>>excludeEnd("ctx");
  4936. }; }),
  4937. $globals.Array);
  4938. $core.addMethod(
  4939. $core.method({
  4940. selector: "sorted:",
  4941. protocol: "enumerating",
  4942. //>>excludeStart("ide", pragmas.excludeIdeData);
  4943. args: ["aBlock"],
  4944. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4945. referencedClasses: [],
  4946. //>>excludeEnd("ide");
  4947. pragmas: [],
  4948. messageSends: ["sort:", "copy"]
  4949. }, function ($methodClass){ return function (aBlock){
  4950. var self=this,$self=this;
  4951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4952. return $core.withContext(function($ctx1) {
  4953. //>>excludeEnd("ctx");
  4954. return $recv($self._copy())._sort_(aBlock);
  4955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4956. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4957. //>>excludeEnd("ctx");
  4958. }; }),
  4959. $globals.Array);
  4960. $core.addMethod(
  4961. $core.method({
  4962. selector: "new:",
  4963. protocol: "instance creation",
  4964. //>>excludeStart("ide", pragmas.excludeIdeData);
  4965. args: ["anInteger"],
  4966. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4967. referencedClasses: [],
  4968. //>>excludeEnd("ide");
  4969. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4970. messageSends: []
  4971. }, function ($methodClass){ return function (anInteger){
  4972. var self=this,$self=this;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. return $core.withContext(function($ctx1) {
  4975. //>>excludeEnd("ctx");
  4976. return new Array(anInteger);
  4977. return self;
  4978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4979. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4980. //>>excludeEnd("ctx");
  4981. }; }),
  4982. $globals.Array.a$cls);
  4983. $core.addMethod(
  4984. $core.method({
  4985. selector: "with:",
  4986. protocol: "instance creation",
  4987. //>>excludeStart("ide", pragmas.excludeIdeData);
  4988. args: ["anObject"],
  4989. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4990. referencedClasses: [],
  4991. //>>excludeEnd("ide");
  4992. pragmas: [],
  4993. messageSends: ["at:put:", "new:", "yourself"]
  4994. }, function ($methodClass){ return function (anObject){
  4995. var self=this,$self=this;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. return $core.withContext(function($ctx1) {
  4998. //>>excludeEnd("ctx");
  4999. var $1;
  5000. $1=$self._new_((1));
  5001. $recv($1)._at_put_((1),anObject);
  5002. return $recv($1)._yourself();
  5003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5004. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  5005. //>>excludeEnd("ctx");
  5006. }; }),
  5007. $globals.Array.a$cls);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "with:with:",
  5011. protocol: "instance creation",
  5012. //>>excludeStart("ide", pragmas.excludeIdeData);
  5013. args: ["anObject", "anObject2"],
  5014. 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",
  5015. referencedClasses: [],
  5016. //>>excludeEnd("ide");
  5017. pragmas: [],
  5018. messageSends: ["at:put:", "new:", "yourself"]
  5019. }, function ($methodClass){ return function (anObject,anObject2){
  5020. var self=this,$self=this;
  5021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5022. return $core.withContext(function($ctx1) {
  5023. //>>excludeEnd("ctx");
  5024. var $1;
  5025. $1=$self._new_((2));
  5026. [$recv($1)._at_put_((1),anObject)
  5027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5028. ,$ctx1.sendIdx["at:put:"]=1
  5029. //>>excludeEnd("ctx");
  5030. ][0];
  5031. $recv($1)._at_put_((2),anObject2);
  5032. return $recv($1)._yourself();
  5033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5034. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  5035. //>>excludeEnd("ctx");
  5036. }; }),
  5037. $globals.Array.a$cls);
  5038. $core.addMethod(
  5039. $core.method({
  5040. selector: "with:with:with:",
  5041. protocol: "instance creation",
  5042. //>>excludeStart("ide", pragmas.excludeIdeData);
  5043. args: ["anObject", "anObject2", "anObject3"],
  5044. 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",
  5045. referencedClasses: [],
  5046. //>>excludeEnd("ide");
  5047. pragmas: [],
  5048. messageSends: ["at:put:", "new:", "yourself"]
  5049. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  5050. var self=this,$self=this;
  5051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5052. return $core.withContext(function($ctx1) {
  5053. //>>excludeEnd("ctx");
  5054. var $1;
  5055. $1=$self._new_((3));
  5056. [$recv($1)._at_put_((1),anObject)
  5057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5058. ,$ctx1.sendIdx["at:put:"]=1
  5059. //>>excludeEnd("ctx");
  5060. ][0];
  5061. [$recv($1)._at_put_((2),anObject2)
  5062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5063. ,$ctx1.sendIdx["at:put:"]=2
  5064. //>>excludeEnd("ctx");
  5065. ][0];
  5066. $recv($1)._at_put_((3),anObject3);
  5067. return $recv($1)._yourself();
  5068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5069. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  5070. //>>excludeEnd("ctx");
  5071. }; }),
  5072. $globals.Array.a$cls);
  5073. $core.addMethod(
  5074. $core.method({
  5075. selector: "withAll:",
  5076. protocol: "instance creation",
  5077. //>>excludeStart("ide", pragmas.excludeIdeData);
  5078. args: ["aCollection"],
  5079. 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",
  5080. referencedClasses: [],
  5081. //>>excludeEnd("ide");
  5082. pragmas: [],
  5083. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5084. }, function ($methodClass){ return function (aCollection){
  5085. var self=this,$self=this;
  5086. var instance,index;
  5087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5088. return $core.withContext(function($ctx1) {
  5089. //>>excludeEnd("ctx");
  5090. index=(1);
  5091. instance=$self._new_($recv(aCollection)._size());
  5092. $recv(aCollection)._do_((function(each){
  5093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5094. return $core.withContext(function($ctx2) {
  5095. //>>excludeEnd("ctx");
  5096. $recv(instance)._at_put_(index,each);
  5097. index=$recv(index).__plus((1));
  5098. return index;
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5101. //>>excludeEnd("ctx");
  5102. }));
  5103. return instance;
  5104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5105. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  5106. //>>excludeEnd("ctx");
  5107. }; }),
  5108. $globals.Array.a$cls);
  5109. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5110. //>>excludeStart("ide", pragmas.excludeIdeData);
  5111. $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 >> #,`";
  5112. //>>excludeEnd("ide");
  5113. $core.addMethod(
  5114. $core.method({
  5115. selector: ",",
  5116. protocol: "copying",
  5117. //>>excludeStart("ide", pragmas.excludeIdeData);
  5118. args: ["aString"],
  5119. source: ", aString\x0a\x09<inlineJS: 'return typeof aString === \x22string\x22 ?\x0a\x09\x09String(self) + aString :\x0a\x09\x09$recv(aString)._appendToString_(String(self))'>",
  5120. referencedClasses: [],
  5121. //>>excludeEnd("ide");
  5122. pragmas: [["inlineJS:", ["return typeof aString === \x22string\x22 ?\x0a\x09\x09String(self) + aString :\x0a\x09\x09$recv(aString)._appendToString_(String(self))"]]],
  5123. messageSends: []
  5124. }, function ($methodClass){ return function (aString){
  5125. var self=this,$self=this;
  5126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5127. return $core.withContext(function($ctx1) {
  5128. //>>excludeEnd("ctx");
  5129. return typeof aString === "string" ?
  5130. String(self) + aString :
  5131. $recv(aString)._appendToString_(String(self));
  5132. return self;
  5133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5134. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  5135. //>>excludeEnd("ctx");
  5136. }; }),
  5137. $globals.String);
  5138. $core.addMethod(
  5139. $core.method({
  5140. selector: "<",
  5141. protocol: "comparing",
  5142. //>>excludeStart("ide", pragmas.excludeIdeData);
  5143. args: ["aString"],
  5144. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5145. referencedClasses: [],
  5146. //>>excludeEnd("ide");
  5147. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  5148. messageSends: []
  5149. }, function ($methodClass){ return function (aString){
  5150. var self=this,$self=this;
  5151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5152. return $core.withContext(function($ctx1) {
  5153. //>>excludeEnd("ctx");
  5154. return String(self) < aString._asString();
  5155. return self;
  5156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5157. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5158. //>>excludeEnd("ctx");
  5159. }; }),
  5160. $globals.String);
  5161. $core.addMethod(
  5162. $core.method({
  5163. selector: "<=",
  5164. protocol: "comparing",
  5165. //>>excludeStart("ide", pragmas.excludeIdeData);
  5166. args: ["aString"],
  5167. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5168. referencedClasses: [],
  5169. //>>excludeEnd("ide");
  5170. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5171. messageSends: []
  5172. }, function ($methodClass){ return function (aString){
  5173. var self=this,$self=this;
  5174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5175. return $core.withContext(function($ctx1) {
  5176. //>>excludeEnd("ctx");
  5177. return String(self) <= aString._asString();
  5178. return self;
  5179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5180. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5181. //>>excludeEnd("ctx");
  5182. }; }),
  5183. $globals.String);
  5184. $core.addMethod(
  5185. $core.method({
  5186. selector: "=",
  5187. protocol: "comparing",
  5188. //>>excludeStart("ide", pragmas.excludeIdeData);
  5189. args: ["aString"],
  5190. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5191. referencedClasses: [],
  5192. //>>excludeEnd("ide");
  5193. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5194. messageSends: []
  5195. }, function ($methodClass){ return function (aString){
  5196. var self=this,$self=this;
  5197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5198. return $core.withContext(function($ctx1) {
  5199. //>>excludeEnd("ctx");
  5200. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5201. return self;
  5202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5203. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5204. //>>excludeEnd("ctx");
  5205. }; }),
  5206. $globals.String);
  5207. $core.addMethod(
  5208. $core.method({
  5209. selector: "==",
  5210. protocol: "comparing",
  5211. //>>excludeStart("ide", pragmas.excludeIdeData);
  5212. args: ["aString"],
  5213. source: "== aString\x0a<inlineJS: '\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'>",
  5214. referencedClasses: [],
  5215. //>>excludeEnd("ide");
  5216. pragmas: [["inlineJS:", ["\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;"]]],
  5217. messageSends: []
  5218. }, function ($methodClass){ return function (aString){
  5219. var self=this,$self=this;
  5220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5221. return $core.withContext(function($ctx1) {
  5222. //>>excludeEnd("ctx");
  5223. if (typeof aString === "string") return String(self) === aString;
  5224. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5225. else return false;;
  5226. return self;
  5227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5228. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5229. //>>excludeEnd("ctx");
  5230. }; }),
  5231. $globals.String);
  5232. $core.addMethod(
  5233. $core.method({
  5234. selector: ">",
  5235. protocol: "comparing",
  5236. //>>excludeStart("ide", pragmas.excludeIdeData);
  5237. args: ["aString"],
  5238. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5239. referencedClasses: [],
  5240. //>>excludeEnd("ide");
  5241. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5242. messageSends: []
  5243. }, function ($methodClass){ return function (aString){
  5244. var self=this,$self=this;
  5245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5246. return $core.withContext(function($ctx1) {
  5247. //>>excludeEnd("ctx");
  5248. return String(self) > aString._asString();
  5249. return self;
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5252. //>>excludeEnd("ctx");
  5253. }; }),
  5254. $globals.String);
  5255. $core.addMethod(
  5256. $core.method({
  5257. selector: ">=",
  5258. protocol: "comparing",
  5259. //>>excludeStart("ide", pragmas.excludeIdeData);
  5260. args: ["aString"],
  5261. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5262. referencedClasses: [],
  5263. //>>excludeEnd("ide");
  5264. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5265. messageSends: []
  5266. }, function ($methodClass){ return function (aString){
  5267. var self=this,$self=this;
  5268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5269. return $core.withContext(function($ctx1) {
  5270. //>>excludeEnd("ctx");
  5271. return String(self) >= aString._asString();
  5272. return self;
  5273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5274. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5275. //>>excludeEnd("ctx");
  5276. }; }),
  5277. $globals.String);
  5278. $core.addMethod(
  5279. $core.method({
  5280. selector: "add:",
  5281. protocol: "adding/removing",
  5282. //>>excludeStart("ide", pragmas.excludeIdeData);
  5283. args: ["anObject"],
  5284. source: "add: anObject\x0a\x09self errorReadOnly",
  5285. referencedClasses: [],
  5286. //>>excludeEnd("ide");
  5287. pragmas: [],
  5288. messageSends: ["errorReadOnly"]
  5289. }, function ($methodClass){ return function (anObject){
  5290. var self=this,$self=this;
  5291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5292. return $core.withContext(function($ctx1) {
  5293. //>>excludeEnd("ctx");
  5294. $self._errorReadOnly();
  5295. return self;
  5296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5297. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5298. //>>excludeEnd("ctx");
  5299. }; }),
  5300. $globals.String);
  5301. $core.addMethod(
  5302. $core.method({
  5303. selector: "appendToString:",
  5304. protocol: "copying",
  5305. //>>excludeStart("ide", pragmas.excludeIdeData);
  5306. args: ["aString"],
  5307. source: "appendToString: aString\x0a\x09<inlineJS: 'return aString + self'>",
  5308. referencedClasses: [],
  5309. //>>excludeEnd("ide");
  5310. pragmas: [["inlineJS:", ["return aString + self"]]],
  5311. messageSends: []
  5312. }, function ($methodClass){ return function (aString){
  5313. var self=this,$self=this;
  5314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5315. return $core.withContext(function($ctx1) {
  5316. //>>excludeEnd("ctx");
  5317. return aString + self;
  5318. return self;
  5319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5320. }, function($ctx1) {$ctx1.fill(self,"appendToString:",{aString:aString})});
  5321. //>>excludeEnd("ctx");
  5322. }; }),
  5323. $globals.String);
  5324. $core.addMethod(
  5325. $core.method({
  5326. selector: "asJavaScriptMethodName",
  5327. protocol: "converting",
  5328. //>>excludeStart("ide", pragmas.excludeIdeData);
  5329. args: [],
  5330. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5331. referencedClasses: [],
  5332. //>>excludeEnd("ide");
  5333. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5334. messageSends: []
  5335. }, function ($methodClass){ return function (){
  5336. var self=this,$self=this;
  5337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5338. return $core.withContext(function($ctx1) {
  5339. //>>excludeEnd("ctx");
  5340. return $core.st2js(self);
  5341. return self;
  5342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5343. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5344. //>>excludeEnd("ctx");
  5345. }; }),
  5346. $globals.String);
  5347. $core.addMethod(
  5348. $core.method({
  5349. selector: "asJavaScriptObject",
  5350. protocol: "converting",
  5351. //>>excludeStart("ide", pragmas.excludeIdeData);
  5352. args: [],
  5353. source: "asJavaScriptObject\x0a\x09^ self",
  5354. referencedClasses: [],
  5355. //>>excludeEnd("ide");
  5356. pragmas: [],
  5357. messageSends: []
  5358. }, function ($methodClass){ return function (){
  5359. var self=this,$self=this;
  5360. return self;
  5361. }; }),
  5362. $globals.String);
  5363. $core.addMethod(
  5364. $core.method({
  5365. selector: "asJavaScriptSource",
  5366. protocol: "converting",
  5367. //>>excludeStart("ide", pragmas.excludeIdeData);
  5368. args: [],
  5369. source: "asJavaScriptSource\x0a\x09<inlineJS: '\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'>",
  5370. referencedClasses: [],
  5371. //>>excludeEnd("ide");
  5372. pragmas: [["inlineJS:", ["\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"]]],
  5373. messageSends: []
  5374. }, function ($methodClass){ return function (){
  5375. var self=this,$self=this;
  5376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5377. return $core.withContext(function($ctx1) {
  5378. //>>excludeEnd("ctx");
  5379. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5380. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5381. else
  5382. return "\"" + self + "\"";
  5383. ;
  5384. return self;
  5385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5386. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5387. //>>excludeEnd("ctx");
  5388. }; }),
  5389. $globals.String);
  5390. $core.addMethod(
  5391. $core.method({
  5392. selector: "asLowercase",
  5393. protocol: "converting",
  5394. //>>excludeStart("ide", pragmas.excludeIdeData);
  5395. args: [],
  5396. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5397. referencedClasses: [],
  5398. //>>excludeEnd("ide");
  5399. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5400. messageSends: []
  5401. }, function ($methodClass){ return function (){
  5402. var self=this,$self=this;
  5403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5404. return $core.withContext(function($ctx1) {
  5405. //>>excludeEnd("ctx");
  5406. return self.toLowerCase();
  5407. return self;
  5408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5409. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5410. //>>excludeEnd("ctx");
  5411. }; }),
  5412. $globals.String);
  5413. $core.addMethod(
  5414. $core.method({
  5415. selector: "asMutator",
  5416. protocol: "converting",
  5417. //>>excludeStart("ide", pragmas.excludeIdeData);
  5418. args: [],
  5419. 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",
  5420. referencedClasses: [],
  5421. //>>excludeEnd("ide");
  5422. pragmas: [],
  5423. messageSends: ["ifFalse:", "=", "last", ","]
  5424. }, function ($methodClass){ return function (){
  5425. var self=this,$self=this;
  5426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5427. return $core.withContext(function($ctx1) {
  5428. //>>excludeEnd("ctx");
  5429. if(!$core.assert($recv($self._last()).__eq(":"))){
  5430. return $self.__comma(":");
  5431. }
  5432. return self;
  5433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5434. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5435. //>>excludeEnd("ctx");
  5436. }; }),
  5437. $globals.String);
  5438. $core.addMethod(
  5439. $core.method({
  5440. selector: "asNumber",
  5441. protocol: "converting",
  5442. //>>excludeStart("ide", pragmas.excludeIdeData);
  5443. args: [],
  5444. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5445. referencedClasses: [],
  5446. //>>excludeEnd("ide");
  5447. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5448. messageSends: []
  5449. }, function ($methodClass){ return function (){
  5450. var self=this,$self=this;
  5451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5452. return $core.withContext(function($ctx1) {
  5453. //>>excludeEnd("ctx");
  5454. return Number(self);
  5455. return self;
  5456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5457. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5458. //>>excludeEnd("ctx");
  5459. }; }),
  5460. $globals.String);
  5461. $core.addMethod(
  5462. $core.method({
  5463. selector: "asRegexp",
  5464. protocol: "converting",
  5465. //>>excludeStart("ide", pragmas.excludeIdeData);
  5466. args: [],
  5467. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5468. referencedClasses: ["RegularExpression"],
  5469. //>>excludeEnd("ide");
  5470. pragmas: [],
  5471. messageSends: ["fromString:"]
  5472. }, function ($methodClass){ return function (){
  5473. var self=this,$self=this;
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. return $core.withContext(function($ctx1) {
  5476. //>>excludeEnd("ctx");
  5477. return $recv($globals.RegularExpression)._fromString_(self);
  5478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5479. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5480. //>>excludeEnd("ctx");
  5481. }; }),
  5482. $globals.String);
  5483. $core.addMethod(
  5484. $core.method({
  5485. selector: "asString",
  5486. protocol: "converting",
  5487. //>>excludeStart("ide", pragmas.excludeIdeData);
  5488. args: [],
  5489. source: "asString\x0a\x09^ self",
  5490. referencedClasses: [],
  5491. //>>excludeEnd("ide");
  5492. pragmas: [],
  5493. messageSends: []
  5494. }, function ($methodClass){ return function (){
  5495. var self=this,$self=this;
  5496. return self;
  5497. }; }),
  5498. $globals.String);
  5499. $core.addMethod(
  5500. $core.method({
  5501. selector: "asSymbol",
  5502. protocol: "converting",
  5503. //>>excludeStart("ide", pragmas.excludeIdeData);
  5504. args: [],
  5505. source: "asSymbol\x0a\x09^ self",
  5506. referencedClasses: [],
  5507. //>>excludeEnd("ide");
  5508. pragmas: [],
  5509. messageSends: []
  5510. }, function ($methodClass){ return function (){
  5511. var self=this,$self=this;
  5512. return self;
  5513. }; }),
  5514. $globals.String);
  5515. $core.addMethod(
  5516. $core.method({
  5517. selector: "asSymbolPrintOn:",
  5518. protocol: "printing",
  5519. //>>excludeStart("ide", pragmas.excludeIdeData);
  5520. args: ["aStream"],
  5521. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5522. referencedClasses: [],
  5523. //>>excludeEnd("ide");
  5524. pragmas: [],
  5525. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5526. }, function ($methodClass){ return function (aStream){
  5527. var self=this,$self=this;
  5528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5529. return $core.withContext(function($ctx1) {
  5530. //>>excludeEnd("ctx");
  5531. $recv(aStream)._nextPutAll_("#");
  5532. if($core.assert($recv($self._asString())._isSelector())){
  5533. $recv(aStream)._nextPut_(self);
  5534. } else {
  5535. $self._printOn_(aStream);
  5536. }
  5537. return self;
  5538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5539. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5540. //>>excludeEnd("ctx");
  5541. }; }),
  5542. $globals.String);
  5543. $core.addMethod(
  5544. $core.method({
  5545. selector: "asUppercase",
  5546. protocol: "converting",
  5547. //>>excludeStart("ide", pragmas.excludeIdeData);
  5548. args: [],
  5549. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5550. referencedClasses: [],
  5551. //>>excludeEnd("ide");
  5552. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5553. messageSends: []
  5554. }, function ($methodClass){ return function (){
  5555. var self=this,$self=this;
  5556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5557. return $core.withContext(function($ctx1) {
  5558. //>>excludeEnd("ctx");
  5559. return self.toUpperCase();
  5560. return self;
  5561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5562. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5563. //>>excludeEnd("ctx");
  5564. }; }),
  5565. $globals.String);
  5566. $core.addMethod(
  5567. $core.method({
  5568. selector: "asciiValue",
  5569. protocol: "accessing",
  5570. //>>excludeStart("ide", pragmas.excludeIdeData);
  5571. args: [],
  5572. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5573. referencedClasses: [],
  5574. //>>excludeEnd("ide");
  5575. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5576. messageSends: []
  5577. }, function ($methodClass){ return function (){
  5578. var self=this,$self=this;
  5579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5580. return $core.withContext(function($ctx1) {
  5581. //>>excludeEnd("ctx");
  5582. return self.charCodeAt(0);;
  5583. return self;
  5584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5585. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5586. //>>excludeEnd("ctx");
  5587. }; }),
  5588. $globals.String);
  5589. $core.addMethod(
  5590. $core.method({
  5591. selector: "at:ifAbsent:",
  5592. protocol: "accessing",
  5593. //>>excludeStart("ide", pragmas.excludeIdeData);
  5594. args: ["anIndex", "aBlock"],
  5595. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5596. referencedClasses: [],
  5597. //>>excludeEnd("ide");
  5598. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5599. messageSends: []
  5600. }, function ($methodClass){ return function (anIndex,aBlock){
  5601. var self=this,$self=this;
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. return $core.withContext(function($ctx1) {
  5604. //>>excludeEnd("ctx");
  5605. return String(self)[anIndex - 1] || aBlock._value();
  5606. return self;
  5607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5608. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5609. //>>excludeEnd("ctx");
  5610. }; }),
  5611. $globals.String);
  5612. $core.addMethod(
  5613. $core.method({
  5614. selector: "at:ifPresent:ifAbsent:",
  5615. protocol: "accessing",
  5616. //>>excludeStart("ide", pragmas.excludeIdeData);
  5617. args: ["anIndex", "aBlock", "anotherBlock"],
  5618. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09'>",
  5619. referencedClasses: [],
  5620. //>>excludeEnd("ide");
  5621. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5622. messageSends: []
  5623. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5624. var self=this,$self=this;
  5625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5626. return $core.withContext(function($ctx1) {
  5627. //>>excludeEnd("ctx");
  5628. var result = String(self)[anIndex - 1];
  5629. return result ? aBlock._value_(result) : anotherBlock._value();
  5630. ;
  5631. return self;
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5634. //>>excludeEnd("ctx");
  5635. }; }),
  5636. $globals.String);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "at:put:",
  5640. protocol: "accessing",
  5641. //>>excludeStart("ide", pragmas.excludeIdeData);
  5642. args: ["anIndex", "anObject"],
  5643. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5644. referencedClasses: [],
  5645. //>>excludeEnd("ide");
  5646. pragmas: [],
  5647. messageSends: ["errorReadOnly"]
  5648. }, function ($methodClass){ return function (anIndex,anObject){
  5649. var self=this,$self=this;
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. return $core.withContext(function($ctx1) {
  5652. //>>excludeEnd("ctx");
  5653. $self._errorReadOnly();
  5654. return self;
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5657. //>>excludeEnd("ctx");
  5658. }; }),
  5659. $globals.String);
  5660. $core.addMethod(
  5661. $core.method({
  5662. selector: "capitalized",
  5663. protocol: "converting",
  5664. //>>excludeStart("ide", pragmas.excludeIdeData);
  5665. args: [],
  5666. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5667. referencedClasses: [],
  5668. //>>excludeEnd("ide");
  5669. pragmas: [],
  5670. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5671. }, function ($methodClass){ return function (){
  5672. var self=this,$self=this;
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. return $core.withContext(function($ctx1) {
  5675. //>>excludeEnd("ctx");
  5676. return $self._ifNotEmpty_((function(){
  5677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5678. return $core.withContext(function($ctx2) {
  5679. //>>excludeEnd("ctx");
  5680. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5682. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5683. //>>excludeEnd("ctx");
  5684. }));
  5685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5686. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5687. //>>excludeEnd("ctx");
  5688. }; }),
  5689. $globals.String);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "charCodeAt:",
  5693. protocol: "accessing",
  5694. //>>excludeStart("ide", pragmas.excludeIdeData);
  5695. args: ["anInteger"],
  5696. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5697. referencedClasses: [],
  5698. //>>excludeEnd("ide");
  5699. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5700. messageSends: []
  5701. }, function ($methodClass){ return function (anInteger){
  5702. var self=this,$self=this;
  5703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5704. return $core.withContext(function($ctx1) {
  5705. //>>excludeEnd("ctx");
  5706. return self.charCodeAt(anInteger - 1);
  5707. return self;
  5708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5709. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5710. //>>excludeEnd("ctx");
  5711. }; }),
  5712. $globals.String);
  5713. $core.addMethod(
  5714. $core.method({
  5715. selector: "copyFrom:to:",
  5716. protocol: "copying",
  5717. //>>excludeStart("ide", pragmas.excludeIdeData);
  5718. args: ["anIndex", "anotherIndex"],
  5719. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5720. referencedClasses: [],
  5721. //>>excludeEnd("ide");
  5722. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5723. messageSends: []
  5724. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5725. var self=this,$self=this;
  5726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5727. return $core.withContext(function($ctx1) {
  5728. //>>excludeEnd("ctx");
  5729. return self.substring(anIndex - 1, anotherIndex);
  5730. return self;
  5731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5732. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5733. //>>excludeEnd("ctx");
  5734. }; }),
  5735. $globals.String);
  5736. $core.addMethod(
  5737. $core.method({
  5738. selector: "copyWithFirst:",
  5739. protocol: "copying",
  5740. //>>excludeStart("ide", pragmas.excludeIdeData);
  5741. args: ["anObject"],
  5742. source: "copyWithFirst: anObject\x0a\x09(anObject isString and: [ anObject size = 1 ]) \x22character is one-char string in JS\x22\x0a\x09\x09ifFalse: [ self error: 'Cannot put ', anObject class name, ' in a String' ].\x0a\x09^ anObject, self",
  5743. referencedClasses: [],
  5744. //>>excludeEnd("ide");
  5745. pragmas: [],
  5746. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5747. }, function ($methodClass){ return function (anObject){
  5748. var self=this,$self=this;
  5749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5750. return $core.withContext(function($ctx1) {
  5751. //>>excludeEnd("ctx");
  5752. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5754. return $core.withContext(function($ctx2) {
  5755. //>>excludeEnd("ctx");
  5756. return $recv($recv(anObject)._size()).__eq((1));
  5757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5759. //>>excludeEnd("ctx");
  5760. })))){
  5761. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. ,$ctx1.sendIdx[","]=2
  5764. //>>excludeEnd("ctx");
  5765. ][0]).__comma(" in a String")
  5766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5767. ,$ctx1.sendIdx[","]=1
  5768. //>>excludeEnd("ctx");
  5769. ][0]);
  5770. }
  5771. return $recv(anObject).__comma(self);
  5772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5773. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5774. //>>excludeEnd("ctx");
  5775. }; }),
  5776. $globals.String);
  5777. $core.addMethod(
  5778. $core.method({
  5779. selector: "crlfSanitized",
  5780. protocol: "converting",
  5781. //>>excludeStart("ide", pragmas.excludeIdeData);
  5782. args: [],
  5783. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5784. referencedClasses: ["String"],
  5785. //>>excludeEnd("ide");
  5786. pragmas: [],
  5787. messageSends: ["join:", "lines", "lf"]
  5788. }, function ($methodClass){ return function (){
  5789. var self=this,$self=this;
  5790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5791. return $core.withContext(function($ctx1) {
  5792. //>>excludeEnd("ctx");
  5793. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5796. //>>excludeEnd("ctx");
  5797. }; }),
  5798. $globals.String);
  5799. $core.addMethod(
  5800. $core.method({
  5801. selector: "deepCopy",
  5802. protocol: "copying",
  5803. //>>excludeStart("ide", pragmas.excludeIdeData);
  5804. args: [],
  5805. source: "deepCopy\x0a\x09^ self shallowCopy",
  5806. referencedClasses: [],
  5807. //>>excludeEnd("ide");
  5808. pragmas: [],
  5809. messageSends: ["shallowCopy"]
  5810. }, function ($methodClass){ return function (){
  5811. var self=this,$self=this;
  5812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5813. return $core.withContext(function($ctx1) {
  5814. //>>excludeEnd("ctx");
  5815. return $self._shallowCopy();
  5816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5817. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5818. //>>excludeEnd("ctx");
  5819. }; }),
  5820. $globals.String);
  5821. $core.addMethod(
  5822. $core.method({
  5823. selector: "errorReadOnly",
  5824. protocol: "error handling",
  5825. //>>excludeStart("ide", pragmas.excludeIdeData);
  5826. args: [],
  5827. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5828. referencedClasses: [],
  5829. //>>excludeEnd("ide");
  5830. pragmas: [],
  5831. messageSends: ["error:"]
  5832. }, function ($methodClass){ return function (){
  5833. var self=this,$self=this;
  5834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5835. return $core.withContext(function($ctx1) {
  5836. //>>excludeEnd("ctx");
  5837. $self._error_("Object is read-only");
  5838. return self;
  5839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5840. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5841. //>>excludeEnd("ctx");
  5842. }; }),
  5843. $globals.String);
  5844. $core.addMethod(
  5845. $core.method({
  5846. selector: "escaped",
  5847. protocol: "converting",
  5848. //>>excludeStart("ide", pragmas.excludeIdeData);
  5849. args: [],
  5850. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5851. referencedClasses: [],
  5852. //>>excludeEnd("ide");
  5853. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5854. messageSends: []
  5855. }, function ($methodClass){ return function (){
  5856. var self=this,$self=this;
  5857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5858. return $core.withContext(function($ctx1) {
  5859. //>>excludeEnd("ctx");
  5860. return escape(self);
  5861. return self;
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5864. //>>excludeEnd("ctx");
  5865. }; }),
  5866. $globals.String);
  5867. $core.addMethod(
  5868. $core.method({
  5869. selector: "includesSubString:",
  5870. protocol: "testing",
  5871. //>>excludeStart("ide", pragmas.excludeIdeData);
  5872. args: ["subString"],
  5873. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5874. referencedClasses: [],
  5875. //>>excludeEnd("ide");
  5876. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5877. messageSends: []
  5878. }, function ($methodClass){ return function (subString){
  5879. var self=this,$self=this;
  5880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5881. return $core.withContext(function($ctx1) {
  5882. //>>excludeEnd("ctx");
  5883. return self.indexOf(subString) != -1;
  5884. return self;
  5885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5886. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5887. //>>excludeEnd("ctx");
  5888. }; }),
  5889. $globals.String);
  5890. $core.addMethod(
  5891. $core.method({
  5892. selector: "isCapitalized",
  5893. protocol: "testing",
  5894. //>>excludeStart("ide", pragmas.excludeIdeData);
  5895. args: [],
  5896. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5897. referencedClasses: [],
  5898. //>>excludeEnd("ide");
  5899. pragmas: [],
  5900. messageSends: ["==", "asUppercase", "first"]
  5901. }, function ($methodClass){ return function (){
  5902. var self=this,$self=this;
  5903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5904. return $core.withContext(function($ctx1) {
  5905. //>>excludeEnd("ctx");
  5906. return $recv($recv([$self._first()
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. ,$ctx1.sendIdx["first"]=1
  5909. //>>excludeEnd("ctx");
  5910. ][0])._asUppercase()).__eq_eq($self._first());
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5913. //>>excludeEnd("ctx");
  5914. }; }),
  5915. $globals.String);
  5916. $core.addMethod(
  5917. $core.method({
  5918. selector: "isImmutable",
  5919. protocol: "testing",
  5920. //>>excludeStart("ide", pragmas.excludeIdeData);
  5921. args: [],
  5922. source: "isImmutable\x0a\x09^ true",
  5923. referencedClasses: [],
  5924. //>>excludeEnd("ide");
  5925. pragmas: [],
  5926. messageSends: []
  5927. }, function ($methodClass){ return function (){
  5928. var self=this,$self=this;
  5929. return true;
  5930. }; }),
  5931. $globals.String);
  5932. $core.addMethod(
  5933. $core.method({
  5934. selector: "isSelector",
  5935. protocol: "testing",
  5936. //>>excludeStart("ide", pragmas.excludeIdeData);
  5937. args: [],
  5938. source: "isSelector\x0a<inlineJS:\x0a\x09'return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)'\x0a>",
  5939. referencedClasses: [],
  5940. //>>excludeEnd("ide");
  5941. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5942. messageSends: []
  5943. }, function ($methodClass){ return function (){
  5944. var self=this,$self=this;
  5945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5946. return $core.withContext(function($ctx1) {
  5947. //>>excludeEnd("ctx");
  5948. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5949. return self;
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5952. //>>excludeEnd("ctx");
  5953. }; }),
  5954. $globals.String);
  5955. $core.addMethod(
  5956. $core.method({
  5957. selector: "isString",
  5958. protocol: "testing",
  5959. //>>excludeStart("ide", pragmas.excludeIdeData);
  5960. args: [],
  5961. source: "isString\x0a\x09^ true",
  5962. referencedClasses: [],
  5963. //>>excludeEnd("ide");
  5964. pragmas: [],
  5965. messageSends: []
  5966. }, function ($methodClass){ return function (){
  5967. var self=this,$self=this;
  5968. return true;
  5969. }; }),
  5970. $globals.String);
  5971. $core.addMethod(
  5972. $core.method({
  5973. selector: "isVowel",
  5974. protocol: "testing",
  5975. //>>excludeStart("ide", pragmas.excludeIdeData);
  5976. args: [],
  5977. 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 ]",
  5978. referencedClasses: [],
  5979. //>>excludeEnd("ide");
  5980. pragmas: [],
  5981. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5982. }, function ($methodClass){ return function (){
  5983. var self=this,$self=this;
  5984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5985. return $core.withContext(function($ctx1) {
  5986. //>>excludeEnd("ctx");
  5987. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5989. return $core.withContext(function($ctx2) {
  5990. //>>excludeEnd("ctx");
  5991. return "aeiou"._includes_($self._asLowercase());
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5994. //>>excludeEnd("ctx");
  5995. }));
  5996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5997. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5998. //>>excludeEnd("ctx");
  5999. }; }),
  6000. $globals.String);
  6001. $core.addMethod(
  6002. $core.method({
  6003. selector: "join:",
  6004. protocol: "split join",
  6005. //>>excludeStart("ide", pragmas.excludeIdeData);
  6006. args: ["aCollection"],
  6007. 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 ]]",
  6008. referencedClasses: ["String"],
  6009. //>>excludeEnd("ide");
  6010. pragmas: [],
  6011. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6012. }, function ($methodClass){ return function (aCollection){
  6013. var self=this,$self=this;
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. return $core.withContext(function($ctx1) {
  6016. //>>excludeEnd("ctx");
  6017. return $recv($globals.String)._streamContents_((function(stream){
  6018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6019. return $core.withContext(function($ctx2) {
  6020. //>>excludeEnd("ctx");
  6021. return $recv(aCollection)._do_separatedBy_((function(each){
  6022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6023. return $core.withContext(function($ctx3) {
  6024. //>>excludeEnd("ctx");
  6025. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. ,$ctx3.sendIdx["nextPutAll:"]=1
  6028. //>>excludeEnd("ctx");
  6029. ][0];
  6030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6031. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6032. //>>excludeEnd("ctx");
  6033. }),(function(){
  6034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6035. return $core.withContext(function($ctx3) {
  6036. //>>excludeEnd("ctx");
  6037. return $recv(stream)._nextPutAll_(self);
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6040. //>>excludeEnd("ctx");
  6041. }));
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6044. //>>excludeEnd("ctx");
  6045. }));
  6046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6047. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  6048. //>>excludeEnd("ctx");
  6049. }; }),
  6050. $globals.String);
  6051. $core.addMethod(
  6052. $core.method({
  6053. selector: "lineIndicesDo:",
  6054. protocol: "split join",
  6055. //>>excludeStart("ide", pragmas.excludeIdeData);
  6056. args: ["aBlock"],
  6057. 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 ] ]]",
  6058. referencedClasses: ["String"],
  6059. //>>excludeEnd("ide");
  6060. pragmas: [],
  6061. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6062. }, function ($methodClass){ return function (aBlock){
  6063. var self=this,$self=this;
  6064. var cr,lf,start,sz,nextLF,nextCR;
  6065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6066. return $core.withContext(function($ctx1) {
  6067. //>>excludeEnd("ctx");
  6068. var $early={};
  6069. try {
  6070. start=(1);
  6071. sz=$self._size();
  6072. cr=$recv($globals.String)._cr();
  6073. nextCR=[$self._indexOf_startingAt_(cr,(1))
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  6076. //>>excludeEnd("ctx");
  6077. ][0];
  6078. lf=$recv($globals.String)._lf();
  6079. nextLF=[$self._indexOf_startingAt_(lf,(1))
  6080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6081. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  6082. //>>excludeEnd("ctx");
  6083. ][0];
  6084. $recv((function(){
  6085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6086. return $core.withContext(function($ctx2) {
  6087. //>>excludeEnd("ctx");
  6088. return $recv(start).__lt_eq(sz);
  6089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6091. //>>excludeEnd("ctx");
  6092. }))._whileTrue_((function(){
  6093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6094. return $core.withContext(function($ctx2) {
  6095. //>>excludeEnd("ctx");
  6096. if($core.assert([$recv([$recv(nextLF).__eq((0))
  6097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6098. ,$ctx2.sendIdx["="]=1
  6099. //>>excludeEnd("ctx");
  6100. ][0])._and_((function(){
  6101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6102. return $core.withContext(function($ctx3) {
  6103. //>>excludeEnd("ctx");
  6104. return [$recv(nextCR).__eq((0))
  6105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6106. ,$ctx3.sendIdx["="]=2
  6107. //>>excludeEnd("ctx");
  6108. ][0];
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6111. //>>excludeEnd("ctx");
  6112. }))
  6113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6114. ,$ctx2.sendIdx["and:"]=1
  6115. //>>excludeEnd("ctx");
  6116. ][0])){
  6117. [$recv(aBlock)._value_value_value_(start,sz,sz)
  6118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6119. ,$ctx2.sendIdx["value:value:value:"]=1
  6120. //>>excludeEnd("ctx");
  6121. ][0];
  6122. throw $early=[self];
  6123. }
  6124. if($core.assert($recv([$recv(nextCR).__eq((0))
  6125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6126. ,$ctx2.sendIdx["="]=3
  6127. //>>excludeEnd("ctx");
  6128. ][0])._or_((function(){
  6129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6130. return $core.withContext(function($ctx3) {
  6131. //>>excludeEnd("ctx");
  6132. return $recv([(0).__lt(nextLF)
  6133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6134. ,$ctx3.sendIdx["<"]=1
  6135. //>>excludeEnd("ctx");
  6136. ][0])._and_((function(){
  6137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6138. return $core.withContext(function($ctx4) {
  6139. //>>excludeEnd("ctx");
  6140. return $recv(nextLF).__lt(nextCR);
  6141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6142. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6143. //>>excludeEnd("ctx");
  6144. }));
  6145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6147. //>>excludeEnd("ctx");
  6148. })))){
  6149. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. ,$ctx2.sendIdx["-"]=1
  6152. //>>excludeEnd("ctx");
  6153. ][0],nextLF)
  6154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6155. ,$ctx2.sendIdx["value:value:value:"]=2
  6156. //>>excludeEnd("ctx");
  6157. ][0];
  6158. start=[(1).__plus(nextLF)
  6159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6160. ,$ctx2.sendIdx["+"]=1
  6161. //>>excludeEnd("ctx");
  6162. ][0];
  6163. nextLF=[$self._indexOf_startingAt_(lf,start)
  6164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6165. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  6166. //>>excludeEnd("ctx");
  6167. ][0];
  6168. return nextLF;
  6169. } else {
  6170. if($core.assert($recv([(1).__plus(nextCR)
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. ,$ctx2.sendIdx["+"]=2
  6173. //>>excludeEnd("ctx");
  6174. ][0]).__eq(nextLF))){
  6175. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6177. ,$ctx2.sendIdx["-"]=2
  6178. //>>excludeEnd("ctx");
  6179. ][0],nextLF)
  6180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6181. ,$ctx2.sendIdx["value:value:value:"]=3
  6182. //>>excludeEnd("ctx");
  6183. ][0];
  6184. start=[(1).__plus(nextLF)
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. ,$ctx2.sendIdx["+"]=3
  6187. //>>excludeEnd("ctx");
  6188. ][0];
  6189. nextCR=[$self._indexOf_startingAt_(cr,start)
  6190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6191. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6192. //>>excludeEnd("ctx");
  6193. ][0];
  6194. nextLF=[$self._indexOf_startingAt_(lf,start)
  6195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6196. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6197. //>>excludeEnd("ctx");
  6198. ][0];
  6199. return nextLF;
  6200. } else {
  6201. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6202. start=(1).__plus(nextCR);
  6203. nextCR=$self._indexOf_startingAt_(cr,start);
  6204. return nextCR;
  6205. }
  6206. }
  6207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6209. //>>excludeEnd("ctx");
  6210. }));
  6211. return self;
  6212. }
  6213. catch(e) {if(e===$early)return e[0]; throw e}
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6216. //>>excludeEnd("ctx");
  6217. }; }),
  6218. $globals.String);
  6219. $core.addMethod(
  6220. $core.method({
  6221. selector: "lineNumber:",
  6222. protocol: "split join",
  6223. //>>excludeStart("ide", pragmas.excludeIdeData);
  6224. args: ["anIndex"],
  6225. 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",
  6226. referencedClasses: [],
  6227. //>>excludeEnd("ide");
  6228. pragmas: [],
  6229. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6230. }, function ($methodClass){ return function (anIndex){
  6231. var self=this,$self=this;
  6232. var lineCount;
  6233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6234. return $core.withContext(function($ctx1) {
  6235. //>>excludeEnd("ctx");
  6236. var $early={};
  6237. try {
  6238. lineCount=(0);
  6239. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6241. return $core.withContext(function($ctx2) {
  6242. //>>excludeEnd("ctx");
  6243. lineCount=$recv(lineCount).__plus((1));
  6244. if($core.assert($recv(lineCount).__eq(anIndex))){
  6245. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6246. }
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6249. //>>excludeEnd("ctx");
  6250. }));
  6251. return nil;
  6252. }
  6253. catch(e) {if(e===$early)return e[0]; throw e}
  6254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6255. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6256. //>>excludeEnd("ctx");
  6257. }; }),
  6258. $globals.String);
  6259. $core.addMethod(
  6260. $core.method({
  6261. selector: "lines",
  6262. protocol: "split join",
  6263. //>>excludeStart("ide", pragmas.excludeIdeData);
  6264. args: [],
  6265. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<inlineJS: '\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a'>",
  6266. referencedClasses: [],
  6267. //>>excludeEnd("ide");
  6268. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6269. messageSends: []
  6270. }, function ($methodClass){ return function (){
  6271. var self=this,$self=this;
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. return $core.withContext(function($ctx1) {
  6274. //>>excludeEnd("ctx");
  6275. var result = self.split(/\r\n|\r|\n/);
  6276. if (!result[result.length-1]) result.pop();
  6277. return result;;
  6278. return self;
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6281. //>>excludeEnd("ctx");
  6282. }; }),
  6283. $globals.String);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "linesDo:",
  6287. protocol: "split join",
  6288. //>>excludeStart("ide", pragmas.excludeIdeData);
  6289. args: ["aBlock"],
  6290. 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",
  6291. referencedClasses: [],
  6292. //>>excludeEnd("ide");
  6293. pragmas: [],
  6294. messageSends: ["do:", "lines"]
  6295. }, function ($methodClass){ return function (aBlock){
  6296. var self=this,$self=this;
  6297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6298. return $core.withContext(function($ctx1) {
  6299. //>>excludeEnd("ctx");
  6300. $recv($self._lines())._do_(aBlock);
  6301. return self;
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6304. //>>excludeEnd("ctx");
  6305. }; }),
  6306. $globals.String);
  6307. $core.addMethod(
  6308. $core.method({
  6309. selector: "match:",
  6310. protocol: "regular expressions",
  6311. //>>excludeStart("ide", pragmas.excludeIdeData);
  6312. args: ["aRegexp"],
  6313. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6314. referencedClasses: [],
  6315. //>>excludeEnd("ide");
  6316. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6317. messageSends: []
  6318. }, function ($methodClass){ return function (aRegexp){
  6319. var self=this,$self=this;
  6320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6321. return $core.withContext(function($ctx1) {
  6322. //>>excludeEnd("ctx");
  6323. return self.search(aRegexp) != -1;
  6324. return self;
  6325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6326. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6327. //>>excludeEnd("ctx");
  6328. }; }),
  6329. $globals.String);
  6330. $core.addMethod(
  6331. $core.method({
  6332. selector: "matchesOf:",
  6333. protocol: "regular expressions",
  6334. //>>excludeStart("ide", pragmas.excludeIdeData);
  6335. args: ["aRegularExpression"],
  6336. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6337. referencedClasses: [],
  6338. //>>excludeEnd("ide");
  6339. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6340. messageSends: []
  6341. }, function ($methodClass){ return function (aRegularExpression){
  6342. var self=this,$self=this;
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. return $core.withContext(function($ctx1) {
  6345. //>>excludeEnd("ctx");
  6346. return self.match(aRegularExpression);
  6347. return self;
  6348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6349. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6350. //>>excludeEnd("ctx");
  6351. }; }),
  6352. $globals.String);
  6353. $core.addMethod(
  6354. $core.method({
  6355. selector: "printNl",
  6356. protocol: "printing",
  6357. //>>excludeStart("ide", pragmas.excludeIdeData);
  6358. args: [],
  6359. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6360. referencedClasses: [],
  6361. //>>excludeEnd("ide");
  6362. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6363. messageSends: []
  6364. }, function ($methodClass){ return function (){
  6365. var self=this,$self=this;
  6366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6367. return $core.withContext(function($ctx1) {
  6368. //>>excludeEnd("ctx");
  6369. console.log(self);
  6370. return self;
  6371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6372. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6373. //>>excludeEnd("ctx");
  6374. }; }),
  6375. $globals.String);
  6376. $core.addMethod(
  6377. $core.method({
  6378. selector: "printOn:",
  6379. protocol: "printing",
  6380. //>>excludeStart("ide", pragmas.excludeIdeData);
  6381. args: ["aStream"],
  6382. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6383. referencedClasses: [],
  6384. //>>excludeEnd("ide");
  6385. pragmas: [],
  6386. messageSends: ["nextPutAll:", "replace:with:"]
  6387. }, function ($methodClass){ return function (aStream){
  6388. var self=this,$self=this;
  6389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6390. return $core.withContext(function($ctx1) {
  6391. //>>excludeEnd("ctx");
  6392. [$recv(aStream)._nextPutAll_("'")
  6393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6394. ,$ctx1.sendIdx["nextPutAll:"]=1
  6395. //>>excludeEnd("ctx");
  6396. ][0];
  6397. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6399. ,$ctx1.sendIdx["nextPutAll:"]=2
  6400. //>>excludeEnd("ctx");
  6401. ][0];
  6402. $recv(aStream)._nextPutAll_("'");
  6403. return self;
  6404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6405. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6406. //>>excludeEnd("ctx");
  6407. }; }),
  6408. $globals.String);
  6409. $core.addMethod(
  6410. $core.method({
  6411. selector: "putOn:",
  6412. protocol: "streaming",
  6413. //>>excludeStart("ide", pragmas.excludeIdeData);
  6414. args: ["aStream"],
  6415. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6416. referencedClasses: [],
  6417. //>>excludeEnd("ide");
  6418. pragmas: [],
  6419. messageSends: ["nextPutString:"]
  6420. }, function ($methodClass){ return function (aStream){
  6421. var self=this,$self=this;
  6422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6423. return $core.withContext(function($ctx1) {
  6424. //>>excludeEnd("ctx");
  6425. $recv(aStream)._nextPutString_(self);
  6426. return self;
  6427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6428. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6429. //>>excludeEnd("ctx");
  6430. }; }),
  6431. $globals.String);
  6432. $core.addMethod(
  6433. $core.method({
  6434. selector: "remove:",
  6435. protocol: "adding/removing",
  6436. //>>excludeStart("ide", pragmas.excludeIdeData);
  6437. args: ["anObject"],
  6438. source: "remove: anObject\x0a\x09self errorReadOnly",
  6439. referencedClasses: [],
  6440. //>>excludeEnd("ide");
  6441. pragmas: [],
  6442. messageSends: ["errorReadOnly"]
  6443. }, function ($methodClass){ return function (anObject){
  6444. var self=this,$self=this;
  6445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6446. return $core.withContext(function($ctx1) {
  6447. //>>excludeEnd("ctx");
  6448. $self._errorReadOnly();
  6449. return self;
  6450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6451. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6452. //>>excludeEnd("ctx");
  6453. }; }),
  6454. $globals.String);
  6455. $core.addMethod(
  6456. $core.method({
  6457. selector: "remove:ifAbsent:",
  6458. protocol: "adding/removing",
  6459. //>>excludeStart("ide", pragmas.excludeIdeData);
  6460. args: ["anObject", "aBlock"],
  6461. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6462. referencedClasses: [],
  6463. //>>excludeEnd("ide");
  6464. pragmas: [],
  6465. messageSends: ["errorReadOnly"]
  6466. }, function ($methodClass){ return function (anObject,aBlock){
  6467. var self=this,$self=this;
  6468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6469. return $core.withContext(function($ctx1) {
  6470. //>>excludeEnd("ctx");
  6471. $self._errorReadOnly();
  6472. return self;
  6473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6474. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6475. //>>excludeEnd("ctx");
  6476. }; }),
  6477. $globals.String);
  6478. $core.addMethod(
  6479. $core.method({
  6480. selector: "replace:with:",
  6481. protocol: "regular expressions",
  6482. //>>excludeStart("ide", pragmas.excludeIdeData);
  6483. args: ["aString", "anotherString"],
  6484. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6485. referencedClasses: ["RegularExpression"],
  6486. //>>excludeEnd("ide");
  6487. pragmas: [],
  6488. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6489. }, function ($methodClass){ return function (aString,anotherString){
  6490. var self=this,$self=this;
  6491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6492. return $core.withContext(function($ctx1) {
  6493. //>>excludeEnd("ctx");
  6494. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6496. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6497. //>>excludeEnd("ctx");
  6498. }; }),
  6499. $globals.String);
  6500. $core.addMethod(
  6501. $core.method({
  6502. selector: "replaceRegexp:with:",
  6503. protocol: "regular expressions",
  6504. //>>excludeStart("ide", pragmas.excludeIdeData);
  6505. args: ["aRegexp", "aString"],
  6506. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6507. referencedClasses: [],
  6508. //>>excludeEnd("ide");
  6509. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6510. messageSends: []
  6511. }, function ($methodClass){ return function (aRegexp,aString){
  6512. var self=this,$self=this;
  6513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6514. return $core.withContext(function($ctx1) {
  6515. //>>excludeEnd("ctx");
  6516. return self.replace(aRegexp, aString);
  6517. return self;
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6520. //>>excludeEnd("ctx");
  6521. }; }),
  6522. $globals.String);
  6523. $core.addMethod(
  6524. $core.method({
  6525. selector: "reversed",
  6526. protocol: "converting",
  6527. //>>excludeStart("ide", pragmas.excludeIdeData);
  6528. args: [],
  6529. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6530. referencedClasses: [],
  6531. //>>excludeEnd("ide");
  6532. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6533. messageSends: []
  6534. }, function ($methodClass){ return function (){
  6535. var self=this,$self=this;
  6536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6537. return $core.withContext(function($ctx1) {
  6538. //>>excludeEnd("ctx");
  6539. return self.split("").reverse().join("");
  6540. return self;
  6541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6542. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6543. //>>excludeEnd("ctx");
  6544. }; }),
  6545. $globals.String);
  6546. $core.addMethod(
  6547. $core.method({
  6548. selector: "shallowCopy",
  6549. protocol: "copying",
  6550. //>>excludeStart("ide", pragmas.excludeIdeData);
  6551. args: [],
  6552. source: "shallowCopy\x0a\x09^ self",
  6553. referencedClasses: [],
  6554. //>>excludeEnd("ide");
  6555. pragmas: [],
  6556. messageSends: []
  6557. }, function ($methodClass){ return function (){
  6558. var self=this,$self=this;
  6559. return self;
  6560. }; }),
  6561. $globals.String);
  6562. $core.addMethod(
  6563. $core.method({
  6564. selector: "shortenedPrintString",
  6565. protocol: "printing",
  6566. //>>excludeStart("ide", pragmas.excludeIdeData);
  6567. args: [],
  6568. source: "shortenedPrintString\x0a\x09^ self printString size > 30\x0a\x09\x09ifTrue: [ (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ self printString ]",
  6569. referencedClasses: [],
  6570. //>>excludeEnd("ide");
  6571. pragmas: [],
  6572. messageSends: ["ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:"]
  6573. }, function ($methodClass){ return function (){
  6574. var self=this,$self=this;
  6575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6576. return $core.withContext(function($ctx1) {
  6577. //>>excludeEnd("ctx");
  6578. if($core.assert($recv($recv([$self._printString()
  6579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6580. ,$ctx1.sendIdx["printString"]=1
  6581. //>>excludeEnd("ctx");
  6582. ][0])._size()).__gt((30)))){
  6583. return $recv($recv([$self._printString()
  6584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6585. ,$ctx1.sendIdx["printString"]=2
  6586. //>>excludeEnd("ctx");
  6587. ][0])._copyFrom_to_((1),(30))).__comma("...'");
  6588. } else {
  6589. return $self._printString();
  6590. }
  6591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6592. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  6593. //>>excludeEnd("ctx");
  6594. }; }),
  6595. $globals.String);
  6596. $core.addMethod(
  6597. $core.method({
  6598. selector: "subStrings:",
  6599. protocol: "split join",
  6600. //>>excludeStart("ide", pragmas.excludeIdeData);
  6601. args: ["aString"],
  6602. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6603. referencedClasses: [],
  6604. //>>excludeEnd("ide");
  6605. pragmas: [],
  6606. messageSends: ["tokenize:"]
  6607. }, function ($methodClass){ return function (aString){
  6608. var self=this,$self=this;
  6609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6610. return $core.withContext(function($ctx1) {
  6611. //>>excludeEnd("ctx");
  6612. return $self._tokenize_(aString);
  6613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6614. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6615. //>>excludeEnd("ctx");
  6616. }; }),
  6617. $globals.String);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "symbolPrintString",
  6621. protocol: "printing",
  6622. //>>excludeStart("ide", pragmas.excludeIdeData);
  6623. args: [],
  6624. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6625. referencedClasses: ["String"],
  6626. //>>excludeEnd("ide");
  6627. pragmas: [],
  6628. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6629. }, function ($methodClass){ return function (){
  6630. var self=this,$self=this;
  6631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6632. return $core.withContext(function($ctx1) {
  6633. //>>excludeEnd("ctx");
  6634. return $recv($globals.String)._streamContents_((function(str){
  6635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6636. return $core.withContext(function($ctx2) {
  6637. //>>excludeEnd("ctx");
  6638. return $self._asSymbolPrintOn_(str);
  6639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6640. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6641. //>>excludeEnd("ctx");
  6642. }));
  6643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6644. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6645. //>>excludeEnd("ctx");
  6646. }; }),
  6647. $globals.String);
  6648. $core.addMethod(
  6649. $core.method({
  6650. selector: "tokenize:",
  6651. protocol: "split join",
  6652. //>>excludeStart("ide", pragmas.excludeIdeData);
  6653. args: ["aString"],
  6654. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6655. referencedClasses: [],
  6656. //>>excludeEnd("ide");
  6657. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6658. messageSends: []
  6659. }, function ($methodClass){ return function (aString){
  6660. var self=this,$self=this;
  6661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6662. return $core.withContext(function($ctx1) {
  6663. //>>excludeEnd("ctx");
  6664. return self.split(aString);
  6665. return self;
  6666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6667. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6668. //>>excludeEnd("ctx");
  6669. }; }),
  6670. $globals.String);
  6671. $core.addMethod(
  6672. $core.method({
  6673. selector: "trimBoth",
  6674. protocol: "regular expressions",
  6675. //>>excludeStart("ide", pragmas.excludeIdeData);
  6676. args: [],
  6677. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6678. referencedClasses: [],
  6679. //>>excludeEnd("ide");
  6680. pragmas: [],
  6681. messageSends: ["trimBoth:"]
  6682. }, function ($methodClass){ return function (){
  6683. var self=this,$self=this;
  6684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6685. return $core.withContext(function($ctx1) {
  6686. //>>excludeEnd("ctx");
  6687. return $self._trimBoth_("\x5cs");
  6688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6689. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6690. //>>excludeEnd("ctx");
  6691. }; }),
  6692. $globals.String);
  6693. $core.addMethod(
  6694. $core.method({
  6695. selector: "trimBoth:",
  6696. protocol: "regular expressions",
  6697. //>>excludeStart("ide", pragmas.excludeIdeData);
  6698. args: ["separators"],
  6699. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6700. referencedClasses: [],
  6701. //>>excludeEnd("ide");
  6702. pragmas: [],
  6703. messageSends: ["trimRight:", "trimLeft:"]
  6704. }, function ($methodClass){ return function (separators){
  6705. var self=this,$self=this;
  6706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6707. return $core.withContext(function($ctx1) {
  6708. //>>excludeEnd("ctx");
  6709. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6711. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6712. //>>excludeEnd("ctx");
  6713. }; }),
  6714. $globals.String);
  6715. $core.addMethod(
  6716. $core.method({
  6717. selector: "trimLeft",
  6718. protocol: "regular expressions",
  6719. //>>excludeStart("ide", pragmas.excludeIdeData);
  6720. args: [],
  6721. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6722. referencedClasses: [],
  6723. //>>excludeEnd("ide");
  6724. pragmas: [],
  6725. messageSends: ["trimLeft:"]
  6726. }, function ($methodClass){ return function (){
  6727. var self=this,$self=this;
  6728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6729. return $core.withContext(function($ctx1) {
  6730. //>>excludeEnd("ctx");
  6731. return $self._trimLeft_("\x5cs");
  6732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6733. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6734. //>>excludeEnd("ctx");
  6735. }; }),
  6736. $globals.String);
  6737. $core.addMethod(
  6738. $core.method({
  6739. selector: "trimLeft:",
  6740. protocol: "regular expressions",
  6741. //>>excludeStart("ide", pragmas.excludeIdeData);
  6742. args: ["separators"],
  6743. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6744. referencedClasses: ["RegularExpression"],
  6745. //>>excludeEnd("ide");
  6746. pragmas: [],
  6747. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6748. }, function ($methodClass){ return function (separators){
  6749. var self=this,$self=this;
  6750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6751. return $core.withContext(function($ctx1) {
  6752. //>>excludeEnd("ctx");
  6753. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6755. ,$ctx1.sendIdx[","]=1
  6756. //>>excludeEnd("ctx");
  6757. ][0],"g"),"");
  6758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6759. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6760. //>>excludeEnd("ctx");
  6761. }; }),
  6762. $globals.String);
  6763. $core.addMethod(
  6764. $core.method({
  6765. selector: "trimRight",
  6766. protocol: "regular expressions",
  6767. //>>excludeStart("ide", pragmas.excludeIdeData);
  6768. args: [],
  6769. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6770. referencedClasses: [],
  6771. //>>excludeEnd("ide");
  6772. pragmas: [],
  6773. messageSends: ["trimRight:"]
  6774. }, function ($methodClass){ return function (){
  6775. var self=this,$self=this;
  6776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6777. return $core.withContext(function($ctx1) {
  6778. //>>excludeEnd("ctx");
  6779. return $self._trimRight_("\x5cs");
  6780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6781. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6782. //>>excludeEnd("ctx");
  6783. }; }),
  6784. $globals.String);
  6785. $core.addMethod(
  6786. $core.method({
  6787. selector: "trimRight:",
  6788. protocol: "regular expressions",
  6789. //>>excludeStart("ide", pragmas.excludeIdeData);
  6790. args: ["separators"],
  6791. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6792. referencedClasses: ["RegularExpression"],
  6793. //>>excludeEnd("ide");
  6794. pragmas: [],
  6795. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6796. }, function ($methodClass){ return function (separators){
  6797. var self=this,$self=this;
  6798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6799. return $core.withContext(function($ctx1) {
  6800. //>>excludeEnd("ctx");
  6801. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6803. ,$ctx1.sendIdx[","]=1
  6804. //>>excludeEnd("ctx");
  6805. ][0],"g"),"");
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6808. //>>excludeEnd("ctx");
  6809. }; }),
  6810. $globals.String);
  6811. $core.addMethod(
  6812. $core.method({
  6813. selector: "unescaped",
  6814. protocol: "converting",
  6815. //>>excludeStart("ide", pragmas.excludeIdeData);
  6816. args: [],
  6817. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6818. referencedClasses: [],
  6819. //>>excludeEnd("ide");
  6820. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6821. messageSends: []
  6822. }, function ($methodClass){ return function (){
  6823. var self=this,$self=this;
  6824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6825. return $core.withContext(function($ctx1) {
  6826. //>>excludeEnd("ctx");
  6827. return unescape(self);
  6828. return self;
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6831. //>>excludeEnd("ctx");
  6832. }; }),
  6833. $globals.String);
  6834. $core.addMethod(
  6835. $core.method({
  6836. selector: "uriComponentDecoded",
  6837. protocol: "converting",
  6838. //>>excludeStart("ide", pragmas.excludeIdeData);
  6839. args: [],
  6840. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6841. referencedClasses: [],
  6842. //>>excludeEnd("ide");
  6843. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6844. messageSends: []
  6845. }, function ($methodClass){ return function (){
  6846. var self=this,$self=this;
  6847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6848. return $core.withContext(function($ctx1) {
  6849. //>>excludeEnd("ctx");
  6850. return decodeURIComponent(self);
  6851. return self;
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6854. //>>excludeEnd("ctx");
  6855. }; }),
  6856. $globals.String);
  6857. $core.addMethod(
  6858. $core.method({
  6859. selector: "uriComponentEncoded",
  6860. protocol: "converting",
  6861. //>>excludeStart("ide", pragmas.excludeIdeData);
  6862. args: [],
  6863. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6864. referencedClasses: [],
  6865. //>>excludeEnd("ide");
  6866. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6867. messageSends: []
  6868. }, function ($methodClass){ return function (){
  6869. var self=this,$self=this;
  6870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6871. return $core.withContext(function($ctx1) {
  6872. //>>excludeEnd("ctx");
  6873. return encodeURIComponent(self);
  6874. return self;
  6875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6876. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6877. //>>excludeEnd("ctx");
  6878. }; }),
  6879. $globals.String);
  6880. $core.addMethod(
  6881. $core.method({
  6882. selector: "uriDecoded",
  6883. protocol: "converting",
  6884. //>>excludeStart("ide", pragmas.excludeIdeData);
  6885. args: [],
  6886. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6887. referencedClasses: [],
  6888. //>>excludeEnd("ide");
  6889. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6890. messageSends: []
  6891. }, function ($methodClass){ return function (){
  6892. var self=this,$self=this;
  6893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6894. return $core.withContext(function($ctx1) {
  6895. //>>excludeEnd("ctx");
  6896. return decodeURI(self);
  6897. return self;
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6900. //>>excludeEnd("ctx");
  6901. }; }),
  6902. $globals.String);
  6903. $core.addMethod(
  6904. $core.method({
  6905. selector: "uriEncoded",
  6906. protocol: "converting",
  6907. //>>excludeStart("ide", pragmas.excludeIdeData);
  6908. args: [],
  6909. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6910. referencedClasses: [],
  6911. //>>excludeEnd("ide");
  6912. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6913. messageSends: []
  6914. }, function ($methodClass){ return function (){
  6915. var self=this,$self=this;
  6916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6917. return $core.withContext(function($ctx1) {
  6918. //>>excludeEnd("ctx");
  6919. return encodeURI(self);
  6920. return self;
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6923. //>>excludeEnd("ctx");
  6924. }; }),
  6925. $globals.String);
  6926. $core.addMethod(
  6927. $core.method({
  6928. selector: "value:",
  6929. protocol: "evaluating",
  6930. //>>excludeStart("ide", pragmas.excludeIdeData);
  6931. args: ["anObject"],
  6932. source: "value: anObject \x0a\x09^ anObject perform: self",
  6933. referencedClasses: [],
  6934. //>>excludeEnd("ide");
  6935. pragmas: [],
  6936. messageSends: ["perform:"]
  6937. }, function ($methodClass){ return function (anObject){
  6938. var self=this,$self=this;
  6939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6940. return $core.withContext(function($ctx1) {
  6941. //>>excludeEnd("ctx");
  6942. return $recv(anObject)._perform_(self);
  6943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6944. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6945. //>>excludeEnd("ctx");
  6946. }; }),
  6947. $globals.String);
  6948. $core.addMethod(
  6949. $core.method({
  6950. selector: "cr",
  6951. protocol: "accessing",
  6952. //>>excludeStart("ide", pragmas.excludeIdeData);
  6953. args: [],
  6954. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6955. referencedClasses: [],
  6956. //>>excludeEnd("ide");
  6957. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6958. messageSends: []
  6959. }, function ($methodClass){ return function (){
  6960. var self=this,$self=this;
  6961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6962. return $core.withContext(function($ctx1) {
  6963. //>>excludeEnd("ctx");
  6964. return "\r";
  6965. return self;
  6966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6967. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6968. //>>excludeEnd("ctx");
  6969. }; }),
  6970. $globals.String.a$cls);
  6971. $core.addMethod(
  6972. $core.method({
  6973. selector: "crlf",
  6974. protocol: "accessing",
  6975. //>>excludeStart("ide", pragmas.excludeIdeData);
  6976. args: [],
  6977. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6978. referencedClasses: [],
  6979. //>>excludeEnd("ide");
  6980. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6981. messageSends: []
  6982. }, function ($methodClass){ return function (){
  6983. var self=this,$self=this;
  6984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6985. return $core.withContext(function($ctx1) {
  6986. //>>excludeEnd("ctx");
  6987. return "\r\n";
  6988. return self;
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6991. //>>excludeEnd("ctx");
  6992. }; }),
  6993. $globals.String.a$cls);
  6994. $core.addMethod(
  6995. $core.method({
  6996. selector: "esc",
  6997. protocol: "accessing",
  6998. //>>excludeStart("ide", pragmas.excludeIdeData);
  6999. args: [],
  7000. source: "esc\x0a\x09^ self fromCharCode: 27",
  7001. referencedClasses: [],
  7002. //>>excludeEnd("ide");
  7003. pragmas: [],
  7004. messageSends: ["fromCharCode:"]
  7005. }, function ($methodClass){ return function (){
  7006. var self=this,$self=this;
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. return $core.withContext(function($ctx1) {
  7009. //>>excludeEnd("ctx");
  7010. return $self._fromCharCode_((27));
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  7013. //>>excludeEnd("ctx");
  7014. }; }),
  7015. $globals.String.a$cls);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "fromCharCode:",
  7019. protocol: "instance creation",
  7020. //>>excludeStart("ide", pragmas.excludeIdeData);
  7021. args: ["anInteger"],
  7022. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7023. referencedClasses: [],
  7024. //>>excludeEnd("ide");
  7025. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  7026. messageSends: []
  7027. }, function ($methodClass){ return function (anInteger){
  7028. var self=this,$self=this;
  7029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7030. return $core.withContext(function($ctx1) {
  7031. //>>excludeEnd("ctx");
  7032. return String.fromCharCode(anInteger);
  7033. return self;
  7034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7035. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  7036. //>>excludeEnd("ctx");
  7037. }; }),
  7038. $globals.String.a$cls);
  7039. $core.addMethod(
  7040. $core.method({
  7041. selector: "fromString:",
  7042. protocol: "instance creation",
  7043. //>>excludeStart("ide", pragmas.excludeIdeData);
  7044. args: ["aString"],
  7045. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7046. referencedClasses: [],
  7047. //>>excludeEnd("ide");
  7048. pragmas: [["inlineJS:", ["return String(aString)"]]],
  7049. messageSends: []
  7050. }, function ($methodClass){ return function (aString){
  7051. var self=this,$self=this;
  7052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7053. return $core.withContext(function($ctx1) {
  7054. //>>excludeEnd("ctx");
  7055. return String(aString);
  7056. return self;
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  7059. //>>excludeEnd("ctx");
  7060. }; }),
  7061. $globals.String.a$cls);
  7062. $core.addMethod(
  7063. $core.method({
  7064. selector: "lf",
  7065. protocol: "accessing",
  7066. //>>excludeStart("ide", pragmas.excludeIdeData);
  7067. args: [],
  7068. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7069. referencedClasses: [],
  7070. //>>excludeEnd("ide");
  7071. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  7072. messageSends: []
  7073. }, function ($methodClass){ return function (){
  7074. var self=this,$self=this;
  7075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7076. return $core.withContext(function($ctx1) {
  7077. //>>excludeEnd("ctx");
  7078. return "\n";
  7079. return self;
  7080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7081. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  7082. //>>excludeEnd("ctx");
  7083. }; }),
  7084. $globals.String.a$cls);
  7085. $core.addMethod(
  7086. $core.method({
  7087. selector: "random",
  7088. protocol: "random",
  7089. //>>excludeStart("ide", pragmas.excludeIdeData);
  7090. args: [],
  7091. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  7092. referencedClasses: [],
  7093. //>>excludeEnd("ide");
  7094. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  7095. messageSends: []
  7096. }, function ($methodClass){ return function (){
  7097. var self=this,$self=this;
  7098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7099. return $core.withContext(function($ctx1) {
  7100. //>>excludeEnd("ctx");
  7101. return ((10+22*Math.random())/32).toString(32).slice(2);;
  7102. return self;
  7103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7104. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  7105. //>>excludeEnd("ctx");
  7106. }; }),
  7107. $globals.String.a$cls);
  7108. $core.addMethod(
  7109. $core.method({
  7110. selector: "randomNotIn:",
  7111. protocol: "random",
  7112. //>>excludeStart("ide", pragmas.excludeIdeData);
  7113. args: ["aString"],
  7114. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7115. referencedClasses: [],
  7116. //>>excludeEnd("ide");
  7117. pragmas: [],
  7118. messageSends: ["whileTrue", "random", "includesSubString:"]
  7119. }, function ($methodClass){ return function (aString){
  7120. var self=this,$self=this;
  7121. var result;
  7122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7123. return $core.withContext(function($ctx1) {
  7124. //>>excludeEnd("ctx");
  7125. $recv((function(){
  7126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7127. return $core.withContext(function($ctx2) {
  7128. //>>excludeEnd("ctx");
  7129. result=$self._random();
  7130. return $recv(aString)._includesSubString_(result);
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7133. //>>excludeEnd("ctx");
  7134. }))._whileTrue();
  7135. return result;
  7136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7137. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  7138. //>>excludeEnd("ctx");
  7139. }; }),
  7140. $globals.String.a$cls);
  7141. $core.addMethod(
  7142. $core.method({
  7143. selector: "space",
  7144. protocol: "accessing",
  7145. //>>excludeStart("ide", pragmas.excludeIdeData);
  7146. args: [],
  7147. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7148. referencedClasses: [],
  7149. //>>excludeEnd("ide");
  7150. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  7151. messageSends: []
  7152. }, function ($methodClass){ return function (){
  7153. var self=this,$self=this;
  7154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7155. return $core.withContext(function($ctx1) {
  7156. //>>excludeEnd("ctx");
  7157. return " ";
  7158. return self;
  7159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7160. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  7161. //>>excludeEnd("ctx");
  7162. }; }),
  7163. $globals.String.a$cls);
  7164. $core.addMethod(
  7165. $core.method({
  7166. selector: "streamClass",
  7167. protocol: "accessing",
  7168. //>>excludeStart("ide", pragmas.excludeIdeData);
  7169. args: [],
  7170. source: "streamClass\x0a\x09\x09^ StringStream",
  7171. referencedClasses: ["StringStream"],
  7172. //>>excludeEnd("ide");
  7173. pragmas: [],
  7174. messageSends: []
  7175. }, function ($methodClass){ return function (){
  7176. var self=this,$self=this;
  7177. return $globals.StringStream;
  7178. }; }),
  7179. $globals.String.a$cls);
  7180. $core.addMethod(
  7181. $core.method({
  7182. selector: "tab",
  7183. protocol: "accessing",
  7184. //>>excludeStart("ide", pragmas.excludeIdeData);
  7185. args: [],
  7186. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7187. referencedClasses: [],
  7188. //>>excludeEnd("ide");
  7189. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  7190. messageSends: []
  7191. }, function ($methodClass){ return function (){
  7192. var self=this,$self=this;
  7193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7194. return $core.withContext(function($ctx1) {
  7195. //>>excludeEnd("ctx");
  7196. return "\t";
  7197. return self;
  7198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7199. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7200. //>>excludeEnd("ctx");
  7201. }; }),
  7202. $globals.String.a$cls);
  7203. $core.addMethod(
  7204. $core.method({
  7205. selector: "value:",
  7206. protocol: "instance creation",
  7207. //>>excludeStart("ide", pragmas.excludeIdeData);
  7208. args: ["aUTFCharCode"],
  7209. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7210. referencedClasses: [],
  7211. //>>excludeEnd("ide");
  7212. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7213. messageSends: []
  7214. }, function ($methodClass){ return function (aUTFCharCode){
  7215. var self=this,$self=this;
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. return $core.withContext(function($ctx1) {
  7218. //>>excludeEnd("ctx");
  7219. return String.fromCharCode(aUTFCharCode);;
  7220. return self;
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7223. //>>excludeEnd("ctx");
  7224. }; }),
  7225. $globals.String.a$cls);
  7226. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7227. //>>excludeStart("ide", pragmas.excludeIdeData);
  7228. $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`.";
  7229. //>>excludeEnd("ide");
  7230. $core.addMethod(
  7231. $core.method({
  7232. selector: "=",
  7233. protocol: "comparing",
  7234. //>>excludeStart("ide", pragmas.excludeIdeData);
  7235. args: ["aCollection"],
  7236. 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",
  7237. referencedClasses: [],
  7238. //>>excludeEnd("ide");
  7239. pragmas: [],
  7240. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7241. }, function ($methodClass){ return function (aCollection){
  7242. var self=this,$self=this;
  7243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7244. return $core.withContext(function($ctx1) {
  7245. //>>excludeEnd("ctx");
  7246. var $early={};
  7247. try {
  7248. if(!$core.assert([$recv([$self._class()
  7249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7250. ,$ctx1.sendIdx["class"]=1
  7251. //>>excludeEnd("ctx");
  7252. ][0]).__eq($recv(aCollection)._class())
  7253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7254. ,$ctx1.sendIdx["="]=1
  7255. //>>excludeEnd("ctx");
  7256. ][0])){
  7257. return false;
  7258. }
  7259. if(!$core.assert($recv([$self._size()
  7260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7261. ,$ctx1.sendIdx["size"]=1
  7262. //>>excludeEnd("ctx");
  7263. ][0]).__eq($recv(aCollection)._size()))){
  7264. return false;
  7265. }
  7266. $self._do_((function(each){
  7267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7268. return $core.withContext(function($ctx2) {
  7269. //>>excludeEnd("ctx");
  7270. if(!$core.assert($recv(aCollection)._includes_(each))){
  7271. throw $early=[false];
  7272. }
  7273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7275. //>>excludeEnd("ctx");
  7276. }));
  7277. return true;
  7278. }
  7279. catch(e) {if(e===$early)return e[0]; throw e}
  7280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7281. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7282. //>>excludeEnd("ctx");
  7283. }; }),
  7284. $globals.Set);
  7285. $core.addMethod(
  7286. $core.method({
  7287. selector: "add:",
  7288. protocol: "adding/removing",
  7289. //>>excludeStart("ide", pragmas.excludeIdeData);
  7290. args: ["anObject"],
  7291. 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 ]",
  7292. referencedClasses: [],
  7293. //>>excludeEnd("ide");
  7294. pragmas: [],
  7295. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7296. }, function ($methodClass){ return function (anObject){
  7297. var self=this,$self=this;
  7298. var bucket;
  7299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7300. return $core.withContext(function($ctx1) {
  7301. //>>excludeEnd("ctx");
  7302. var $1;
  7303. bucket=$self._bucketsOfElement_(anObject);
  7304. $1=$recv(bucket)._second();
  7305. if($1 == null || $1.a$nil){
  7306. var object,slowBucket;
  7307. object=[$recv(bucket)._first()
  7308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7309. ,$ctx1.sendIdx["first"]=1
  7310. //>>excludeEnd("ctx");
  7311. ][0];
  7312. slowBucket=$recv(bucket)._third();
  7313. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7315. return $core.withContext(function($ctx2) {
  7316. //>>excludeEnd("ctx");
  7317. $recv(slowBucket)._add_(object);
  7318. $self.size=$recv($self.size).__plus((1));
  7319. return $self.size;
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7322. //>>excludeEnd("ctx");
  7323. }));
  7324. return object;
  7325. } else {
  7326. var primitiveBucket;
  7327. primitiveBucket=$1;
  7328. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7329. }
  7330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7331. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7332. //>>excludeEnd("ctx");
  7333. }; }),
  7334. $globals.Set);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "add:in:",
  7338. protocol: "private",
  7339. //>>excludeStart("ide", pragmas.excludeIdeData);
  7340. args: ["anObject", "anotherObject"],
  7341. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7342. referencedClasses: [],
  7343. //>>excludeEnd("ide");
  7344. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09"]]],
  7345. messageSends: []
  7346. }, function ($methodClass){ return function (anObject,anotherObject){
  7347. var self=this,$self=this;
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. return $core.withContext(function($ctx1) {
  7350. //>>excludeEnd("ctx");
  7351. if (anObject in anotherObject.store) { return anObject; }
  7352. $self.size++;
  7353. anotherObject.store[anObject] = true;
  7354. return anObject;
  7355. ;
  7356. return self;
  7357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7358. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7359. //>>excludeEnd("ctx");
  7360. }; }),
  7361. $globals.Set);
  7362. $core.addMethod(
  7363. $core.method({
  7364. selector: "bucketsOfElement:",
  7365. protocol: "private",
  7366. //>>excludeStart("ide", pragmas.excludeIdeData);
  7367. args: ["anObject"],
  7368. 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<inlineJS: '\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) 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\x09$self.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'>",
  7369. referencedClasses: [],
  7370. //>>excludeEnd("ide");
  7371. pragmas: [["inlineJS:", ["\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) 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\x09$self.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"]]],
  7372. messageSends: []
  7373. }, function ($methodClass){ return function (anObject){
  7374. var self=this,$self=this;
  7375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7376. return $core.withContext(function($ctx1) {
  7377. //>>excludeEnd("ctx");
  7378. // include nil to well-known objects under "boolean" fastBucket
  7379. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7380. var prim = anObject.valueOf();
  7381. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7382. var bucket = null;
  7383. $self.slowBucketStores.some(function (store) {
  7384. return bucket = store._bucketOfElement_(anObject);
  7385. });
  7386. return [ anObject, null, bucket || $self.defaultBucket ];
  7387. }
  7388. return [ prim, $self.fastBuckets[typeof prim] ];
  7389. ;
  7390. return self;
  7391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7392. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7393. //>>excludeEnd("ctx");
  7394. }; }),
  7395. $globals.Set);
  7396. $core.addMethod(
  7397. $core.method({
  7398. selector: "classNameOf:",
  7399. protocol: "private",
  7400. //>>excludeStart("ide", pragmas.excludeIdeData);
  7401. args: ["anObject"],
  7402. 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<inlineJS: 'return anObject.a$cls != null && anObject.a$cls.name'>",
  7403. referencedClasses: [],
  7404. //>>excludeEnd("ide");
  7405. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7406. messageSends: []
  7407. }, function ($methodClass){ return function (anObject){
  7408. var self=this,$self=this;
  7409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7410. return $core.withContext(function($ctx1) {
  7411. //>>excludeEnd("ctx");
  7412. return anObject.a$cls != null && anObject.a$cls.name;
  7413. return self;
  7414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7415. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7416. //>>excludeEnd("ctx");
  7417. }; }),
  7418. $globals.Set);
  7419. $core.addMethod(
  7420. $core.method({
  7421. selector: "collect:",
  7422. protocol: "enumerating",
  7423. //>>excludeStart("ide", pragmas.excludeIdeData);
  7424. args: ["aBlock"],
  7425. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7426. referencedClasses: [],
  7427. //>>excludeEnd("ide");
  7428. pragmas: [],
  7429. messageSends: ["new", "class", "do:", "add:", "value:"]
  7430. }, function ($methodClass){ return function (aBlock){
  7431. var self=this,$self=this;
  7432. var collection;
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. return $core.withContext(function($ctx1) {
  7435. //>>excludeEnd("ctx");
  7436. collection=$recv($self._class())._new();
  7437. $self._do_((function(each){
  7438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7439. return $core.withContext(function($ctx2) {
  7440. //>>excludeEnd("ctx");
  7441. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7444. //>>excludeEnd("ctx");
  7445. }));
  7446. return collection;
  7447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7448. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7449. //>>excludeEnd("ctx");
  7450. }; }),
  7451. $globals.Set);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "do:",
  7455. protocol: "enumerating",
  7456. //>>excludeStart("ide", pragmas.excludeIdeData);
  7457. args: ["aBlock"],
  7458. source: "do: aBlock\x0a\x09<inlineJS: '\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\x09$self.defaultBucket._do_(aBlock);\x0a\x09'>",
  7459. referencedClasses: [],
  7460. //>>excludeEnd("ide");
  7461. pragmas: [["inlineJS:", ["\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\x09$self.defaultBucket._do_(aBlock);\x0a\x09"]]],
  7462. messageSends: []
  7463. }, function ($methodClass){ return function (aBlock){
  7464. var self=this,$self=this;
  7465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7466. return $core.withContext(function($ctx1) {
  7467. //>>excludeEnd("ctx");
  7468. var el, keys, i;
  7469. el = $self.fastBuckets;
  7470. keys = Object.keys(el);
  7471. for (i = 0; i < keys.length; ++i) {
  7472. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7473. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7474. else { store._do_(aBlock); }
  7475. }
  7476. el = $self.slowBucketStores;
  7477. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7478. $self.defaultBucket._do_(aBlock);
  7479. ;
  7480. return self;
  7481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7482. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7483. //>>excludeEnd("ctx");
  7484. }; }),
  7485. $globals.Set);
  7486. $core.addMethod(
  7487. $core.method({
  7488. selector: "includes:",
  7489. protocol: "testing",
  7490. //>>excludeStart("ide", pragmas.excludeIdeData);
  7491. args: ["anObject"],
  7492. 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 ]",
  7493. referencedClasses: [],
  7494. //>>excludeEnd("ide");
  7495. pragmas: [],
  7496. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7497. }, function ($methodClass){ return function (anObject){
  7498. var self=this,$self=this;
  7499. var bucket;
  7500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7501. return $core.withContext(function($ctx1) {
  7502. //>>excludeEnd("ctx");
  7503. var $1;
  7504. bucket=$self._bucketsOfElement_(anObject);
  7505. $1=$recv(bucket)._second();
  7506. if($1 == null || $1.a$nil){
  7507. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7509. ,$ctx1.sendIdx["first"]=1
  7510. //>>excludeEnd("ctx");
  7511. ][0]);
  7512. } else {
  7513. var primitiveBucket;
  7514. primitiveBucket=$1;
  7515. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7516. }
  7517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7518. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7519. //>>excludeEnd("ctx");
  7520. }; }),
  7521. $globals.Set);
  7522. $core.addMethod(
  7523. $core.method({
  7524. selector: "includes:in:",
  7525. protocol: "private",
  7526. //>>excludeStart("ide", pragmas.excludeIdeData);
  7527. args: ["anObject", "anotherObject"],
  7528. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7529. referencedClasses: [],
  7530. //>>excludeEnd("ide");
  7531. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7532. messageSends: []
  7533. }, function ($methodClass){ return function (anObject,anotherObject){
  7534. var self=this,$self=this;
  7535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7536. return $core.withContext(function($ctx1) {
  7537. //>>excludeEnd("ctx");
  7538. return anObject in anotherObject.store;
  7539. return self;
  7540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7541. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7542. //>>excludeEnd("ctx");
  7543. }; }),
  7544. $globals.Set);
  7545. $core.addMethod(
  7546. $core.method({
  7547. selector: "initialize",
  7548. protocol: "initialization",
  7549. //>>excludeStart("ide", pragmas.excludeIdeData);
  7550. args: [],
  7551. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7552. referencedClasses: [],
  7553. //>>excludeEnd("ide");
  7554. pragmas: [],
  7555. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7556. }, function ($methodClass){ return function (){
  7557. var self=this,$self=this;
  7558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7559. return $core.withContext(function($ctx1) {
  7560. //>>excludeEnd("ctx");
  7561. [(
  7562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7563. $ctx1.supercall = true,
  7564. //>>excludeEnd("ctx");
  7565. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7567. ,$ctx1.supercall = false
  7568. //>>excludeEnd("ctx");
  7569. ][0];
  7570. $self.defaultBucket=[];
  7571. $self._initializeSlowBucketStores();
  7572. $self._removeAll();
  7573. return self;
  7574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7575. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7576. //>>excludeEnd("ctx");
  7577. }; }),
  7578. $globals.Set);
  7579. $core.addMethod(
  7580. $core.method({
  7581. selector: "initializeSlowBucketStores",
  7582. protocol: "initialization",
  7583. //>>excludeStart("ide", pragmas.excludeIdeData);
  7584. args: [],
  7585. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7586. referencedClasses: ["ArrayBucketStore"],
  7587. //>>excludeEnd("ide");
  7588. pragmas: [],
  7589. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7590. }, function ($methodClass){ return function (){
  7591. var self=this,$self=this;
  7592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7593. return $core.withContext(function($ctx1) {
  7594. //>>excludeEnd("ctx");
  7595. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7597. return $core.withContext(function($ctx2) {
  7598. //>>excludeEnd("ctx");
  7599. return $self._classNameOf_(x);
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7602. //>>excludeEnd("ctx");
  7603. }))
  7604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7605. ,$ctx1.sendIdx["hashBlock:"]=1
  7606. //>>excludeEnd("ctx");
  7607. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7609. return $core.withContext(function($ctx2) {
  7610. //>>excludeEnd("ctx");
  7611. return $self._jsConstructorNameOf_(x);
  7612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7613. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7614. //>>excludeEnd("ctx");
  7615. }))];
  7616. return self;
  7617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7618. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7619. //>>excludeEnd("ctx");
  7620. }; }),
  7621. $globals.Set);
  7622. $core.addMethod(
  7623. $core.method({
  7624. selector: "jsConstructorNameOf:",
  7625. protocol: "private",
  7626. //>>excludeStart("ide", pragmas.excludeIdeData);
  7627. args: ["anObject"],
  7628. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7629. referencedClasses: [],
  7630. //>>excludeEnd("ide");
  7631. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7632. messageSends: []
  7633. }, function ($methodClass){ return function (anObject){
  7634. var self=this,$self=this;
  7635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7636. return $core.withContext(function($ctx1) {
  7637. //>>excludeEnd("ctx");
  7638. return anObject.constructor && anObject.constructor.name;
  7639. return self;
  7640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7641. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7642. //>>excludeEnd("ctx");
  7643. }; }),
  7644. $globals.Set);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "printOn:",
  7648. protocol: "printing",
  7649. //>>excludeStart("ide", pragmas.excludeIdeData);
  7650. args: ["aStream"],
  7651. 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: ')'",
  7652. referencedClasses: [],
  7653. //>>excludeEnd("ide");
  7654. pragmas: [],
  7655. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7656. }, function ($methodClass){ return function (aStream){
  7657. var self=this,$self=this;
  7658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7659. return $core.withContext(function($ctx1) {
  7660. //>>excludeEnd("ctx");
  7661. [(
  7662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7663. $ctx1.supercall = true,
  7664. //>>excludeEnd("ctx");
  7665. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7667. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7668. //>>excludeEnd("ctx");
  7669. ][0];
  7670. [$recv(aStream)._nextPutAll_(" (")
  7671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7672. ,$ctx1.sendIdx["nextPutAll:"]=1
  7673. //>>excludeEnd("ctx");
  7674. ][0];
  7675. $self._do_separatedBy_((function(each){
  7676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7677. return $core.withContext(function($ctx2) {
  7678. //>>excludeEnd("ctx");
  7679. return $recv(each)._printOn_(aStream);
  7680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7682. //>>excludeEnd("ctx");
  7683. }),(function(){
  7684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7685. return $core.withContext(function($ctx2) {
  7686. //>>excludeEnd("ctx");
  7687. return [$recv(aStream)._nextPutAll_(" ")
  7688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7689. ,$ctx2.sendIdx["nextPutAll:"]=2
  7690. //>>excludeEnd("ctx");
  7691. ][0];
  7692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7694. //>>excludeEnd("ctx");
  7695. }));
  7696. $recv(aStream)._nextPutAll_(")");
  7697. return self;
  7698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7700. //>>excludeEnd("ctx");
  7701. }; }),
  7702. $globals.Set);
  7703. $core.addMethod(
  7704. $core.method({
  7705. selector: "remove:ifAbsent:",
  7706. protocol: "adding/removing",
  7707. //>>excludeStart("ide", pragmas.excludeIdeData);
  7708. args: ["anObject", "aBlock"],
  7709. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ | obj | obj := bucket first. bucket third remove: obj ifAbsent: [ ^aBlock value ]. size := size - 1. obj ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7710. referencedClasses: [],
  7711. //>>excludeEnd("ide");
  7712. pragmas: [],
  7713. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7714. }, function ($methodClass){ return function (anObject,aBlock){
  7715. var self=this,$self=this;
  7716. var bucket;
  7717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7718. return $core.withContext(function($ctx1) {
  7719. //>>excludeEnd("ctx");
  7720. var $1;
  7721. var $early={};
  7722. try {
  7723. bucket=$self._bucketsOfElement_(anObject);
  7724. $1=$recv(bucket)._second();
  7725. if($1 == null || $1.a$nil){
  7726. var obj;
  7727. obj=[$recv(bucket)._first()
  7728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7729. ,$ctx1.sendIdx["first"]=1
  7730. //>>excludeEnd("ctx");
  7731. ][0];
  7732. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. return $core.withContext(function($ctx2) {
  7735. //>>excludeEnd("ctx");
  7736. throw $early=[$recv(aBlock)._value()];
  7737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7738. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7739. //>>excludeEnd("ctx");
  7740. }));
  7741. $self.size=$recv($self.size).__minus((1));
  7742. return obj;
  7743. } else {
  7744. var primitiveBucket;
  7745. primitiveBucket=$1;
  7746. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7747. }
  7748. }
  7749. catch(e) {if(e===$early)return e[0]; throw e}
  7750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7751. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7752. //>>excludeEnd("ctx");
  7753. }; }),
  7754. $globals.Set);
  7755. $core.addMethod(
  7756. $core.method({
  7757. selector: "remove:in:ifAbsent:",
  7758. protocol: "private",
  7759. //>>excludeStart("ide", pragmas.excludeIdeData);
  7760. args: ["anObject", "anotherObject", "aBlock"],
  7761. source: "remove: anObject in: anotherObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}'>",
  7762. referencedClasses: [],
  7763. //>>excludeEnd("ide");
  7764. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}"]]],
  7765. messageSends: []
  7766. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7767. var self=this,$self=this;
  7768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7769. return $core.withContext(function($ctx1) {
  7770. //>>excludeEnd("ctx");
  7771. if (anObject in anotherObject.store) {
  7772. delete anotherObject.store[anObject];
  7773. $self.size--;
  7774. return anObject;
  7775. } else {
  7776. return aBlock._value();
  7777. };
  7778. return self;
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7781. //>>excludeEnd("ctx");
  7782. }; }),
  7783. $globals.Set);
  7784. $core.addMethod(
  7785. $core.method({
  7786. selector: "removeAll",
  7787. protocol: "adding/removing",
  7788. //>>excludeStart("ide", pragmas.excludeIdeData);
  7789. args: [],
  7790. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09'>",
  7791. referencedClasses: [],
  7792. //>>excludeEnd("ide");
  7793. pragmas: [["inlineJS:", ["\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09"]]],
  7794. messageSends: []
  7795. }, function ($methodClass){ return function (){
  7796. var self=this,$self=this;
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. return $core.withContext(function($ctx1) {
  7799. //>>excludeEnd("ctx");
  7800. $self.fastBuckets = {
  7801. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7802. "number": { store: Object.create(null), fn: Number },
  7803. "string": { store: Object.create(null) }
  7804. };
  7805. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7806. $self.defaultBucket._removeAll();
  7807. $self.size = 0;
  7808. ;
  7809. return self;
  7810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7811. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7812. //>>excludeEnd("ctx");
  7813. }; }),
  7814. $globals.Set);
  7815. $core.addMethod(
  7816. $core.method({
  7817. selector: "select:",
  7818. protocol: "enumerating",
  7819. //>>excludeStart("ide", pragmas.excludeIdeData);
  7820. args: ["aBlock"],
  7821. 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",
  7822. referencedClasses: [],
  7823. //>>excludeEnd("ide");
  7824. pragmas: [],
  7825. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7826. }, function ($methodClass){ return function (aBlock){
  7827. var self=this,$self=this;
  7828. var collection;
  7829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7830. return $core.withContext(function($ctx1) {
  7831. //>>excludeEnd("ctx");
  7832. collection=$recv($self._class())._new();
  7833. $self._do_((function(each){
  7834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7835. return $core.withContext(function($ctx2) {
  7836. //>>excludeEnd("ctx");
  7837. if($core.assert($recv(aBlock)._value_(each))){
  7838. return $recv(collection)._add_(each);
  7839. }
  7840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7842. //>>excludeEnd("ctx");
  7843. }));
  7844. return collection;
  7845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7846. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7847. //>>excludeEnd("ctx");
  7848. }; }),
  7849. $globals.Set);
  7850. $core.addMethod(
  7851. $core.method({
  7852. selector: "select:thenCollect:",
  7853. protocol: "enumerating",
  7854. //>>excludeStart("ide", pragmas.excludeIdeData);
  7855. args: ["selectBlock", "collectBlock"],
  7856. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  7857. referencedClasses: [],
  7858. //>>excludeEnd("ide");
  7859. pragmas: [],
  7860. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7861. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7862. var self=this,$self=this;
  7863. var collection;
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. return $core.withContext(function($ctx1) {
  7866. //>>excludeEnd("ctx");
  7867. collection=$recv($self._class())._new();
  7868. $self._do_((function(each){
  7869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7870. return $core.withContext(function($ctx2) {
  7871. //>>excludeEnd("ctx");
  7872. if($core.assert([$recv(selectBlock)._value_(each)
  7873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7874. ,$ctx2.sendIdx["value:"]=1
  7875. //>>excludeEnd("ctx");
  7876. ][0])){
  7877. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7878. }
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7881. //>>excludeEnd("ctx");
  7882. }));
  7883. return collection;
  7884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7885. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7886. //>>excludeEnd("ctx");
  7887. }; }),
  7888. $globals.Set);
  7889. $core.addMethod(
  7890. $core.method({
  7891. selector: "size",
  7892. protocol: "accessing",
  7893. //>>excludeStart("ide", pragmas.excludeIdeData);
  7894. args: [],
  7895. source: "size\x0a\x09^ size",
  7896. referencedClasses: [],
  7897. //>>excludeEnd("ide");
  7898. pragmas: [],
  7899. messageSends: []
  7900. }, function ($methodClass){ return function (){
  7901. var self=this,$self=this;
  7902. return $self.size;
  7903. }; }),
  7904. $globals.Set);
  7905. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7906. //>>excludeStart("ide", pragmas.excludeIdeData);
  7907. $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.";
  7908. //>>excludeEnd("ide");
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "<<",
  7912. protocol: "writing",
  7913. //>>excludeStart("ide", pragmas.excludeIdeData);
  7914. args: ["anObject"],
  7915. source: "<< anObject\x0a\x09self write: anObject",
  7916. referencedClasses: [],
  7917. //>>excludeEnd("ide");
  7918. pragmas: [],
  7919. messageSends: ["write:"]
  7920. }, function ($methodClass){ return function (anObject){
  7921. var self=this,$self=this;
  7922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7923. return $core.withContext(function($ctx1) {
  7924. //>>excludeEnd("ctx");
  7925. $self._write_(anObject);
  7926. return self;
  7927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7928. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7929. //>>excludeEnd("ctx");
  7930. }; }),
  7931. $globals.ProtoStream);
  7932. $core.addMethod(
  7933. $core.method({
  7934. selector: "atEnd",
  7935. protocol: "testing",
  7936. //>>excludeStart("ide", pragmas.excludeIdeData);
  7937. args: [],
  7938. source: "atEnd\x0a\x09self subclassResponsibility",
  7939. referencedClasses: [],
  7940. //>>excludeEnd("ide");
  7941. pragmas: [],
  7942. messageSends: ["subclassResponsibility"]
  7943. }, function ($methodClass){ return function (){
  7944. var self=this,$self=this;
  7945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7946. return $core.withContext(function($ctx1) {
  7947. //>>excludeEnd("ctx");
  7948. $self._subclassResponsibility();
  7949. return self;
  7950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7951. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7952. //>>excludeEnd("ctx");
  7953. }; }),
  7954. $globals.ProtoStream);
  7955. $core.addMethod(
  7956. $core.method({
  7957. selector: "atStart",
  7958. protocol: "testing",
  7959. //>>excludeStart("ide", pragmas.excludeIdeData);
  7960. args: [],
  7961. source: "atStart\x0a\x09self subclassResponsibility",
  7962. referencedClasses: [],
  7963. //>>excludeEnd("ide");
  7964. pragmas: [],
  7965. messageSends: ["subclassResponsibility"]
  7966. }, function ($methodClass){ return function (){
  7967. var self=this,$self=this;
  7968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7969. return $core.withContext(function($ctx1) {
  7970. //>>excludeEnd("ctx");
  7971. $self._subclassResponsibility();
  7972. return self;
  7973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7974. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7975. //>>excludeEnd("ctx");
  7976. }; }),
  7977. $globals.ProtoStream);
  7978. $core.addMethod(
  7979. $core.method({
  7980. selector: "contents",
  7981. protocol: "accessing",
  7982. //>>excludeStart("ide", pragmas.excludeIdeData);
  7983. args: [],
  7984. source: "contents\x0a\x09self subclassResponsibility",
  7985. referencedClasses: [],
  7986. //>>excludeEnd("ide");
  7987. pragmas: [],
  7988. messageSends: ["subclassResponsibility"]
  7989. }, function ($methodClass){ return function (){
  7990. var self=this,$self=this;
  7991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7992. return $core.withContext(function($ctx1) {
  7993. //>>excludeEnd("ctx");
  7994. $self._subclassResponsibility();
  7995. return self;
  7996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7997. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7998. //>>excludeEnd("ctx");
  7999. }; }),
  8000. $globals.ProtoStream);
  8001. $core.addMethod(
  8002. $core.method({
  8003. selector: "do:",
  8004. protocol: "enumerating",
  8005. //>>excludeStart("ide", pragmas.excludeIdeData);
  8006. args: ["aBlock"],
  8007. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8008. referencedClasses: [],
  8009. //>>excludeEnd("ide");
  8010. pragmas: [],
  8011. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8012. }, function ($methodClass){ return function (aBlock){
  8013. var self=this,$self=this;
  8014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8015. return $core.withContext(function($ctx1) {
  8016. //>>excludeEnd("ctx");
  8017. $recv((function(){
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. return $core.withContext(function($ctx2) {
  8020. //>>excludeEnd("ctx");
  8021. return $self._atEnd();
  8022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8024. //>>excludeEnd("ctx");
  8025. }))._whileFalse_((function(){
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. return $core.withContext(function($ctx2) {
  8028. //>>excludeEnd("ctx");
  8029. return $recv(aBlock)._value_($self._next());
  8030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8032. //>>excludeEnd("ctx");
  8033. }));
  8034. return self;
  8035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8036. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  8037. //>>excludeEnd("ctx");
  8038. }; }),
  8039. $globals.ProtoStream);
  8040. $core.addMethod(
  8041. $core.method({
  8042. selector: "isEmpty",
  8043. protocol: "testing",
  8044. //>>excludeStart("ide", pragmas.excludeIdeData);
  8045. args: [],
  8046. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8047. referencedClasses: [],
  8048. //>>excludeEnd("ide");
  8049. pragmas: [],
  8050. messageSends: ["and:", "atStart", "atEnd"]
  8051. }, function ($methodClass){ return function (){
  8052. var self=this,$self=this;
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. return $core.withContext(function($ctx1) {
  8055. //>>excludeEnd("ctx");
  8056. return $recv($self._atStart())._and_((function(){
  8057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8058. return $core.withContext(function($ctx2) {
  8059. //>>excludeEnd("ctx");
  8060. return $self._atEnd();
  8061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8063. //>>excludeEnd("ctx");
  8064. }));
  8065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8066. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8067. //>>excludeEnd("ctx");
  8068. }; }),
  8069. $globals.ProtoStream);
  8070. $core.addMethod(
  8071. $core.method({
  8072. selector: "next",
  8073. protocol: "reading",
  8074. //>>excludeStart("ide", pragmas.excludeIdeData);
  8075. args: [],
  8076. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8077. referencedClasses: [],
  8078. //>>excludeEnd("ide");
  8079. pragmas: [],
  8080. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8081. }, function ($methodClass){ return function (){
  8082. var self=this,$self=this;
  8083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8084. return $core.withContext(function($ctx1) {
  8085. //>>excludeEnd("ctx");
  8086. if($core.assert($self._atEnd())){
  8087. return nil;
  8088. } else {
  8089. return $self._subclassResponsibility();
  8090. }
  8091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8092. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8093. //>>excludeEnd("ctx");
  8094. }; }),
  8095. $globals.ProtoStream);
  8096. $core.addMethod(
  8097. $core.method({
  8098. selector: "nextPut:",
  8099. protocol: "writing",
  8100. //>>excludeStart("ide", pragmas.excludeIdeData);
  8101. args: ["anObject"],
  8102. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8103. referencedClasses: [],
  8104. //>>excludeEnd("ide");
  8105. pragmas: [],
  8106. messageSends: ["subclassResponsibility"]
  8107. }, function ($methodClass){ return function (anObject){
  8108. var self=this,$self=this;
  8109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8110. return $core.withContext(function($ctx1) {
  8111. //>>excludeEnd("ctx");
  8112. $self._subclassResponsibility();
  8113. return self;
  8114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8115. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8116. //>>excludeEnd("ctx");
  8117. }; }),
  8118. $globals.ProtoStream);
  8119. $core.addMethod(
  8120. $core.method({
  8121. selector: "nextPutAll:",
  8122. protocol: "writing",
  8123. //>>excludeStart("ide", pragmas.excludeIdeData);
  8124. args: ["aCollection"],
  8125. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8126. referencedClasses: [],
  8127. //>>excludeEnd("ide");
  8128. pragmas: [],
  8129. messageSends: ["do:", "nextPut:"]
  8130. }, function ($methodClass){ return function (aCollection){
  8131. var self=this,$self=this;
  8132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8133. return $core.withContext(function($ctx1) {
  8134. //>>excludeEnd("ctx");
  8135. $recv(aCollection)._do_((function(each){
  8136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8137. return $core.withContext(function($ctx2) {
  8138. //>>excludeEnd("ctx");
  8139. return $self._nextPut_(each);
  8140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8141. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8142. //>>excludeEnd("ctx");
  8143. }));
  8144. return self;
  8145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8146. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  8147. //>>excludeEnd("ctx");
  8148. }; }),
  8149. $globals.ProtoStream);
  8150. $core.addMethod(
  8151. $core.method({
  8152. selector: "nextPutString:",
  8153. protocol: "writing",
  8154. //>>excludeStart("ide", pragmas.excludeIdeData);
  8155. args: ["aString"],
  8156. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8157. referencedClasses: [],
  8158. //>>excludeEnd("ide");
  8159. pragmas: [],
  8160. messageSends: ["nextPut:"]
  8161. }, function ($methodClass){ return function (aString){
  8162. var self=this,$self=this;
  8163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8164. return $core.withContext(function($ctx1) {
  8165. //>>excludeEnd("ctx");
  8166. $self._nextPut_(aString);
  8167. return self;
  8168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8169. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8170. //>>excludeEnd("ctx");
  8171. }; }),
  8172. $globals.ProtoStream);
  8173. $core.addMethod(
  8174. $core.method({
  8175. selector: "peek",
  8176. protocol: "reading",
  8177. //>>excludeStart("ide", pragmas.excludeIdeData);
  8178. args: [],
  8179. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8180. referencedClasses: [],
  8181. //>>excludeEnd("ide");
  8182. pragmas: [],
  8183. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8184. }, function ($methodClass){ return function (){
  8185. var self=this,$self=this;
  8186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8187. return $core.withContext(function($ctx1) {
  8188. //>>excludeEnd("ctx");
  8189. if($core.assert($self._atEnd())){
  8190. return nil;
  8191. } else {
  8192. return $self._subclassResponsibility();
  8193. }
  8194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8195. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8196. //>>excludeEnd("ctx");
  8197. }; }),
  8198. $globals.ProtoStream);
  8199. $core.addMethod(
  8200. $core.method({
  8201. selector: "reset",
  8202. protocol: "actions",
  8203. //>>excludeStart("ide", pragmas.excludeIdeData);
  8204. args: [],
  8205. source: "reset\x0a\x09self subclassResponsibility",
  8206. referencedClasses: [],
  8207. //>>excludeEnd("ide");
  8208. pragmas: [],
  8209. messageSends: ["subclassResponsibility"]
  8210. }, function ($methodClass){ return function (){
  8211. var self=this,$self=this;
  8212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8213. return $core.withContext(function($ctx1) {
  8214. //>>excludeEnd("ctx");
  8215. $self._subclassResponsibility();
  8216. return self;
  8217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8218. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8219. //>>excludeEnd("ctx");
  8220. }; }),
  8221. $globals.ProtoStream);
  8222. $core.addMethod(
  8223. $core.method({
  8224. selector: "resetContents",
  8225. protocol: "actions",
  8226. //>>excludeStart("ide", pragmas.excludeIdeData);
  8227. args: [],
  8228. source: "resetContents\x0a\x09self subclassResponsibility",
  8229. referencedClasses: [],
  8230. //>>excludeEnd("ide");
  8231. pragmas: [],
  8232. messageSends: ["subclassResponsibility"]
  8233. }, function ($methodClass){ return function (){
  8234. var self=this,$self=this;
  8235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8236. return $core.withContext(function($ctx1) {
  8237. //>>excludeEnd("ctx");
  8238. $self._subclassResponsibility();
  8239. return self;
  8240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8241. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8242. //>>excludeEnd("ctx");
  8243. }; }),
  8244. $globals.ProtoStream);
  8245. $core.addMethod(
  8246. $core.method({
  8247. selector: "setToEnd",
  8248. protocol: "positioning",
  8249. //>>excludeStart("ide", pragmas.excludeIdeData);
  8250. args: [],
  8251. source: "setToEnd\x0a\x09self subclassResponsibility",
  8252. referencedClasses: [],
  8253. //>>excludeEnd("ide");
  8254. pragmas: [],
  8255. messageSends: ["subclassResponsibility"]
  8256. }, function ($methodClass){ return function (){
  8257. var self=this,$self=this;
  8258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8259. return $core.withContext(function($ctx1) {
  8260. //>>excludeEnd("ctx");
  8261. $self._subclassResponsibility();
  8262. return self;
  8263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8264. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8265. //>>excludeEnd("ctx");
  8266. }; }),
  8267. $globals.ProtoStream);
  8268. $core.addMethod(
  8269. $core.method({
  8270. selector: "setToStart",
  8271. protocol: "positioning",
  8272. //>>excludeStart("ide", pragmas.excludeIdeData);
  8273. args: [],
  8274. source: "setToStart\x0a\x09self reset",
  8275. referencedClasses: [],
  8276. //>>excludeEnd("ide");
  8277. pragmas: [],
  8278. messageSends: ["reset"]
  8279. }, function ($methodClass){ return function (){
  8280. var self=this,$self=this;
  8281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8282. return $core.withContext(function($ctx1) {
  8283. //>>excludeEnd("ctx");
  8284. $self._reset();
  8285. return self;
  8286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8287. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8288. //>>excludeEnd("ctx");
  8289. }; }),
  8290. $globals.ProtoStream);
  8291. $core.addMethod(
  8292. $core.method({
  8293. selector: "write:",
  8294. protocol: "writing",
  8295. //>>excludeStart("ide", pragmas.excludeIdeData);
  8296. args: ["anObject"],
  8297. source: "write: anObject\x0a\x09anObject putOn: self",
  8298. referencedClasses: [],
  8299. //>>excludeEnd("ide");
  8300. pragmas: [],
  8301. messageSends: ["putOn:"]
  8302. }, function ($methodClass){ return function (anObject){
  8303. var self=this,$self=this;
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. return $core.withContext(function($ctx1) {
  8306. //>>excludeEnd("ctx");
  8307. $recv(anObject)._putOn_(self);
  8308. return self;
  8309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8310. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8311. //>>excludeEnd("ctx");
  8312. }; }),
  8313. $globals.ProtoStream);
  8314. $core.addMethod(
  8315. $core.method({
  8316. selector: "on:",
  8317. protocol: "instance creation",
  8318. //>>excludeStart("ide", pragmas.excludeIdeData);
  8319. args: ["aCollection"],
  8320. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8321. referencedClasses: [],
  8322. //>>excludeEnd("ide");
  8323. pragmas: [],
  8324. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8325. }, function ($methodClass){ return function (aCollection){
  8326. var self=this,$self=this;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. return $core.withContext(function($ctx1) {
  8329. //>>excludeEnd("ctx");
  8330. var $1;
  8331. $1=$self._new();
  8332. $recv($1)._setCollection_(aCollection);
  8333. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8334. return $recv($1)._yourself();
  8335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8336. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8337. //>>excludeEnd("ctx");
  8338. }; }),
  8339. $globals.ProtoStream.a$cls);
  8340. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8341. //>>excludeStart("ide", pragmas.excludeIdeData);
  8342. $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.";
  8343. //>>excludeEnd("ide");
  8344. $core.addMethod(
  8345. $core.method({
  8346. selector: "atEnd",
  8347. protocol: "testing",
  8348. //>>excludeStart("ide", pragmas.excludeIdeData);
  8349. args: [],
  8350. source: "atEnd\x0a\x09^ self position = self size",
  8351. referencedClasses: [],
  8352. //>>excludeEnd("ide");
  8353. pragmas: [],
  8354. messageSends: ["=", "position", "size"]
  8355. }, function ($methodClass){ return function (){
  8356. var self=this,$self=this;
  8357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8358. return $core.withContext(function($ctx1) {
  8359. //>>excludeEnd("ctx");
  8360. return $recv($self._position()).__eq($self._size());
  8361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8362. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8363. //>>excludeEnd("ctx");
  8364. }; }),
  8365. $globals.Stream);
  8366. $core.addMethod(
  8367. $core.method({
  8368. selector: "atStart",
  8369. protocol: "testing",
  8370. //>>excludeStart("ide", pragmas.excludeIdeData);
  8371. args: [],
  8372. source: "atStart\x0a\x09^ self position = 0",
  8373. referencedClasses: [],
  8374. //>>excludeEnd("ide");
  8375. pragmas: [],
  8376. messageSends: ["=", "position"]
  8377. }, function ($methodClass){ return function (){
  8378. var self=this,$self=this;
  8379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8380. return $core.withContext(function($ctx1) {
  8381. //>>excludeEnd("ctx");
  8382. return $recv($self._position()).__eq((0));
  8383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8384. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8385. //>>excludeEnd("ctx");
  8386. }; }),
  8387. $globals.Stream);
  8388. $core.addMethod(
  8389. $core.method({
  8390. selector: "close",
  8391. protocol: "actions",
  8392. //>>excludeStart("ide", pragmas.excludeIdeData);
  8393. args: [],
  8394. source: "close",
  8395. referencedClasses: [],
  8396. //>>excludeEnd("ide");
  8397. pragmas: [],
  8398. messageSends: []
  8399. }, function ($methodClass){ return function (){
  8400. var self=this,$self=this;
  8401. return self;
  8402. }; }),
  8403. $globals.Stream);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "collection",
  8407. protocol: "accessing",
  8408. //>>excludeStart("ide", pragmas.excludeIdeData);
  8409. args: [],
  8410. source: "collection\x0a\x09^ collection",
  8411. referencedClasses: [],
  8412. //>>excludeEnd("ide");
  8413. pragmas: [],
  8414. messageSends: []
  8415. }, function ($methodClass){ return function (){
  8416. var self=this,$self=this;
  8417. return $self.collection;
  8418. }; }),
  8419. $globals.Stream);
  8420. $core.addMethod(
  8421. $core.method({
  8422. selector: "contents",
  8423. protocol: "accessing",
  8424. //>>excludeStart("ide", pragmas.excludeIdeData);
  8425. args: [],
  8426. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8427. referencedClasses: [],
  8428. //>>excludeEnd("ide");
  8429. pragmas: [],
  8430. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8431. }, function ($methodClass){ return function (){
  8432. var self=this,$self=this;
  8433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8434. return $core.withContext(function($ctx1) {
  8435. //>>excludeEnd("ctx");
  8436. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8438. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8439. //>>excludeEnd("ctx");
  8440. }; }),
  8441. $globals.Stream);
  8442. $core.addMethod(
  8443. $core.method({
  8444. selector: "flush",
  8445. protocol: "actions",
  8446. //>>excludeStart("ide", pragmas.excludeIdeData);
  8447. args: [],
  8448. source: "flush",
  8449. referencedClasses: [],
  8450. //>>excludeEnd("ide");
  8451. pragmas: [],
  8452. messageSends: []
  8453. }, function ($methodClass){ return function (){
  8454. var self=this,$self=this;
  8455. return self;
  8456. }; }),
  8457. $globals.Stream);
  8458. $core.addMethod(
  8459. $core.method({
  8460. selector: "isEmpty",
  8461. protocol: "testing",
  8462. //>>excludeStart("ide", pragmas.excludeIdeData);
  8463. args: [],
  8464. source: "isEmpty\x0a\x09^ self size = 0",
  8465. referencedClasses: [],
  8466. //>>excludeEnd("ide");
  8467. pragmas: [],
  8468. messageSends: ["=", "size"]
  8469. }, function ($methodClass){ return function (){
  8470. var self=this,$self=this;
  8471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8472. return $core.withContext(function($ctx1) {
  8473. //>>excludeEnd("ctx");
  8474. return $recv($self._size()).__eq((0));
  8475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8476. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8477. //>>excludeEnd("ctx");
  8478. }; }),
  8479. $globals.Stream);
  8480. $core.addMethod(
  8481. $core.method({
  8482. selector: "next",
  8483. protocol: "reading",
  8484. //>>excludeStart("ide", pragmas.excludeIdeData);
  8485. args: [],
  8486. 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 ]",
  8487. referencedClasses: [],
  8488. //>>excludeEnd("ide");
  8489. pragmas: [],
  8490. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8491. }, function ($methodClass){ return function (){
  8492. var self=this,$self=this;
  8493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8494. return $core.withContext(function($ctx1) {
  8495. //>>excludeEnd("ctx");
  8496. if($core.assert($self._atEnd())){
  8497. return nil;
  8498. } else {
  8499. $self._position_($recv([$self._position()
  8500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8501. ,$ctx1.sendIdx["position"]=1
  8502. //>>excludeEnd("ctx");
  8503. ][0]).__plus((1)));
  8504. return $recv($self.collection)._at_($self._position());
  8505. }
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8508. //>>excludeEnd("ctx");
  8509. }; }),
  8510. $globals.Stream);
  8511. $core.addMethod(
  8512. $core.method({
  8513. selector: "next:",
  8514. protocol: "reading",
  8515. //>>excludeStart("ide", pragmas.excludeIdeData);
  8516. args: ["anInteger"],
  8517. 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",
  8518. referencedClasses: [],
  8519. //>>excludeEnd("ide");
  8520. pragmas: [],
  8521. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8522. }, function ($methodClass){ return function (anInteger){
  8523. var self=this,$self=this;
  8524. var tempCollection;
  8525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8526. return $core.withContext(function($ctx1) {
  8527. //>>excludeEnd("ctx");
  8528. tempCollection=$recv($recv($self._collection())._class())._new();
  8529. $recv(anInteger)._timesRepeat_((function(){
  8530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8531. return $core.withContext(function($ctx2) {
  8532. //>>excludeEnd("ctx");
  8533. if(!$core.assert($self._atEnd())){
  8534. return $recv(tempCollection)._add_($self._next());
  8535. }
  8536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8538. //>>excludeEnd("ctx");
  8539. }));
  8540. return tempCollection;
  8541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8542. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8543. //>>excludeEnd("ctx");
  8544. }; }),
  8545. $globals.Stream);
  8546. $core.addMethod(
  8547. $core.method({
  8548. selector: "nextPut:",
  8549. protocol: "writing",
  8550. //>>excludeStart("ide", pragmas.excludeIdeData);
  8551. args: ["anObject"],
  8552. 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)",
  8553. referencedClasses: [],
  8554. //>>excludeEnd("ide");
  8555. pragmas: [],
  8556. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8557. }, function ($methodClass){ return function (anObject){
  8558. var self=this,$self=this;
  8559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8560. return $core.withContext(function($ctx1) {
  8561. //>>excludeEnd("ctx");
  8562. $self._position_($recv([$self._position()
  8563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8564. ,$ctx1.sendIdx["position"]=1
  8565. //>>excludeEnd("ctx");
  8566. ][0]).__plus((1)));
  8567. $recv($self._collection())._at_put_([$self._position()
  8568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8569. ,$ctx1.sendIdx["position"]=2
  8570. //>>excludeEnd("ctx");
  8571. ][0],anObject);
  8572. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8573. return self;
  8574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8575. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8576. //>>excludeEnd("ctx");
  8577. }; }),
  8578. $globals.Stream);
  8579. $core.addMethod(
  8580. $core.method({
  8581. selector: "peek",
  8582. protocol: "reading",
  8583. //>>excludeStart("ide", pragmas.excludeIdeData);
  8584. args: [],
  8585. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8586. referencedClasses: [],
  8587. //>>excludeEnd("ide");
  8588. pragmas: [],
  8589. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8590. }, function ($methodClass){ return function (){
  8591. var self=this,$self=this;
  8592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8593. return $core.withContext(function($ctx1) {
  8594. //>>excludeEnd("ctx");
  8595. if(!$core.assert($self._atEnd())){
  8596. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8597. }
  8598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8599. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8600. //>>excludeEnd("ctx");
  8601. }; }),
  8602. $globals.Stream);
  8603. $core.addMethod(
  8604. $core.method({
  8605. selector: "position",
  8606. protocol: "accessing",
  8607. //>>excludeStart("ide", pragmas.excludeIdeData);
  8608. args: [],
  8609. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8610. referencedClasses: [],
  8611. //>>excludeEnd("ide");
  8612. pragmas: [],
  8613. messageSends: ["ifNil:"]
  8614. }, function ($methodClass){ return function (){
  8615. var self=this,$self=this;
  8616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8617. return $core.withContext(function($ctx1) {
  8618. //>>excludeEnd("ctx");
  8619. var $1;
  8620. $1=$self.position;
  8621. if($1 == null || $1.a$nil){
  8622. $self.position=(0);
  8623. return $self.position;
  8624. } else {
  8625. return $1;
  8626. }
  8627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8628. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8629. //>>excludeEnd("ctx");
  8630. }; }),
  8631. $globals.Stream);
  8632. $core.addMethod(
  8633. $core.method({
  8634. selector: "position:",
  8635. protocol: "accessing",
  8636. //>>excludeStart("ide", pragmas.excludeIdeData);
  8637. args: ["anInteger"],
  8638. source: "position: anInteger\x0a\x09position := anInteger",
  8639. referencedClasses: [],
  8640. //>>excludeEnd("ide");
  8641. pragmas: [],
  8642. messageSends: []
  8643. }, function ($methodClass){ return function (anInteger){
  8644. var self=this,$self=this;
  8645. $self.position=anInteger;
  8646. return self;
  8647. }; }),
  8648. $globals.Stream);
  8649. $core.addMethod(
  8650. $core.method({
  8651. selector: "reset",
  8652. protocol: "actions",
  8653. //>>excludeStart("ide", pragmas.excludeIdeData);
  8654. args: [],
  8655. source: "reset\x0a\x09self position: 0",
  8656. referencedClasses: [],
  8657. //>>excludeEnd("ide");
  8658. pragmas: [],
  8659. messageSends: ["position:"]
  8660. }, function ($methodClass){ return function (){
  8661. var self=this,$self=this;
  8662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8663. return $core.withContext(function($ctx1) {
  8664. //>>excludeEnd("ctx");
  8665. $self._position_((0));
  8666. return self;
  8667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8668. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8669. //>>excludeEnd("ctx");
  8670. }; }),
  8671. $globals.Stream);
  8672. $core.addMethod(
  8673. $core.method({
  8674. selector: "resetContents",
  8675. protocol: "actions",
  8676. //>>excludeStart("ide", pragmas.excludeIdeData);
  8677. args: [],
  8678. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8679. referencedClasses: [],
  8680. //>>excludeEnd("ide");
  8681. pragmas: [],
  8682. messageSends: ["reset", "setStreamSize:"]
  8683. }, function ($methodClass){ return function (){
  8684. var self=this,$self=this;
  8685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8686. return $core.withContext(function($ctx1) {
  8687. //>>excludeEnd("ctx");
  8688. $self._reset();
  8689. $self._setStreamSize_((0));
  8690. return self;
  8691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8692. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8693. //>>excludeEnd("ctx");
  8694. }; }),
  8695. $globals.Stream);
  8696. $core.addMethod(
  8697. $core.method({
  8698. selector: "setCollection:",
  8699. protocol: "accessing",
  8700. //>>excludeStart("ide", pragmas.excludeIdeData);
  8701. args: ["aCollection"],
  8702. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8703. referencedClasses: [],
  8704. //>>excludeEnd("ide");
  8705. pragmas: [],
  8706. messageSends: []
  8707. }, function ($methodClass){ return function (aCollection){
  8708. var self=this,$self=this;
  8709. $self.collection=aCollection;
  8710. return self;
  8711. }; }),
  8712. $globals.Stream);
  8713. $core.addMethod(
  8714. $core.method({
  8715. selector: "setStreamSize:",
  8716. protocol: "accessing",
  8717. //>>excludeStart("ide", pragmas.excludeIdeData);
  8718. args: ["anInteger"],
  8719. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8720. referencedClasses: [],
  8721. //>>excludeEnd("ide");
  8722. pragmas: [],
  8723. messageSends: []
  8724. }, function ($methodClass){ return function (anInteger){
  8725. var self=this,$self=this;
  8726. $self.streamSize=anInteger;
  8727. return self;
  8728. }; }),
  8729. $globals.Stream);
  8730. $core.addMethod(
  8731. $core.method({
  8732. selector: "setToEnd",
  8733. protocol: "positioning",
  8734. //>>excludeStart("ide", pragmas.excludeIdeData);
  8735. args: [],
  8736. source: "setToEnd\x0a\x09self position: self size",
  8737. referencedClasses: [],
  8738. //>>excludeEnd("ide");
  8739. pragmas: [],
  8740. messageSends: ["position:", "size"]
  8741. }, function ($methodClass){ return function (){
  8742. var self=this,$self=this;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. return $core.withContext(function($ctx1) {
  8745. //>>excludeEnd("ctx");
  8746. $self._position_($self._size());
  8747. return self;
  8748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8749. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8750. //>>excludeEnd("ctx");
  8751. }; }),
  8752. $globals.Stream);
  8753. $core.addMethod(
  8754. $core.method({
  8755. selector: "size",
  8756. protocol: "accessing",
  8757. //>>excludeStart("ide", pragmas.excludeIdeData);
  8758. args: [],
  8759. source: "size\x0a\x09^ self streamSize",
  8760. referencedClasses: [],
  8761. //>>excludeEnd("ide");
  8762. pragmas: [],
  8763. messageSends: ["streamSize"]
  8764. }, function ($methodClass){ return function (){
  8765. var self=this,$self=this;
  8766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8767. return $core.withContext(function($ctx1) {
  8768. //>>excludeEnd("ctx");
  8769. return $self._streamSize();
  8770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8771. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8772. //>>excludeEnd("ctx");
  8773. }; }),
  8774. $globals.Stream);
  8775. $core.addMethod(
  8776. $core.method({
  8777. selector: "skip:",
  8778. protocol: "positioning",
  8779. //>>excludeStart("ide", pragmas.excludeIdeData);
  8780. args: ["anInteger"],
  8781. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8782. referencedClasses: [],
  8783. //>>excludeEnd("ide");
  8784. pragmas: [],
  8785. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8786. }, function ($methodClass){ return function (anInteger){
  8787. var self=this,$self=this;
  8788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8789. return $core.withContext(function($ctx1) {
  8790. //>>excludeEnd("ctx");
  8791. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8792. return self;
  8793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8794. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8795. //>>excludeEnd("ctx");
  8796. }; }),
  8797. $globals.Stream);
  8798. $core.addMethod(
  8799. $core.method({
  8800. selector: "streamSize",
  8801. protocol: "accessing",
  8802. //>>excludeStart("ide", pragmas.excludeIdeData);
  8803. args: [],
  8804. source: "streamSize\x0a\x09^ streamSize",
  8805. referencedClasses: [],
  8806. //>>excludeEnd("ide");
  8807. pragmas: [],
  8808. messageSends: []
  8809. }, function ($methodClass){ return function (){
  8810. var self=this,$self=this;
  8811. return $self.streamSize;
  8812. }; }),
  8813. $globals.Stream);
  8814. $core.addMethod(
  8815. $core.method({
  8816. selector: "on:",
  8817. protocol: "instance creation",
  8818. //>>excludeStart("ide", pragmas.excludeIdeData);
  8819. args: ["aCollection"],
  8820. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8821. referencedClasses: [],
  8822. //>>excludeEnd("ide");
  8823. pragmas: [],
  8824. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8825. }, function ($methodClass){ return function (aCollection){
  8826. var self=this,$self=this;
  8827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8828. return $core.withContext(function($ctx1) {
  8829. //>>excludeEnd("ctx");
  8830. var $1;
  8831. $1=$self._new();
  8832. $recv($1)._setCollection_(aCollection);
  8833. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8834. return $recv($1)._yourself();
  8835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8836. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8837. //>>excludeEnd("ctx");
  8838. }; }),
  8839. $globals.Stream.a$cls);
  8840. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8841. //>>excludeStart("ide", pragmas.excludeIdeData);
  8842. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8843. //>>excludeEnd("ide");
  8844. $core.addMethod(
  8845. $core.method({
  8846. selector: "cr",
  8847. protocol: "writing",
  8848. //>>excludeStart("ide", pragmas.excludeIdeData);
  8849. args: [],
  8850. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8851. referencedClasses: ["String"],
  8852. //>>excludeEnd("ide");
  8853. pragmas: [],
  8854. messageSends: ["nextPutAll:", "cr"]
  8855. }, function ($methodClass){ return function (){
  8856. var self=this,$self=this;
  8857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8858. return $core.withContext(function($ctx1) {
  8859. //>>excludeEnd("ctx");
  8860. return $self._nextPutAll_($recv($globals.String)._cr());
  8861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8862. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8863. //>>excludeEnd("ctx");
  8864. }; }),
  8865. $globals.StringStream);
  8866. $core.addMethod(
  8867. $core.method({
  8868. selector: "crlf",
  8869. protocol: "writing",
  8870. //>>excludeStart("ide", pragmas.excludeIdeData);
  8871. args: [],
  8872. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8873. referencedClasses: ["String"],
  8874. //>>excludeEnd("ide");
  8875. pragmas: [],
  8876. messageSends: ["nextPutAll:", "crlf"]
  8877. }, function ($methodClass){ return function (){
  8878. var self=this,$self=this;
  8879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8880. return $core.withContext(function($ctx1) {
  8881. //>>excludeEnd("ctx");
  8882. return $self._nextPutAll_($recv($globals.String)._crlf());
  8883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8884. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8885. //>>excludeEnd("ctx");
  8886. }; }),
  8887. $globals.StringStream);
  8888. $core.addMethod(
  8889. $core.method({
  8890. selector: "lf",
  8891. protocol: "writing",
  8892. //>>excludeStart("ide", pragmas.excludeIdeData);
  8893. args: [],
  8894. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8895. referencedClasses: ["String"],
  8896. //>>excludeEnd("ide");
  8897. pragmas: [],
  8898. messageSends: ["nextPutAll:", "lf"]
  8899. }, function ($methodClass){ return function (){
  8900. var self=this,$self=this;
  8901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8902. return $core.withContext(function($ctx1) {
  8903. //>>excludeEnd("ctx");
  8904. return $self._nextPutAll_($recv($globals.String)._lf());
  8905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8906. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8907. //>>excludeEnd("ctx");
  8908. }; }),
  8909. $globals.StringStream);
  8910. $core.addMethod(
  8911. $core.method({
  8912. selector: "next:",
  8913. protocol: "reading",
  8914. //>>excludeStart("ide", pragmas.excludeIdeData);
  8915. args: ["anInteger"],
  8916. 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",
  8917. referencedClasses: [],
  8918. //>>excludeEnd("ide");
  8919. pragmas: [],
  8920. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8921. }, function ($methodClass){ return function (anInteger){
  8922. var self=this,$self=this;
  8923. var tempCollection;
  8924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8925. return $core.withContext(function($ctx1) {
  8926. //>>excludeEnd("ctx");
  8927. tempCollection=$recv($recv($self._collection())._class())._new();
  8928. $recv(anInteger)._timesRepeat_((function(){
  8929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8930. return $core.withContext(function($ctx2) {
  8931. //>>excludeEnd("ctx");
  8932. if(!$core.assert($self._atEnd())){
  8933. tempCollection=$recv(tempCollection).__comma($self._next());
  8934. return tempCollection;
  8935. }
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8938. //>>excludeEnd("ctx");
  8939. }));
  8940. return tempCollection;
  8941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8942. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8943. //>>excludeEnd("ctx");
  8944. }; }),
  8945. $globals.StringStream);
  8946. $core.addMethod(
  8947. $core.method({
  8948. selector: "nextPut:",
  8949. protocol: "writing",
  8950. //>>excludeStart("ide", pragmas.excludeIdeData);
  8951. args: ["aString"],
  8952. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8953. referencedClasses: [],
  8954. //>>excludeEnd("ide");
  8955. pragmas: [],
  8956. messageSends: ["nextPutAll:"]
  8957. }, function ($methodClass){ return function (aString){
  8958. var self=this,$self=this;
  8959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8960. return $core.withContext(function($ctx1) {
  8961. //>>excludeEnd("ctx");
  8962. $self._nextPutAll_(aString);
  8963. return self;
  8964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8965. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8966. //>>excludeEnd("ctx");
  8967. }; }),
  8968. $globals.StringStream);
  8969. $core.addMethod(
  8970. $core.method({
  8971. selector: "nextPutAll:",
  8972. protocol: "writing",
  8973. //>>excludeStart("ide", pragmas.excludeIdeData);
  8974. args: ["aString"],
  8975. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size 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)",
  8976. referencedClasses: [],
  8977. //>>excludeEnd("ide");
  8978. pragmas: [],
  8979. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8980. }, function ($methodClass){ return function (aString){
  8981. var self=this,$self=this;
  8982. var pre,post;
  8983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8984. return $core.withContext(function($ctx1) {
  8985. //>>excludeEnd("ctx");
  8986. if($core.assert($recv([$self._position()
  8987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8988. ,$ctx1.sendIdx["position"]=1
  8989. //>>excludeEnd("ctx");
  8990. ][0]).__eq([$recv([$self._collection()
  8991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8992. ,$ctx1.sendIdx["collection"]=1
  8993. //>>excludeEnd("ctx");
  8994. ][0])._size()
  8995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8996. ,$ctx1.sendIdx["size"]=1
  8997. //>>excludeEnd("ctx");
  8998. ][0]))){
  8999. [$self._setCollection_([$recv([$self._collection()
  9000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9001. ,$ctx1.sendIdx["collection"]=2
  9002. //>>excludeEnd("ctx");
  9003. ][0]).__comma(aString)
  9004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9005. ,$ctx1.sendIdx[","]=1
  9006. //>>excludeEnd("ctx");
  9007. ][0])
  9008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9009. ,$ctx1.sendIdx["setCollection:"]=1
  9010. //>>excludeEnd("ctx");
  9011. ][0];
  9012. } else {
  9013. pre=[$recv([$self._collection()
  9014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9015. ,$ctx1.sendIdx["collection"]=3
  9016. //>>excludeEnd("ctx");
  9017. ][0])._copyFrom_to_((1),[$self._position()
  9018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9019. ,$ctx1.sendIdx["position"]=2
  9020. //>>excludeEnd("ctx");
  9021. ][0])
  9022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9023. ,$ctx1.sendIdx["copyFrom:to:"]=1
  9024. //>>excludeEnd("ctx");
  9025. ][0];
  9026. post=$recv([$self._collection()
  9027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9028. ,$ctx1.sendIdx["collection"]=4
  9029. //>>excludeEnd("ctx");
  9030. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  9031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9032. ,$ctx1.sendIdx["position"]=3
  9033. //>>excludeEnd("ctx");
  9034. ][0]).__plus((1))
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. ,$ctx1.sendIdx["+"]=2
  9037. //>>excludeEnd("ctx");
  9038. ][0]).__plus([$recv(aString)._size()
  9039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9040. ,$ctx1.sendIdx["size"]=2
  9041. //>>excludeEnd("ctx");
  9042. ][0])
  9043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9044. ,$ctx1.sendIdx["+"]=1
  9045. //>>excludeEnd("ctx");
  9046. ][0],[$recv($self._collection())._size()
  9047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9048. ,$ctx1.sendIdx["size"]=3
  9049. //>>excludeEnd("ctx");
  9050. ][0]);
  9051. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  9052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9053. ,$ctx1.sendIdx[","]=2
  9054. //>>excludeEnd("ctx");
  9055. ][0]);
  9056. }
  9057. $self._position_($recv([$self._position()
  9058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9059. ,$ctx1.sendIdx["position"]=4
  9060. //>>excludeEnd("ctx");
  9061. ][0]).__plus($recv(aString)._size()));
  9062. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9063. return self;
  9064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9065. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  9066. //>>excludeEnd("ctx");
  9067. }; }),
  9068. $globals.StringStream);
  9069. $core.addMethod(
  9070. $core.method({
  9071. selector: "nextPutString:",
  9072. protocol: "writing",
  9073. //>>excludeStart("ide", pragmas.excludeIdeData);
  9074. args: ["aString"],
  9075. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9076. referencedClasses: [],
  9077. //>>excludeEnd("ide");
  9078. pragmas: [],
  9079. messageSends: ["nextPutAll:"]
  9080. }, function ($methodClass){ return function (aString){
  9081. var self=this,$self=this;
  9082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9083. return $core.withContext(function($ctx1) {
  9084. //>>excludeEnd("ctx");
  9085. $self._nextPutAll_(aString);
  9086. return self;
  9087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9088. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  9089. //>>excludeEnd("ctx");
  9090. }; }),
  9091. $globals.StringStream);
  9092. $core.addMethod(
  9093. $core.method({
  9094. selector: "print:",
  9095. protocol: "writing",
  9096. //>>excludeStart("ide", pragmas.excludeIdeData);
  9097. args: ["anObject"],
  9098. source: "print: anObject\x0a\x09anObject printOn: self",
  9099. referencedClasses: [],
  9100. //>>excludeEnd("ide");
  9101. pragmas: [],
  9102. messageSends: ["printOn:"]
  9103. }, function ($methodClass){ return function (anObject){
  9104. var self=this,$self=this;
  9105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9106. return $core.withContext(function($ctx1) {
  9107. //>>excludeEnd("ctx");
  9108. $recv(anObject)._printOn_(self);
  9109. return self;
  9110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9111. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  9112. //>>excludeEnd("ctx");
  9113. }; }),
  9114. $globals.StringStream);
  9115. $core.addMethod(
  9116. $core.method({
  9117. selector: "printSymbol:",
  9118. protocol: "writing",
  9119. //>>excludeStart("ide", pragmas.excludeIdeData);
  9120. args: ["anObject"],
  9121. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9122. referencedClasses: [],
  9123. //>>excludeEnd("ide");
  9124. pragmas: [],
  9125. messageSends: ["asSymbolPrintOn:"]
  9126. }, function ($methodClass){ return function (anObject){
  9127. var self=this,$self=this;
  9128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9129. return $core.withContext(function($ctx1) {
  9130. //>>excludeEnd("ctx");
  9131. $recv(anObject)._asSymbolPrintOn_(self);
  9132. return self;
  9133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9134. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  9135. //>>excludeEnd("ctx");
  9136. }; }),
  9137. $globals.StringStream);
  9138. $core.addMethod(
  9139. $core.method({
  9140. selector: "space",
  9141. protocol: "writing",
  9142. //>>excludeStart("ide", pragmas.excludeIdeData);
  9143. args: [],
  9144. source: "space\x0a\x09self nextPut: ' '",
  9145. referencedClasses: [],
  9146. //>>excludeEnd("ide");
  9147. pragmas: [],
  9148. messageSends: ["nextPut:"]
  9149. }, function ($methodClass){ return function (){
  9150. var self=this,$self=this;
  9151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9152. return $core.withContext(function($ctx1) {
  9153. //>>excludeEnd("ctx");
  9154. $self._nextPut_(" ");
  9155. return self;
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  9158. //>>excludeEnd("ctx");
  9159. }; }),
  9160. $globals.StringStream);
  9161. $core.addMethod(
  9162. $core.method({
  9163. selector: "tab",
  9164. protocol: "writing",
  9165. //>>excludeStart("ide", pragmas.excludeIdeData);
  9166. args: [],
  9167. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9168. referencedClasses: ["String"],
  9169. //>>excludeEnd("ide");
  9170. pragmas: [],
  9171. messageSends: ["nextPutAll:", "tab"]
  9172. }, function ($methodClass){ return function (){
  9173. var self=this,$self=this;
  9174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9175. return $core.withContext(function($ctx1) {
  9176. //>>excludeEnd("ctx");
  9177. return $self._nextPutAll_($recv($globals.String)._tab());
  9178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9179. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9180. //>>excludeEnd("ctx");
  9181. }; }),
  9182. $globals.StringStream);
  9183. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9184. //>>excludeStart("ide", pragmas.excludeIdeData);
  9185. $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.";
  9186. //>>excludeEnd("ide");
  9187. $core.addMethod(
  9188. $core.method({
  9189. selector: "initialize",
  9190. protocol: "initialization",
  9191. //>>excludeStart("ide", pragmas.excludeIdeData);
  9192. args: [],
  9193. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9194. referencedClasses: ["OrderedCollection"],
  9195. //>>excludeEnd("ide");
  9196. pragmas: [],
  9197. messageSends: ["initialize", "new"]
  9198. }, function ($methodClass){ return function (){
  9199. var self=this,$self=this;
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. return $core.withContext(function($ctx1) {
  9202. //>>excludeEnd("ctx");
  9203. [(
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. $ctx1.supercall = true,
  9206. //>>excludeEnd("ctx");
  9207. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9209. ,$ctx1.supercall = false
  9210. //>>excludeEnd("ctx");
  9211. ][0];
  9212. $self.read=[$recv($globals.OrderedCollection)._new()
  9213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9214. ,$ctx1.sendIdx["new"]=1
  9215. //>>excludeEnd("ctx");
  9216. ][0];
  9217. $self.write=$recv($globals.OrderedCollection)._new();
  9218. $self.readIndex=(1);
  9219. return self;
  9220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9221. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9222. //>>excludeEnd("ctx");
  9223. }; }),
  9224. $globals.Queue);
  9225. $core.addMethod(
  9226. $core.method({
  9227. selector: "next",
  9228. protocol: "accessing",
  9229. //>>excludeStart("ide", pragmas.excludeIdeData);
  9230. args: [],
  9231. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9232. referencedClasses: [],
  9233. //>>excludeEnd("ide");
  9234. pragmas: [],
  9235. messageSends: ["nextIfAbsent:", "error:"]
  9236. }, function ($methodClass){ return function (){
  9237. var self=this,$self=this;
  9238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9239. return $core.withContext(function($ctx1) {
  9240. //>>excludeEnd("ctx");
  9241. return $self._nextIfAbsent_((function(){
  9242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9243. return $core.withContext(function($ctx2) {
  9244. //>>excludeEnd("ctx");
  9245. return $self._error_("Cannot read from empty Queue.");
  9246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9248. //>>excludeEnd("ctx");
  9249. }));
  9250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9251. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9252. //>>excludeEnd("ctx");
  9253. }; }),
  9254. $globals.Queue);
  9255. $core.addMethod(
  9256. $core.method({
  9257. selector: "nextIfAbsent:",
  9258. protocol: "accessing",
  9259. //>>excludeStart("ide", pragmas.excludeIdeData);
  9260. args: ["aBlock"],
  9261. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write ifEmpty: [\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",
  9262. referencedClasses: ["OrderedCollection"],
  9263. //>>excludeEnd("ide");
  9264. pragmas: [],
  9265. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9266. }, function ($methodClass){ return function (aBlock){
  9267. var self=this,$self=this;
  9268. var result;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. return $core.withContext(function($ctx1) {
  9271. //>>excludeEnd("ctx");
  9272. var $early={};
  9273. try {
  9274. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9276. return $core.withContext(function($ctx2) {
  9277. //>>excludeEnd("ctx");
  9278. $recv($self.write)._ifEmpty_((function(){
  9279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9280. return $core.withContext(function($ctx3) {
  9281. //>>excludeEnd("ctx");
  9282. if($core.assert($recv($self.readIndex).__gt((1)))){
  9283. $self.read=[];
  9284. $self.readIndex=(1);
  9285. $self.readIndex;
  9286. }
  9287. throw $early=[$recv(aBlock)._value()];
  9288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9289. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9290. //>>excludeEnd("ctx");
  9291. }));
  9292. $self.read=$self.write;
  9293. $self.readIndex=(1);
  9294. $self.write=$recv($globals.OrderedCollection)._new();
  9295. return $recv($self.read)._first();
  9296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9297. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9298. //>>excludeEnd("ctx");
  9299. }));
  9300. $recv($self.read)._at_put_($self.readIndex,nil);
  9301. $self.readIndex=$recv($self.readIndex).__plus((1));
  9302. return result;
  9303. }
  9304. catch(e) {if(e===$early)return e[0]; throw e}
  9305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9306. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9307. //>>excludeEnd("ctx");
  9308. }; }),
  9309. $globals.Queue);
  9310. $core.addMethod(
  9311. $core.method({
  9312. selector: "nextPut:",
  9313. protocol: "accessing",
  9314. //>>excludeStart("ide", pragmas.excludeIdeData);
  9315. args: ["anObject"],
  9316. source: "nextPut: anObject\x0a\x09write add: anObject",
  9317. referencedClasses: [],
  9318. //>>excludeEnd("ide");
  9319. pragmas: [],
  9320. messageSends: ["add:"]
  9321. }, function ($methodClass){ return function (anObject){
  9322. var self=this,$self=this;
  9323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9324. return $core.withContext(function($ctx1) {
  9325. //>>excludeEnd("ctx");
  9326. $recv($self.write)._add_(anObject);
  9327. return self;
  9328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9329. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9330. //>>excludeEnd("ctx");
  9331. }; }),
  9332. $globals.Queue);
  9333. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9334. //>>excludeStart("ide", pragmas.excludeIdeData);
  9335. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9336. //>>excludeEnd("ide");
  9337. $core.addMethod(
  9338. $core.method({
  9339. selector: "compile:",
  9340. protocol: "evaluating",
  9341. //>>excludeStart("ide", pragmas.excludeIdeData);
  9342. args: ["aString"],
  9343. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9344. referencedClasses: [],
  9345. //>>excludeEnd("ide");
  9346. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9347. messageSends: []
  9348. }, function ($methodClass){ return function (aString){
  9349. var self=this,$self=this;
  9350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9351. return $core.withContext(function($ctx1) {
  9352. //>>excludeEnd("ctx");
  9353. return self.compile(aString);
  9354. return self;
  9355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9356. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9357. //>>excludeEnd("ctx");
  9358. }; }),
  9359. $globals.RegularExpression);
  9360. $core.addMethod(
  9361. $core.method({
  9362. selector: "exec:",
  9363. protocol: "evaluating",
  9364. //>>excludeStart("ide", pragmas.excludeIdeData);
  9365. args: ["aString"],
  9366. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9367. referencedClasses: [],
  9368. //>>excludeEnd("ide");
  9369. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9370. messageSends: []
  9371. }, function ($methodClass){ return function (aString){
  9372. var self=this,$self=this;
  9373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9374. return $core.withContext(function($ctx1) {
  9375. //>>excludeEnd("ctx");
  9376. return self.exec(aString) || nil;
  9377. return self;
  9378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9379. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9380. //>>excludeEnd("ctx");
  9381. }; }),
  9382. $globals.RegularExpression);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "test:",
  9386. protocol: "evaluating",
  9387. //>>excludeStart("ide", pragmas.excludeIdeData);
  9388. args: ["aString"],
  9389. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9390. referencedClasses: [],
  9391. //>>excludeEnd("ide");
  9392. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9393. messageSends: []
  9394. }, function ($methodClass){ return function (aString){
  9395. var self=this,$self=this;
  9396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9397. return $core.withContext(function($ctx1) {
  9398. //>>excludeEnd("ctx");
  9399. return self.test(aString);
  9400. return self;
  9401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9402. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9403. //>>excludeEnd("ctx");
  9404. }; }),
  9405. $globals.RegularExpression);
  9406. $core.addMethod(
  9407. $core.method({
  9408. selector: "fromString:",
  9409. protocol: "instance creation",
  9410. //>>excludeStart("ide", pragmas.excludeIdeData);
  9411. args: ["aString"],
  9412. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9413. referencedClasses: [],
  9414. //>>excludeEnd("ide");
  9415. pragmas: [],
  9416. messageSends: ["fromString:flag:"]
  9417. }, function ($methodClass){ return function (aString){
  9418. var self=this,$self=this;
  9419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9420. return $core.withContext(function($ctx1) {
  9421. //>>excludeEnd("ctx");
  9422. return $self._fromString_flag_(aString,"");
  9423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9424. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9425. //>>excludeEnd("ctx");
  9426. }; }),
  9427. $globals.RegularExpression.a$cls);
  9428. $core.addMethod(
  9429. $core.method({
  9430. selector: "fromString:flag:",
  9431. protocol: "instance creation",
  9432. //>>excludeStart("ide", pragmas.excludeIdeData);
  9433. args: ["aString", "anotherString"],
  9434. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9435. referencedClasses: [],
  9436. //>>excludeEnd("ide");
  9437. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9438. messageSends: []
  9439. }, function ($methodClass){ return function (aString,anotherString){
  9440. var self=this,$self=this;
  9441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9442. return $core.withContext(function($ctx1) {
  9443. //>>excludeEnd("ctx");
  9444. return new RegExp(aString, anotherString);
  9445. return self;
  9446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9447. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9448. //>>excludeEnd("ctx");
  9449. }; }),
  9450. $globals.RegularExpression.a$cls);
  9451. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9452. $core.addMethod(
  9453. $core.method({
  9454. selector: "at:",
  9455. protocol: "accessing",
  9456. //>>excludeStart("ide", pragmas.excludeIdeData);
  9457. args: ["anIndex"],
  9458. 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 ]",
  9459. referencedClasses: [],
  9460. //>>excludeEnd("ide");
  9461. pragmas: [],
  9462. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9463. }, function ($methodClass){ return function (anIndex){
  9464. var self=this,$self=this;
  9465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9466. return $core.withContext(function($ctx1) {
  9467. //>>excludeEnd("ctx");
  9468. return $self._at_ifAbsent_(anIndex,(function(){
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. return $core.withContext(function($ctx2) {
  9471. //>>excludeEnd("ctx");
  9472. return $self._errorNotFound();
  9473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9475. //>>excludeEnd("ctx");
  9476. }));
  9477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9478. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9479. //>>excludeEnd("ctx");
  9480. }; }),
  9481. $globals.TKeyValueCollection);
  9482. $core.addMethod(
  9483. $core.method({
  9484. selector: "at:ifAbsent:",
  9485. protocol: "accessing",
  9486. //>>excludeStart("ide", pragmas.excludeIdeData);
  9487. args: ["anIndex", "aBlock"],
  9488. 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",
  9489. referencedClasses: [],
  9490. //>>excludeEnd("ide");
  9491. pragmas: [],
  9492. messageSends: ["subclassResponsibility"]
  9493. }, function ($methodClass){ return function (anIndex,aBlock){
  9494. var self=this,$self=this;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. return $core.withContext(function($ctx1) {
  9497. //>>excludeEnd("ctx");
  9498. $self._subclassResponsibility();
  9499. return self;
  9500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9501. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9502. //>>excludeEnd("ctx");
  9503. }; }),
  9504. $globals.TKeyValueCollection);
  9505. $core.addMethod(
  9506. $core.method({
  9507. selector: "at:ifAbsentPut:",
  9508. protocol: "accessing",
  9509. //>>excludeStart("ide", pragmas.excludeIdeData);
  9510. args: ["aKey", "aBlock"],
  9511. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9512. referencedClasses: [],
  9513. //>>excludeEnd("ide");
  9514. pragmas: [],
  9515. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9516. }, function ($methodClass){ return function (aKey,aBlock){
  9517. var self=this,$self=this;
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. return $core.withContext(function($ctx1) {
  9520. //>>excludeEnd("ctx");
  9521. return $self._at_ifAbsent_(aKey,(function(){
  9522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9523. return $core.withContext(function($ctx2) {
  9524. //>>excludeEnd("ctx");
  9525. return $self._at_put_(aKey,$recv(aBlock)._value());
  9526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9528. //>>excludeEnd("ctx");
  9529. }));
  9530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9531. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9532. //>>excludeEnd("ctx");
  9533. }; }),
  9534. $globals.TKeyValueCollection);
  9535. $core.addMethod(
  9536. $core.method({
  9537. selector: "at:ifPresent:",
  9538. protocol: "accessing",
  9539. //>>excludeStart("ide", pragmas.excludeIdeData);
  9540. args: ["anIndex", "aBlock"],
  9541. 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 ]",
  9542. referencedClasses: [],
  9543. //>>excludeEnd("ide");
  9544. pragmas: [],
  9545. messageSends: ["at:ifPresent:ifAbsent:"]
  9546. }, function ($methodClass){ return function (anIndex,aBlock){
  9547. var self=this,$self=this;
  9548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9549. return $core.withContext(function($ctx1) {
  9550. //>>excludeEnd("ctx");
  9551. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9552. return nil;
  9553. }));
  9554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9555. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9556. //>>excludeEnd("ctx");
  9557. }; }),
  9558. $globals.TKeyValueCollection);
  9559. $core.addMethod(
  9560. $core.method({
  9561. selector: "at:ifPresent:ifAbsent:",
  9562. protocol: "accessing",
  9563. //>>excludeStart("ide", pragmas.excludeIdeData);
  9564. args: ["anIndex", "aBlock", "anotherBlock"],
  9565. 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",
  9566. referencedClasses: [],
  9567. //>>excludeEnd("ide");
  9568. pragmas: [],
  9569. messageSends: ["subclassResponsibility"]
  9570. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9571. var self=this,$self=this;
  9572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9573. return $core.withContext(function($ctx1) {
  9574. //>>excludeEnd("ctx");
  9575. $self._subclassResponsibility();
  9576. return self;
  9577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9578. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9579. //>>excludeEnd("ctx");
  9580. }; }),
  9581. $globals.TKeyValueCollection);
  9582. $core.addMethod(
  9583. $core.method({
  9584. selector: "at:put:",
  9585. protocol: "accessing",
  9586. //>>excludeStart("ide", pragmas.excludeIdeData);
  9587. args: ["anIndex", "anObject"],
  9588. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9589. referencedClasses: [],
  9590. //>>excludeEnd("ide");
  9591. pragmas: [],
  9592. messageSends: ["subclassResponsibility"]
  9593. }, function ($methodClass){ return function (anIndex,anObject){
  9594. var self=this,$self=this;
  9595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9596. return $core.withContext(function($ctx1) {
  9597. //>>excludeEnd("ctx");
  9598. $self._subclassResponsibility();
  9599. return self;
  9600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9601. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9602. //>>excludeEnd("ctx");
  9603. }; }),
  9604. $globals.TKeyValueCollection);
  9605. $core.addMethod(
  9606. $core.method({
  9607. selector: "indexOf:",
  9608. protocol: "accessing",
  9609. //>>excludeStart("ide", pragmas.excludeIdeData);
  9610. args: ["anObject"],
  9611. 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 ]",
  9612. referencedClasses: [],
  9613. //>>excludeEnd("ide");
  9614. pragmas: [],
  9615. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9616. }, function ($methodClass){ return function (anObject){
  9617. var self=this,$self=this;
  9618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9619. return $core.withContext(function($ctx1) {
  9620. //>>excludeEnd("ctx");
  9621. return $self._indexOf_ifAbsent_(anObject,(function(){
  9622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9623. return $core.withContext(function($ctx2) {
  9624. //>>excludeEnd("ctx");
  9625. return $self._errorNotFound();
  9626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9628. //>>excludeEnd("ctx");
  9629. }));
  9630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9631. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9632. //>>excludeEnd("ctx");
  9633. }; }),
  9634. $globals.TKeyValueCollection);
  9635. $core.addMethod(
  9636. $core.method({
  9637. selector: "indexOf:ifAbsent:",
  9638. protocol: "accessing",
  9639. //>>excludeStart("ide", pragmas.excludeIdeData);
  9640. args: ["anObject", "aBlock"],
  9641. 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",
  9642. referencedClasses: [],
  9643. //>>excludeEnd("ide");
  9644. pragmas: [],
  9645. messageSends: ["subclassResponsibility"]
  9646. }, function ($methodClass){ return function (anObject,aBlock){
  9647. var self=this,$self=this;
  9648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9649. return $core.withContext(function($ctx1) {
  9650. //>>excludeEnd("ctx");
  9651. $self._subclassResponsibility();
  9652. return self;
  9653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9654. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9655. //>>excludeEnd("ctx");
  9656. }; }),
  9657. $globals.TKeyValueCollection);
  9658. $core.addMethod(
  9659. $core.method({
  9660. selector: "with:do:",
  9661. protocol: "enumerating",
  9662. //>>excludeStart("ide", pragmas.excludeIdeData);
  9663. args: ["anotherCollection", "aBlock"],
  9664. 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) ]",
  9665. referencedClasses: [],
  9666. //>>excludeEnd("ide");
  9667. pragmas: [],
  9668. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9669. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9670. var self=this,$self=this;
  9671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9672. return $core.withContext(function($ctx1) {
  9673. //>>excludeEnd("ctx");
  9674. $self._withIndexDo_((function(each,index){
  9675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9676. return $core.withContext(function($ctx2) {
  9677. //>>excludeEnd("ctx");
  9678. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9680. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9681. //>>excludeEnd("ctx");
  9682. }));
  9683. return self;
  9684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9685. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9686. //>>excludeEnd("ctx");
  9687. }; }),
  9688. $globals.TKeyValueCollection);
  9689. $core.addMethod(
  9690. $core.method({
  9691. selector: "withIndexDo:",
  9692. protocol: "enumerating",
  9693. //>>excludeStart("ide", pragmas.excludeIdeData);
  9694. args: ["aBlock"],
  9695. 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",
  9696. referencedClasses: [],
  9697. //>>excludeEnd("ide");
  9698. pragmas: [],
  9699. messageSends: ["subclassResponsibility"]
  9700. }, function ($methodClass){ return function (aBlock){
  9701. var self=this,$self=this;
  9702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9703. return $core.withContext(function($ctx1) {
  9704. //>>excludeEnd("ctx");
  9705. $self._subclassResponsibility();
  9706. return self;
  9707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9708. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9709. //>>excludeEnd("ctx");
  9710. }; }),
  9711. $globals.TKeyValueCollection);
  9712. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9713. $core.addMethod(
  9714. $core.method({
  9715. selector: "at:ifAbsent:",
  9716. protocol: "accessing",
  9717. //>>excludeStart("ide", pragmas.excludeIdeData);
  9718. args: ["anIndex", "aBlock"],
  9719. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09'>",
  9720. referencedClasses: [],
  9721. //>>excludeEnd("ide");
  9722. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  9723. messageSends: []
  9724. }, function ($methodClass){ return function (anIndex,aBlock){
  9725. var self=this,$self=this;
  9726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9727. return $core.withContext(function($ctx1) {
  9728. //>>excludeEnd("ctx");
  9729. return anIndex >= 1 && anIndex <= self.length
  9730. ? self[anIndex - 1]
  9731. : aBlock._value()
  9732. ;
  9733. return self;
  9734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9735. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9736. //>>excludeEnd("ctx");
  9737. }; }),
  9738. $globals.TNativeZeroBasedCollection);
  9739. $core.addMethod(
  9740. $core.method({
  9741. selector: "at:ifPresent:ifAbsent:",
  9742. protocol: "accessing",
  9743. //>>excludeStart("ide", pragmas.excludeIdeData);
  9744. args: ["anIndex", "aBlock", "anotherBlock"],
  9745. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<inlineJS: '\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'>",
  9746. referencedClasses: [],
  9747. //>>excludeEnd("ide");
  9748. pragmas: [["inlineJS:", ["\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"]]],
  9749. messageSends: []
  9750. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9751. var self=this,$self=this;
  9752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9753. return $core.withContext(function($ctx1) {
  9754. //>>excludeEnd("ctx");
  9755. return anIndex >= 1 && anIndex <= self.length
  9756. ? aBlock._value_(self[anIndex - 1])
  9757. : anotherBlock._value()
  9758. ;
  9759. return self;
  9760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9761. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9762. //>>excludeEnd("ctx");
  9763. }; }),
  9764. $globals.TNativeZeroBasedCollection);
  9765. $core.addMethod(
  9766. $core.method({
  9767. selector: "detect:ifNone:",
  9768. protocol: "enumerating",
  9769. //>>excludeStart("ide", pragmas.excludeIdeData);
  9770. args: ["aBlock", "anotherBlock"],
  9771. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\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'>",
  9772. referencedClasses: [],
  9773. //>>excludeEnd("ide");
  9774. pragmas: [["inlineJS:", ["\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"]]],
  9775. messageSends: []
  9776. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9777. var self=this,$self=this;
  9778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9779. return $core.withContext(function($ctx1) {
  9780. //>>excludeEnd("ctx");
  9781. for(var i = 0; i < self.length; i++)
  9782. if(aBlock._value_(self[i]))
  9783. return self[i];
  9784. return anotherBlock._value();
  9785. ;
  9786. return self;
  9787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9788. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9789. //>>excludeEnd("ctx");
  9790. }; }),
  9791. $globals.TNativeZeroBasedCollection);
  9792. $core.addMethod(
  9793. $core.method({
  9794. selector: "do:",
  9795. protocol: "enumerating",
  9796. //>>excludeStart("ide", pragmas.excludeIdeData);
  9797. args: ["aBlock"],
  9798. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  9799. referencedClasses: [],
  9800. //>>excludeEnd("ide");
  9801. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9802. messageSends: []
  9803. }, function ($methodClass){ return function (aBlock){
  9804. var self=this,$self=this;
  9805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9806. return $core.withContext(function($ctx1) {
  9807. //>>excludeEnd("ctx");
  9808. for(var i=0; i < self.length; i++) {
  9809. aBlock._value_(self[i]);
  9810. }
  9811. ;
  9812. return self;
  9813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9814. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9815. //>>excludeEnd("ctx");
  9816. }; }),
  9817. $globals.TNativeZeroBasedCollection);
  9818. $core.addMethod(
  9819. $core.method({
  9820. selector: "indexOf:ifAbsent:",
  9821. protocol: "accessing",
  9822. //>>excludeStart("ide", pragmas.excludeIdeData);
  9823. args: ["anObject", "aBlock"],
  9824. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\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'>",
  9825. referencedClasses: [],
  9826. //>>excludeEnd("ide");
  9827. pragmas: [["inlineJS:", ["\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"]]],
  9828. messageSends: []
  9829. }, function ($methodClass){ return function (anObject,aBlock){
  9830. var self=this,$self=this;
  9831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9832. return $core.withContext(function($ctx1) {
  9833. //>>excludeEnd("ctx");
  9834. for(var i=0; i < self.length; i++) {
  9835. if($recv(self[i]).__eq(anObject)) {return i+1}
  9836. };
  9837. return aBlock._value();
  9838. ;
  9839. return self;
  9840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9841. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9842. //>>excludeEnd("ctx");
  9843. }; }),
  9844. $globals.TNativeZeroBasedCollection);
  9845. $core.addMethod(
  9846. $core.method({
  9847. selector: "indexOf:startingAt:ifAbsent:",
  9848. protocol: "accessing",
  9849. //>>excludeStart("ide", pragmas.excludeIdeData);
  9850. args: ["anObject", "start", "aBlock"],
  9851. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\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'>",
  9852. referencedClasses: [],
  9853. //>>excludeEnd("ide");
  9854. pragmas: [["inlineJS:", ["\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"]]],
  9855. messageSends: []
  9856. }, function ($methodClass){ return function (anObject,start,aBlock){
  9857. var self=this,$self=this;
  9858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9859. return $core.withContext(function($ctx1) {
  9860. //>>excludeEnd("ctx");
  9861. for(var i=start - 1; i < self.length; i++){
  9862. if($recv(self[i]).__eq(anObject)) {return i+1}
  9863. }
  9864. return aBlock._value();
  9865. ;
  9866. return self;
  9867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9868. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9869. //>>excludeEnd("ctx");
  9870. }; }),
  9871. $globals.TNativeZeroBasedCollection);
  9872. $core.addMethod(
  9873. $core.method({
  9874. selector: "single",
  9875. protocol: "accessing",
  9876. //>>excludeStart("ide", pragmas.excludeIdeData);
  9877. args: [],
  9878. source: "single\x0a<inlineJS: '\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];\x0a'>",
  9879. referencedClasses: [],
  9880. //>>excludeEnd("ide");
  9881. pragmas: [["inlineJS:", ["\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];"]]],
  9882. messageSends: []
  9883. }, function ($methodClass){ return function (){
  9884. var self=this,$self=this;
  9885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9886. return $core.withContext(function($ctx1) {
  9887. //>>excludeEnd("ctx");
  9888. if (self.length == 0) throw new Error("Collection is empty");
  9889. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9890. return self[0];;
  9891. return self;
  9892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9893. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9894. //>>excludeEnd("ctx");
  9895. }; }),
  9896. $globals.TNativeZeroBasedCollection);
  9897. $core.addMethod(
  9898. $core.method({
  9899. selector: "size",
  9900. protocol: "accessing",
  9901. //>>excludeStart("ide", pragmas.excludeIdeData);
  9902. args: [],
  9903. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9904. referencedClasses: [],
  9905. //>>excludeEnd("ide");
  9906. pragmas: [["inlineJS:", ["return self.length"]]],
  9907. messageSends: []
  9908. }, function ($methodClass){ return function (){
  9909. var self=this,$self=this;
  9910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9911. return $core.withContext(function($ctx1) {
  9912. //>>excludeEnd("ctx");
  9913. return self.length;
  9914. return self;
  9915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9916. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9917. //>>excludeEnd("ctx");
  9918. }; }),
  9919. $globals.TNativeZeroBasedCollection);
  9920. $core.addMethod(
  9921. $core.method({
  9922. selector: "with:do:",
  9923. protocol: "enumerating",
  9924. //>>excludeStart("ide", pragmas.excludeIdeData);
  9925. args: ["anotherCollection", "aBlock"],
  9926. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\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'>",
  9927. referencedClasses: [],
  9928. //>>excludeEnd("ide");
  9929. pragmas: [["inlineJS:", ["\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\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"]]],
  9930. messageSends: []
  9931. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9932. var self=this,$self=this;
  9933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9934. return $core.withContext(function($ctx1) {
  9935. //>>excludeEnd("ctx");
  9936. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9937. for(var i=0; i<self.length; i++) {
  9938. aBlock._value_value_(self[i], anotherCollection[i]);
  9939. }
  9940. ;
  9941. return self;
  9942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9943. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9944. //>>excludeEnd("ctx");
  9945. }; }),
  9946. $globals.TNativeZeroBasedCollection);
  9947. $core.addMethod(
  9948. $core.method({
  9949. selector: "withIndexDo:",
  9950. protocol: "enumerating",
  9951. //>>excludeStart("ide", pragmas.excludeIdeData);
  9952. args: ["aBlock"],
  9953. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\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'>",
  9954. referencedClasses: [],
  9955. //>>excludeEnd("ide");
  9956. pragmas: [["inlineJS:", ["\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"]]],
  9957. messageSends: []
  9958. }, function ($methodClass){ return function (aBlock){
  9959. var self=this,$self=this;
  9960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9961. return $core.withContext(function($ctx1) {
  9962. //>>excludeEnd("ctx");
  9963. for(var i=0; i < self.length; i++) {
  9964. aBlock._value_value_(self[i], i+1);
  9965. }
  9966. ;
  9967. return self;
  9968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9969. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9970. //>>excludeEnd("ctx");
  9971. }; }),
  9972. $globals.TNativeZeroBasedCollection);
  9973. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9974. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9975. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9976. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9977. });