Kernel-Collections.js 358 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381
  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), ' more items' ]",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. pragmas: [],
  1604. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", ",", "copyWith:", "copyEmpty", "anyOne", "-"]
  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($self._size()).__minus((1)))
  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), ' more items' ]",
  2739. referencedClasses: [],
  2740. //>>excludeEnd("ide");
  2741. pragmas: [],
  2742. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", "anyOne", "keys", ",", "at:put:", "copyEmpty", "at:", "yourself", "-"]
  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($self._size()).__minus((1)))
  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: "asJavaScriptSource",
  4451. protocol: "converting",
  4452. //>>excludeStart("ide", pragmas.excludeIdeData);
  4453. args: [],
  4454. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4455. referencedClasses: [],
  4456. //>>excludeEnd("ide");
  4457. pragmas: [],
  4458. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4459. }, function ($methodClass){ return function (){
  4460. var self=this,$self=this;
  4461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4462. return $core.withContext(function($ctx1) {
  4463. //>>excludeEnd("ctx");
  4464. return [$recv("[".__comma($recv($self._collect_((function(each){
  4465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4466. return $core.withContext(function($ctx2) {
  4467. //>>excludeEnd("ctx");
  4468. return $recv(each)._asJavaScriptSource();
  4469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4471. //>>excludeEnd("ctx");
  4472. })))._join_(", "))).__comma("]")
  4473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4474. ,$ctx1.sendIdx[","]=1
  4475. //>>excludeEnd("ctx");
  4476. ][0];
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4479. //>>excludeEnd("ctx");
  4480. }; }),
  4481. $globals.Array);
  4482. $core.addMethod(
  4483. $core.method({
  4484. selector: "at:put:",
  4485. protocol: "accessing",
  4486. //>>excludeStart("ide", pragmas.excludeIdeData);
  4487. args: ["anIndex", "anObject"],
  4488. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4489. referencedClasses: [],
  4490. //>>excludeEnd("ide");
  4491. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4492. messageSends: []
  4493. }, function ($methodClass){ return function (anIndex,anObject){
  4494. var self=this,$self=this;
  4495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4496. return $core.withContext(function($ctx1) {
  4497. //>>excludeEnd("ctx");
  4498. return self[anIndex - 1] = anObject;
  4499. return self;
  4500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4501. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4502. //>>excludeEnd("ctx");
  4503. }; }),
  4504. $globals.Array);
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "collect:",
  4508. protocol: "enumerating",
  4509. //>>excludeStart("ide", pragmas.excludeIdeData);
  4510. args: ["aBlock"],
  4511. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4512. referencedClasses: [],
  4513. //>>excludeEnd("ide");
  4514. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4515. messageSends: []
  4516. }, function ($methodClass){ return function (aBlock){
  4517. var self=this,$self=this;
  4518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4519. return $core.withContext(function($ctx1) {
  4520. //>>excludeEnd("ctx");
  4521. return self.map(function(each) {return aBlock._value_(each)});
  4522. return self;
  4523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4524. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4525. //>>excludeEnd("ctx");
  4526. }; }),
  4527. $globals.Array);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "copyFrom:to:",
  4531. protocol: "copying",
  4532. //>>excludeStart("ide", pragmas.excludeIdeData);
  4533. args: ["anIndex", "anotherIndex"],
  4534. 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'>",
  4535. referencedClasses: [],
  4536. //>>excludeEnd("ide");
  4537. 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}"]]],
  4538. messageSends: []
  4539. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4540. var self=this,$self=this;
  4541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4542. return $core.withContext(function($ctx1) {
  4543. //>>excludeEnd("ctx");
  4544. if (anIndex >= 1 && anotherIndex <= self.length) {
  4545. return self.slice(anIndex - 1, anotherIndex);
  4546. } else {
  4547. self._at_(anIndex);
  4548. self._at_(self.length + 1);
  4549. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4550. };
  4551. return self;
  4552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4553. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4554. //>>excludeEnd("ctx");
  4555. }; }),
  4556. $globals.Array);
  4557. $core.addMethod(
  4558. $core.method({
  4559. selector: "join:",
  4560. protocol: "enumerating",
  4561. //>>excludeStart("ide", pragmas.excludeIdeData);
  4562. args: ["aString"],
  4563. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4564. referencedClasses: [],
  4565. //>>excludeEnd("ide");
  4566. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4567. messageSends: []
  4568. }, function ($methodClass){ return function (aString){
  4569. var self=this,$self=this;
  4570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4571. return $core.withContext(function($ctx1) {
  4572. //>>excludeEnd("ctx");
  4573. return self.join(aString);
  4574. return self;
  4575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4576. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4577. //>>excludeEnd("ctx");
  4578. }; }),
  4579. $globals.Array);
  4580. $core.addMethod(
  4581. $core.method({
  4582. selector: "printOn:",
  4583. protocol: "printing",
  4584. //>>excludeStart("ide", pragmas.excludeIdeData);
  4585. args: ["aStream"],
  4586. 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: ')'",
  4587. referencedClasses: [],
  4588. //>>excludeEnd("ide");
  4589. pragmas: [],
  4590. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4591. }, function ($methodClass){ return function (aStream){
  4592. var self=this,$self=this;
  4593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4594. return $core.withContext(function($ctx1) {
  4595. //>>excludeEnd("ctx");
  4596. [(
  4597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4598. $ctx1.supercall = true,
  4599. //>>excludeEnd("ctx");
  4600. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4602. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4603. //>>excludeEnd("ctx");
  4604. ][0];
  4605. [$recv(aStream)._nextPutAll_(" (")
  4606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4607. ,$ctx1.sendIdx["nextPutAll:"]=1
  4608. //>>excludeEnd("ctx");
  4609. ][0];
  4610. $self._do_separatedBy_((function(each){
  4611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4612. return $core.withContext(function($ctx2) {
  4613. //>>excludeEnd("ctx");
  4614. return $recv(each)._printOn_(aStream);
  4615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4617. //>>excludeEnd("ctx");
  4618. }),(function(){
  4619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4620. return $core.withContext(function($ctx2) {
  4621. //>>excludeEnd("ctx");
  4622. return [$recv(aStream)._nextPutAll_(" ")
  4623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4624. ,$ctx2.sendIdx["nextPutAll:"]=2
  4625. //>>excludeEnd("ctx");
  4626. ][0];
  4627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4629. //>>excludeEnd("ctx");
  4630. }));
  4631. $recv(aStream)._nextPutAll_(")");
  4632. return self;
  4633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4634. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4635. //>>excludeEnd("ctx");
  4636. }; }),
  4637. $globals.Array);
  4638. $core.addMethod(
  4639. $core.method({
  4640. selector: "remove:ifAbsent:",
  4641. protocol: "adding/removing",
  4642. //>>excludeStart("ide", pragmas.excludeIdeData);
  4643. args: ["anObject", "aBlock"],
  4644. 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 ]",
  4645. referencedClasses: [],
  4646. //>>excludeEnd("ide");
  4647. pragmas: [],
  4648. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4649. }, function ($methodClass){ return function (anObject,aBlock){
  4650. var self=this,$self=this;
  4651. var index;
  4652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4653. return $core.withContext(function($ctx1) {
  4654. //>>excludeEnd("ctx");
  4655. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4656. return (0);
  4657. }));
  4658. if($core.assert($recv(index).__eq((0)))){
  4659. return $recv(aBlock)._value();
  4660. } else {
  4661. $self._removeIndex_(index);
  4662. return anObject;
  4663. }
  4664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4665. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4666. //>>excludeEnd("ctx");
  4667. }; }),
  4668. $globals.Array);
  4669. $core.addMethod(
  4670. $core.method({
  4671. selector: "removeAll",
  4672. protocol: "adding/removing",
  4673. //>>excludeStart("ide", pragmas.excludeIdeData);
  4674. args: [],
  4675. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4676. referencedClasses: [],
  4677. //>>excludeEnd("ide");
  4678. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4679. messageSends: []
  4680. }, function ($methodClass){ return function (){
  4681. var self=this,$self=this;
  4682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4683. return $core.withContext(function($ctx1) {
  4684. //>>excludeEnd("ctx");
  4685. self.length = 0;
  4686. return self;
  4687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4688. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4689. //>>excludeEnd("ctx");
  4690. }; }),
  4691. $globals.Array);
  4692. $core.addMethod(
  4693. $core.method({
  4694. selector: "removeFrom:to:",
  4695. protocol: "adding/removing",
  4696. //>>excludeStart("ide", pragmas.excludeIdeData);
  4697. args: ["aNumber", "anotherNumber"],
  4698. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4699. referencedClasses: [],
  4700. //>>excludeEnd("ide");
  4701. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4702. messageSends: []
  4703. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4704. var self=this,$self=this;
  4705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4706. return $core.withContext(function($ctx1) {
  4707. //>>excludeEnd("ctx");
  4708. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4709. return self;
  4710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4711. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4712. //>>excludeEnd("ctx");
  4713. }; }),
  4714. $globals.Array);
  4715. $core.addMethod(
  4716. $core.method({
  4717. selector: "removeIndex:",
  4718. protocol: "adding/removing",
  4719. //>>excludeStart("ide", pragmas.excludeIdeData);
  4720. args: ["anInteger"],
  4721. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4722. referencedClasses: [],
  4723. //>>excludeEnd("ide");
  4724. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4725. messageSends: []
  4726. }, function ($methodClass){ return function (anInteger){
  4727. var self=this,$self=this;
  4728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4729. return $core.withContext(function($ctx1) {
  4730. //>>excludeEnd("ctx");
  4731. self.splice(anInteger - 1, 1);
  4732. return self;
  4733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4734. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4735. //>>excludeEnd("ctx");
  4736. }; }),
  4737. $globals.Array);
  4738. $core.addMethod(
  4739. $core.method({
  4740. selector: "removeLast",
  4741. protocol: "adding/removing",
  4742. //>>excludeStart("ide", pragmas.excludeIdeData);
  4743. args: [],
  4744. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4745. referencedClasses: [],
  4746. //>>excludeEnd("ide");
  4747. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4748. messageSends: []
  4749. }, function ($methodClass){ return function (){
  4750. var self=this,$self=this;
  4751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4752. return $core.withContext(function($ctx1) {
  4753. //>>excludeEnd("ctx");
  4754. return self.pop();;
  4755. return self;
  4756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4757. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4758. //>>excludeEnd("ctx");
  4759. }; }),
  4760. $globals.Array);
  4761. $core.addMethod(
  4762. $core.method({
  4763. selector: "reversed",
  4764. protocol: "converting",
  4765. //>>excludeStart("ide", pragmas.excludeIdeData);
  4766. args: [],
  4767. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4768. referencedClasses: [],
  4769. //>>excludeEnd("ide");
  4770. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4771. messageSends: []
  4772. }, function ($methodClass){ return function (){
  4773. var self=this,$self=this;
  4774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4775. return $core.withContext(function($ctx1) {
  4776. //>>excludeEnd("ctx");
  4777. return self.slice().reverse();
  4778. return self;
  4779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4780. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4781. //>>excludeEnd("ctx");
  4782. }; }),
  4783. $globals.Array);
  4784. $core.addMethod(
  4785. $core.method({
  4786. selector: "select:",
  4787. protocol: "enumerating",
  4788. //>>excludeStart("ide", pragmas.excludeIdeData);
  4789. args: ["aBlock"],
  4790. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4791. referencedClasses: [],
  4792. //>>excludeEnd("ide");
  4793. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4794. messageSends: []
  4795. }, function ($methodClass){ return function (aBlock){
  4796. var self=this,$self=this;
  4797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4798. return $core.withContext(function($ctx1) {
  4799. //>>excludeEnd("ctx");
  4800. return self.filter(function(each) {return aBlock._value_(each)});
  4801. return self;
  4802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4803. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4804. //>>excludeEnd("ctx");
  4805. }; }),
  4806. $globals.Array);
  4807. $core.addMethod(
  4808. $core.method({
  4809. selector: "shallowCopy",
  4810. protocol: "copying",
  4811. //>>excludeStart("ide", pragmas.excludeIdeData);
  4812. args: [],
  4813. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4814. referencedClasses: [],
  4815. //>>excludeEnd("ide");
  4816. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4817. messageSends: []
  4818. }, function ($methodClass){ return function (){
  4819. var self=this,$self=this;
  4820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4821. return $core.withContext(function($ctx1) {
  4822. //>>excludeEnd("ctx");
  4823. return self.slice();
  4824. return self;
  4825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4826. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4827. //>>excludeEnd("ctx");
  4828. }; }),
  4829. $globals.Array);
  4830. $core.addMethod(
  4831. $core.method({
  4832. selector: "sort",
  4833. protocol: "enumerating",
  4834. //>>excludeStart("ide", pragmas.excludeIdeData);
  4835. args: [],
  4836. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4837. referencedClasses: [],
  4838. //>>excludeEnd("ide");
  4839. pragmas: [],
  4840. messageSends: ["sort:", "<"]
  4841. }, function ($methodClass){ return function (){
  4842. var self=this,$self=this;
  4843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4844. return $core.withContext(function($ctx1) {
  4845. //>>excludeEnd("ctx");
  4846. return $self._sort_((function(a,b){
  4847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4848. return $core.withContext(function($ctx2) {
  4849. //>>excludeEnd("ctx");
  4850. return $recv(a).__lt(b);
  4851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4852. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4853. //>>excludeEnd("ctx");
  4854. }));
  4855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4856. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  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: ["aBlock"],
  4866. 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'>",
  4867. referencedClasses: [],
  4868. //>>excludeEnd("ide");
  4869. 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"]]],
  4870. messageSends: []
  4871. }, function ($methodClass){ return function (aBlock){
  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. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4878. })
  4879. ;
  4880. return self;
  4881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4882. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4883. //>>excludeEnd("ctx");
  4884. }; }),
  4885. $globals.Array);
  4886. $core.addMethod(
  4887. $core.method({
  4888. selector: "sorted",
  4889. protocol: "enumerating",
  4890. //>>excludeStart("ide", pragmas.excludeIdeData);
  4891. args: [],
  4892. source: "sorted\x0a\x09^ self copy sort",
  4893. referencedClasses: [],
  4894. //>>excludeEnd("ide");
  4895. pragmas: [],
  4896. messageSends: ["sort", "copy"]
  4897. }, function ($methodClass){ return function (){
  4898. var self=this,$self=this;
  4899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4900. return $core.withContext(function($ctx1) {
  4901. //>>excludeEnd("ctx");
  4902. return $recv($self._copy())._sort();
  4903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4904. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4905. //>>excludeEnd("ctx");
  4906. }; }),
  4907. $globals.Array);
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: "sorted:",
  4911. protocol: "enumerating",
  4912. //>>excludeStart("ide", pragmas.excludeIdeData);
  4913. args: ["aBlock"],
  4914. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4915. referencedClasses: [],
  4916. //>>excludeEnd("ide");
  4917. pragmas: [],
  4918. messageSends: ["sort:", "copy"]
  4919. }, function ($methodClass){ return function (aBlock){
  4920. var self=this,$self=this;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. return $core.withContext(function($ctx1) {
  4923. //>>excludeEnd("ctx");
  4924. return $recv($self._copy())._sort_(aBlock);
  4925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4926. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4927. //>>excludeEnd("ctx");
  4928. }; }),
  4929. $globals.Array);
  4930. $core.addMethod(
  4931. $core.method({
  4932. selector: "new:",
  4933. protocol: "instance creation",
  4934. //>>excludeStart("ide", pragmas.excludeIdeData);
  4935. args: ["anInteger"],
  4936. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4937. referencedClasses: [],
  4938. //>>excludeEnd("ide");
  4939. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4940. messageSends: []
  4941. }, function ($methodClass){ return function (anInteger){
  4942. var self=this,$self=this;
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. return $core.withContext(function($ctx1) {
  4945. //>>excludeEnd("ctx");
  4946. return new Array(anInteger);
  4947. return self;
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4950. //>>excludeEnd("ctx");
  4951. }; }),
  4952. $globals.Array.a$cls);
  4953. $core.addMethod(
  4954. $core.method({
  4955. selector: "with:",
  4956. protocol: "instance creation",
  4957. //>>excludeStart("ide", pragmas.excludeIdeData);
  4958. args: ["anObject"],
  4959. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4960. referencedClasses: [],
  4961. //>>excludeEnd("ide");
  4962. pragmas: [],
  4963. messageSends: ["at:put:", "new:", "yourself"]
  4964. }, function ($methodClass){ return function (anObject){
  4965. var self=this,$self=this;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. return $core.withContext(function($ctx1) {
  4968. //>>excludeEnd("ctx");
  4969. var $1;
  4970. $1=$self._new_((1));
  4971. $recv($1)._at_put_((1),anObject);
  4972. return $recv($1)._yourself();
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4975. //>>excludeEnd("ctx");
  4976. }; }),
  4977. $globals.Array.a$cls);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: "with:with:",
  4981. protocol: "instance creation",
  4982. //>>excludeStart("ide", pragmas.excludeIdeData);
  4983. args: ["anObject", "anObject2"],
  4984. 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",
  4985. referencedClasses: [],
  4986. //>>excludeEnd("ide");
  4987. pragmas: [],
  4988. messageSends: ["at:put:", "new:", "yourself"]
  4989. }, function ($methodClass){ return function (anObject,anObject2){
  4990. var self=this,$self=this;
  4991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4992. return $core.withContext(function($ctx1) {
  4993. //>>excludeEnd("ctx");
  4994. var $1;
  4995. $1=$self._new_((2));
  4996. [$recv($1)._at_put_((1),anObject)
  4997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4998. ,$ctx1.sendIdx["at:put:"]=1
  4999. //>>excludeEnd("ctx");
  5000. ][0];
  5001. $recv($1)._at_put_((2),anObject2);
  5002. return $recv($1)._yourself();
  5003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5004. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  5005. //>>excludeEnd("ctx");
  5006. }; }),
  5007. $globals.Array.a$cls);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "with:with:with:",
  5011. protocol: "instance creation",
  5012. //>>excludeStart("ide", pragmas.excludeIdeData);
  5013. args: ["anObject", "anObject2", "anObject3"],
  5014. 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",
  5015. referencedClasses: [],
  5016. //>>excludeEnd("ide");
  5017. pragmas: [],
  5018. messageSends: ["at:put:", "new:", "yourself"]
  5019. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  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_((3));
  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. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5033. ,$ctx1.sendIdx["at:put:"]=2
  5034. //>>excludeEnd("ctx");
  5035. ][0];
  5036. $recv($1)._at_put_((3),anObject3);
  5037. return $recv($1)._yourself();
  5038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5039. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  5040. //>>excludeEnd("ctx");
  5041. }; }),
  5042. $globals.Array.a$cls);
  5043. $core.addMethod(
  5044. $core.method({
  5045. selector: "withAll:",
  5046. protocol: "instance creation",
  5047. //>>excludeStart("ide", pragmas.excludeIdeData);
  5048. args: ["aCollection"],
  5049. 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",
  5050. referencedClasses: [],
  5051. //>>excludeEnd("ide");
  5052. pragmas: [],
  5053. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5054. }, function ($methodClass){ return function (aCollection){
  5055. var self=this,$self=this;
  5056. var instance,index;
  5057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5058. return $core.withContext(function($ctx1) {
  5059. //>>excludeEnd("ctx");
  5060. index=(1);
  5061. instance=$self._new_($recv(aCollection)._size());
  5062. $recv(aCollection)._do_((function(each){
  5063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5064. return $core.withContext(function($ctx2) {
  5065. //>>excludeEnd("ctx");
  5066. $recv(instance)._at_put_(index,each);
  5067. index=$recv(index).__plus((1));
  5068. return index;
  5069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5070. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5071. //>>excludeEnd("ctx");
  5072. }));
  5073. return instance;
  5074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5075. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  5076. //>>excludeEnd("ctx");
  5077. }; }),
  5078. $globals.Array.a$cls);
  5079. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5080. //>>excludeStart("ide", pragmas.excludeIdeData);
  5081. $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 >> #,`";
  5082. //>>excludeEnd("ide");
  5083. $core.addMethod(
  5084. $core.method({
  5085. selector: ",",
  5086. protocol: "copying",
  5087. //>>excludeStart("ide", pragmas.excludeIdeData);
  5088. args: ["aString"],
  5089. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5090. referencedClasses: [],
  5091. //>>excludeEnd("ide");
  5092. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  5093. messageSends: []
  5094. }, function ($methodClass){ return function (aString){
  5095. var self=this,$self=this;
  5096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5097. return $core.withContext(function($ctx1) {
  5098. //>>excludeEnd("ctx");
  5099. return String(self) + aString;
  5100. return self;
  5101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5102. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  5103. //>>excludeEnd("ctx");
  5104. }; }),
  5105. $globals.String);
  5106. $core.addMethod(
  5107. $core.method({
  5108. selector: "<",
  5109. protocol: "comparing",
  5110. //>>excludeStart("ide", pragmas.excludeIdeData);
  5111. args: ["aString"],
  5112. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5113. referencedClasses: [],
  5114. //>>excludeEnd("ide");
  5115. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  5116. messageSends: []
  5117. }, function ($methodClass){ return function (aString){
  5118. var self=this,$self=this;
  5119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5120. return $core.withContext(function($ctx1) {
  5121. //>>excludeEnd("ctx");
  5122. return String(self) < aString._asString();
  5123. return self;
  5124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5125. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5126. //>>excludeEnd("ctx");
  5127. }; }),
  5128. $globals.String);
  5129. $core.addMethod(
  5130. $core.method({
  5131. selector: "<=",
  5132. protocol: "comparing",
  5133. //>>excludeStart("ide", pragmas.excludeIdeData);
  5134. args: ["aString"],
  5135. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5136. referencedClasses: [],
  5137. //>>excludeEnd("ide");
  5138. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5139. messageSends: []
  5140. }, function ($methodClass){ return function (aString){
  5141. var self=this,$self=this;
  5142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5143. return $core.withContext(function($ctx1) {
  5144. //>>excludeEnd("ctx");
  5145. return String(self) <= aString._asString();
  5146. return self;
  5147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5148. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5149. //>>excludeEnd("ctx");
  5150. }; }),
  5151. $globals.String);
  5152. $core.addMethod(
  5153. $core.method({
  5154. selector: "=",
  5155. protocol: "comparing",
  5156. //>>excludeStart("ide", pragmas.excludeIdeData);
  5157. args: ["aString"],
  5158. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5159. referencedClasses: [],
  5160. //>>excludeEnd("ide");
  5161. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5162. messageSends: []
  5163. }, function ($methodClass){ return function (aString){
  5164. var self=this,$self=this;
  5165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5166. return $core.withContext(function($ctx1) {
  5167. //>>excludeEnd("ctx");
  5168. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5169. return self;
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5172. //>>excludeEnd("ctx");
  5173. }; }),
  5174. $globals.String);
  5175. $core.addMethod(
  5176. $core.method({
  5177. selector: "==",
  5178. protocol: "comparing",
  5179. //>>excludeStart("ide", pragmas.excludeIdeData);
  5180. args: ["aString"],
  5181. 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'>",
  5182. referencedClasses: [],
  5183. //>>excludeEnd("ide");
  5184. 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;"]]],
  5185. messageSends: []
  5186. }, function ($methodClass){ return function (aString){
  5187. var self=this,$self=this;
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. return $core.withContext(function($ctx1) {
  5190. //>>excludeEnd("ctx");
  5191. if (typeof aString === "string") return String(self) === aString;
  5192. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5193. else return false;;
  5194. return self;
  5195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5196. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5197. //>>excludeEnd("ctx");
  5198. }; }),
  5199. $globals.String);
  5200. $core.addMethod(
  5201. $core.method({
  5202. selector: ">",
  5203. protocol: "comparing",
  5204. //>>excludeStart("ide", pragmas.excludeIdeData);
  5205. args: ["aString"],
  5206. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5207. referencedClasses: [],
  5208. //>>excludeEnd("ide");
  5209. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5210. messageSends: []
  5211. }, function ($methodClass){ return function (aString){
  5212. var self=this,$self=this;
  5213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5214. return $core.withContext(function($ctx1) {
  5215. //>>excludeEnd("ctx");
  5216. return String(self) > aString._asString();
  5217. return self;
  5218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5219. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5220. //>>excludeEnd("ctx");
  5221. }; }),
  5222. $globals.String);
  5223. $core.addMethod(
  5224. $core.method({
  5225. selector: ">=",
  5226. protocol: "comparing",
  5227. //>>excludeStart("ide", pragmas.excludeIdeData);
  5228. args: ["aString"],
  5229. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5230. referencedClasses: [],
  5231. //>>excludeEnd("ide");
  5232. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5233. messageSends: []
  5234. }, function ($methodClass){ return function (aString){
  5235. var self=this,$self=this;
  5236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5237. return $core.withContext(function($ctx1) {
  5238. //>>excludeEnd("ctx");
  5239. return String(self) >= aString._asString();
  5240. return self;
  5241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5242. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5243. //>>excludeEnd("ctx");
  5244. }; }),
  5245. $globals.String);
  5246. $core.addMethod(
  5247. $core.method({
  5248. selector: "add:",
  5249. protocol: "adding/removing",
  5250. //>>excludeStart("ide", pragmas.excludeIdeData);
  5251. args: ["anObject"],
  5252. source: "add: anObject\x0a\x09self errorReadOnly",
  5253. referencedClasses: [],
  5254. //>>excludeEnd("ide");
  5255. pragmas: [],
  5256. messageSends: ["errorReadOnly"]
  5257. }, function ($methodClass){ return function (anObject){
  5258. var self=this,$self=this;
  5259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5260. return $core.withContext(function($ctx1) {
  5261. //>>excludeEnd("ctx");
  5262. $self._errorReadOnly();
  5263. return self;
  5264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5265. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5266. //>>excludeEnd("ctx");
  5267. }; }),
  5268. $globals.String);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "asJavaScriptMethodName",
  5272. protocol: "converting",
  5273. //>>excludeStart("ide", pragmas.excludeIdeData);
  5274. args: [],
  5275. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5276. referencedClasses: [],
  5277. //>>excludeEnd("ide");
  5278. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5279. messageSends: []
  5280. }, function ($methodClass){ return function (){
  5281. var self=this,$self=this;
  5282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5283. return $core.withContext(function($ctx1) {
  5284. //>>excludeEnd("ctx");
  5285. return $core.st2js(self);
  5286. return self;
  5287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5288. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5289. //>>excludeEnd("ctx");
  5290. }; }),
  5291. $globals.String);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "asJavaScriptObject",
  5295. protocol: "converting",
  5296. //>>excludeStart("ide", pragmas.excludeIdeData);
  5297. args: [],
  5298. source: "asJavaScriptObject\x0a\x09^ self",
  5299. referencedClasses: [],
  5300. //>>excludeEnd("ide");
  5301. pragmas: [],
  5302. messageSends: []
  5303. }, function ($methodClass){ return function (){
  5304. var self=this,$self=this;
  5305. return self;
  5306. }; }),
  5307. $globals.String);
  5308. $core.addMethod(
  5309. $core.method({
  5310. selector: "asJavaScriptSource",
  5311. protocol: "converting",
  5312. //>>excludeStart("ide", pragmas.excludeIdeData);
  5313. args: [],
  5314. 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'>",
  5315. referencedClasses: [],
  5316. //>>excludeEnd("ide");
  5317. 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"]]],
  5318. messageSends: []
  5319. }, function ($methodClass){ return function (){
  5320. var self=this,$self=this;
  5321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5322. return $core.withContext(function($ctx1) {
  5323. //>>excludeEnd("ctx");
  5324. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5325. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5326. else
  5327. return "\"" + self + "\"";
  5328. ;
  5329. return self;
  5330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5331. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5332. //>>excludeEnd("ctx");
  5333. }; }),
  5334. $globals.String);
  5335. $core.addMethod(
  5336. $core.method({
  5337. selector: "asLowercase",
  5338. protocol: "converting",
  5339. //>>excludeStart("ide", pragmas.excludeIdeData);
  5340. args: [],
  5341. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5342. referencedClasses: [],
  5343. //>>excludeEnd("ide");
  5344. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5345. messageSends: []
  5346. }, function ($methodClass){ return function (){
  5347. var self=this,$self=this;
  5348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5349. return $core.withContext(function($ctx1) {
  5350. //>>excludeEnd("ctx");
  5351. return self.toLowerCase();
  5352. return self;
  5353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5354. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5355. //>>excludeEnd("ctx");
  5356. }; }),
  5357. $globals.String);
  5358. $core.addMethod(
  5359. $core.method({
  5360. selector: "asMutator",
  5361. protocol: "converting",
  5362. //>>excludeStart("ide", pragmas.excludeIdeData);
  5363. args: [],
  5364. 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",
  5365. referencedClasses: [],
  5366. //>>excludeEnd("ide");
  5367. pragmas: [],
  5368. messageSends: ["ifFalse:", "=", "last", ","]
  5369. }, function ($methodClass){ return function (){
  5370. var self=this,$self=this;
  5371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5372. return $core.withContext(function($ctx1) {
  5373. //>>excludeEnd("ctx");
  5374. if(!$core.assert($recv($self._last()).__eq(":"))){
  5375. return $self.__comma(":");
  5376. }
  5377. return self;
  5378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5379. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5380. //>>excludeEnd("ctx");
  5381. }; }),
  5382. $globals.String);
  5383. $core.addMethod(
  5384. $core.method({
  5385. selector: "asNumber",
  5386. protocol: "converting",
  5387. //>>excludeStart("ide", pragmas.excludeIdeData);
  5388. args: [],
  5389. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5390. referencedClasses: [],
  5391. //>>excludeEnd("ide");
  5392. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5393. messageSends: []
  5394. }, function ($methodClass){ return function (){
  5395. var self=this,$self=this;
  5396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5397. return $core.withContext(function($ctx1) {
  5398. //>>excludeEnd("ctx");
  5399. return Number(self);
  5400. return self;
  5401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5402. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5403. //>>excludeEnd("ctx");
  5404. }; }),
  5405. $globals.String);
  5406. $core.addMethod(
  5407. $core.method({
  5408. selector: "asRegexp",
  5409. protocol: "converting",
  5410. //>>excludeStart("ide", pragmas.excludeIdeData);
  5411. args: [],
  5412. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5413. referencedClasses: ["RegularExpression"],
  5414. //>>excludeEnd("ide");
  5415. pragmas: [],
  5416. messageSends: ["fromString:"]
  5417. }, function ($methodClass){ return function (){
  5418. var self=this,$self=this;
  5419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5420. return $core.withContext(function($ctx1) {
  5421. //>>excludeEnd("ctx");
  5422. return $recv($globals.RegularExpression)._fromString_(self);
  5423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5424. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5425. //>>excludeEnd("ctx");
  5426. }; }),
  5427. $globals.String);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "asString",
  5431. protocol: "converting",
  5432. //>>excludeStart("ide", pragmas.excludeIdeData);
  5433. args: [],
  5434. source: "asString\x0a\x09^ self",
  5435. referencedClasses: [],
  5436. //>>excludeEnd("ide");
  5437. pragmas: [],
  5438. messageSends: []
  5439. }, function ($methodClass){ return function (){
  5440. var self=this,$self=this;
  5441. return self;
  5442. }; }),
  5443. $globals.String);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "asSymbol",
  5447. protocol: "converting",
  5448. //>>excludeStart("ide", pragmas.excludeIdeData);
  5449. args: [],
  5450. source: "asSymbol\x0a\x09^ self",
  5451. referencedClasses: [],
  5452. //>>excludeEnd("ide");
  5453. pragmas: [],
  5454. messageSends: []
  5455. }, function ($methodClass){ return function (){
  5456. var self=this,$self=this;
  5457. return self;
  5458. }; }),
  5459. $globals.String);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "asSymbolPrintOn:",
  5463. protocol: "printing",
  5464. //>>excludeStart("ide", pragmas.excludeIdeData);
  5465. args: ["aStream"],
  5466. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5467. referencedClasses: [],
  5468. //>>excludeEnd("ide");
  5469. pragmas: [],
  5470. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5471. }, function ($methodClass){ return function (aStream){
  5472. var self=this,$self=this;
  5473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5474. return $core.withContext(function($ctx1) {
  5475. //>>excludeEnd("ctx");
  5476. $recv(aStream)._nextPutAll_("#");
  5477. if($core.assert($recv($self._asString())._isSelector())){
  5478. $recv(aStream)._nextPut_(self);
  5479. } else {
  5480. $self._printOn_(aStream);
  5481. }
  5482. return self;
  5483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5484. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5485. //>>excludeEnd("ctx");
  5486. }; }),
  5487. $globals.String);
  5488. $core.addMethod(
  5489. $core.method({
  5490. selector: "asUppercase",
  5491. protocol: "converting",
  5492. //>>excludeStart("ide", pragmas.excludeIdeData);
  5493. args: [],
  5494. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5495. referencedClasses: [],
  5496. //>>excludeEnd("ide");
  5497. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5498. messageSends: []
  5499. }, function ($methodClass){ return function (){
  5500. var self=this,$self=this;
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. return $core.withContext(function($ctx1) {
  5503. //>>excludeEnd("ctx");
  5504. return self.toUpperCase();
  5505. return self;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5508. //>>excludeEnd("ctx");
  5509. }; }),
  5510. $globals.String);
  5511. $core.addMethod(
  5512. $core.method({
  5513. selector: "asciiValue",
  5514. protocol: "accessing",
  5515. //>>excludeStart("ide", pragmas.excludeIdeData);
  5516. args: [],
  5517. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5518. referencedClasses: [],
  5519. //>>excludeEnd("ide");
  5520. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5521. messageSends: []
  5522. }, function ($methodClass){ return function (){
  5523. var self=this,$self=this;
  5524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5525. return $core.withContext(function($ctx1) {
  5526. //>>excludeEnd("ctx");
  5527. return self.charCodeAt(0);;
  5528. return self;
  5529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5530. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5531. //>>excludeEnd("ctx");
  5532. }; }),
  5533. $globals.String);
  5534. $core.addMethod(
  5535. $core.method({
  5536. selector: "at:ifAbsent:",
  5537. protocol: "accessing",
  5538. //>>excludeStart("ide", pragmas.excludeIdeData);
  5539. args: ["anIndex", "aBlock"],
  5540. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5541. referencedClasses: [],
  5542. //>>excludeEnd("ide");
  5543. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5544. messageSends: []
  5545. }, function ($methodClass){ return function (anIndex,aBlock){
  5546. var self=this,$self=this;
  5547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5548. return $core.withContext(function($ctx1) {
  5549. //>>excludeEnd("ctx");
  5550. return String(self)[anIndex - 1] || aBlock._value();
  5551. return self;
  5552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5553. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5554. //>>excludeEnd("ctx");
  5555. }; }),
  5556. $globals.String);
  5557. $core.addMethod(
  5558. $core.method({
  5559. selector: "at:ifPresent:ifAbsent:",
  5560. protocol: "accessing",
  5561. //>>excludeStart("ide", pragmas.excludeIdeData);
  5562. args: ["anIndex", "aBlock", "anotherBlock"],
  5563. 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'>",
  5564. referencedClasses: [],
  5565. //>>excludeEnd("ide");
  5566. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5567. messageSends: []
  5568. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5569. var self=this,$self=this;
  5570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5571. return $core.withContext(function($ctx1) {
  5572. //>>excludeEnd("ctx");
  5573. var result = String(self)[anIndex - 1];
  5574. return result ? aBlock._value_(result) : anotherBlock._value();
  5575. ;
  5576. return self;
  5577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5578. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5579. //>>excludeEnd("ctx");
  5580. }; }),
  5581. $globals.String);
  5582. $core.addMethod(
  5583. $core.method({
  5584. selector: "at:put:",
  5585. protocol: "accessing",
  5586. //>>excludeStart("ide", pragmas.excludeIdeData);
  5587. args: ["anIndex", "anObject"],
  5588. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5589. referencedClasses: [],
  5590. //>>excludeEnd("ide");
  5591. pragmas: [],
  5592. messageSends: ["errorReadOnly"]
  5593. }, function ($methodClass){ return function (anIndex,anObject){
  5594. var self=this,$self=this;
  5595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5596. return $core.withContext(function($ctx1) {
  5597. //>>excludeEnd("ctx");
  5598. $self._errorReadOnly();
  5599. return self;
  5600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5601. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5602. //>>excludeEnd("ctx");
  5603. }; }),
  5604. $globals.String);
  5605. $core.addMethod(
  5606. $core.method({
  5607. selector: "capitalized",
  5608. protocol: "converting",
  5609. //>>excludeStart("ide", pragmas.excludeIdeData);
  5610. args: [],
  5611. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5612. referencedClasses: [],
  5613. //>>excludeEnd("ide");
  5614. pragmas: [],
  5615. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5616. }, function ($methodClass){ return function (){
  5617. var self=this,$self=this;
  5618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5619. return $core.withContext(function($ctx1) {
  5620. //>>excludeEnd("ctx");
  5621. return $self._ifNotEmpty_((function(){
  5622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5623. return $core.withContext(function($ctx2) {
  5624. //>>excludeEnd("ctx");
  5625. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5627. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5628. //>>excludeEnd("ctx");
  5629. }));
  5630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5631. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5632. //>>excludeEnd("ctx");
  5633. }; }),
  5634. $globals.String);
  5635. $core.addMethod(
  5636. $core.method({
  5637. selector: "charCodeAt:",
  5638. protocol: "accessing",
  5639. //>>excludeStart("ide", pragmas.excludeIdeData);
  5640. args: ["anInteger"],
  5641. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5642. referencedClasses: [],
  5643. //>>excludeEnd("ide");
  5644. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5645. messageSends: []
  5646. }, function ($methodClass){ return function (anInteger){
  5647. var self=this,$self=this;
  5648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5649. return $core.withContext(function($ctx1) {
  5650. //>>excludeEnd("ctx");
  5651. return self.charCodeAt(anInteger - 1);
  5652. return self;
  5653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5654. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5655. //>>excludeEnd("ctx");
  5656. }; }),
  5657. $globals.String);
  5658. $core.addMethod(
  5659. $core.method({
  5660. selector: "copyFrom:to:",
  5661. protocol: "copying",
  5662. //>>excludeStart("ide", pragmas.excludeIdeData);
  5663. args: ["anIndex", "anotherIndex"],
  5664. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5665. referencedClasses: [],
  5666. //>>excludeEnd("ide");
  5667. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5668. messageSends: []
  5669. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5670. var self=this,$self=this;
  5671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5672. return $core.withContext(function($ctx1) {
  5673. //>>excludeEnd("ctx");
  5674. return self.substring(anIndex - 1, anotherIndex);
  5675. return self;
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5678. //>>excludeEnd("ctx");
  5679. }; }),
  5680. $globals.String);
  5681. $core.addMethod(
  5682. $core.method({
  5683. selector: "copyWithFirst:",
  5684. protocol: "copying",
  5685. //>>excludeStart("ide", pragmas.excludeIdeData);
  5686. args: ["anObject"],
  5687. 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",
  5688. referencedClasses: [],
  5689. //>>excludeEnd("ide");
  5690. pragmas: [],
  5691. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5692. }, function ($methodClass){ return function (anObject){
  5693. var self=this,$self=this;
  5694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5695. return $core.withContext(function($ctx1) {
  5696. //>>excludeEnd("ctx");
  5697. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5699. return $core.withContext(function($ctx2) {
  5700. //>>excludeEnd("ctx");
  5701. return $recv($recv(anObject)._size()).__eq((1));
  5702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5704. //>>excludeEnd("ctx");
  5705. })))){
  5706. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. ,$ctx1.sendIdx[","]=2
  5709. //>>excludeEnd("ctx");
  5710. ][0]).__comma(" in a String")
  5711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5712. ,$ctx1.sendIdx[","]=1
  5713. //>>excludeEnd("ctx");
  5714. ][0]);
  5715. }
  5716. return $recv(anObject).__comma(self);
  5717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5718. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5719. //>>excludeEnd("ctx");
  5720. }; }),
  5721. $globals.String);
  5722. $core.addMethod(
  5723. $core.method({
  5724. selector: "crlfSanitized",
  5725. protocol: "converting",
  5726. //>>excludeStart("ide", pragmas.excludeIdeData);
  5727. args: [],
  5728. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5729. referencedClasses: ["String"],
  5730. //>>excludeEnd("ide");
  5731. pragmas: [],
  5732. messageSends: ["join:", "lines", "lf"]
  5733. }, function ($methodClass){ return function (){
  5734. var self=this,$self=this;
  5735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5736. return $core.withContext(function($ctx1) {
  5737. //>>excludeEnd("ctx");
  5738. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5740. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5741. //>>excludeEnd("ctx");
  5742. }; }),
  5743. $globals.String);
  5744. $core.addMethod(
  5745. $core.method({
  5746. selector: "deepCopy",
  5747. protocol: "copying",
  5748. //>>excludeStart("ide", pragmas.excludeIdeData);
  5749. args: [],
  5750. source: "deepCopy\x0a\x09^ self shallowCopy",
  5751. referencedClasses: [],
  5752. //>>excludeEnd("ide");
  5753. pragmas: [],
  5754. messageSends: ["shallowCopy"]
  5755. }, function ($methodClass){ return function (){
  5756. var self=this,$self=this;
  5757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5758. return $core.withContext(function($ctx1) {
  5759. //>>excludeEnd("ctx");
  5760. return $self._shallowCopy();
  5761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5762. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5763. //>>excludeEnd("ctx");
  5764. }; }),
  5765. $globals.String);
  5766. $core.addMethod(
  5767. $core.method({
  5768. selector: "errorReadOnly",
  5769. protocol: "error handling",
  5770. //>>excludeStart("ide", pragmas.excludeIdeData);
  5771. args: [],
  5772. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5773. referencedClasses: [],
  5774. //>>excludeEnd("ide");
  5775. pragmas: [],
  5776. messageSends: ["error:"]
  5777. }, function ($methodClass){ return function (){
  5778. var self=this,$self=this;
  5779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5780. return $core.withContext(function($ctx1) {
  5781. //>>excludeEnd("ctx");
  5782. $self._error_("Object is read-only");
  5783. return self;
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5786. //>>excludeEnd("ctx");
  5787. }; }),
  5788. $globals.String);
  5789. $core.addMethod(
  5790. $core.method({
  5791. selector: "escaped",
  5792. protocol: "converting",
  5793. //>>excludeStart("ide", pragmas.excludeIdeData);
  5794. args: [],
  5795. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5796. referencedClasses: [],
  5797. //>>excludeEnd("ide");
  5798. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5799. messageSends: []
  5800. }, function ($methodClass){ return function (){
  5801. var self=this,$self=this;
  5802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5803. return $core.withContext(function($ctx1) {
  5804. //>>excludeEnd("ctx");
  5805. return escape(self);
  5806. return self;
  5807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5808. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5809. //>>excludeEnd("ctx");
  5810. }; }),
  5811. $globals.String);
  5812. $core.addMethod(
  5813. $core.method({
  5814. selector: "includesSubString:",
  5815. protocol: "testing",
  5816. //>>excludeStart("ide", pragmas.excludeIdeData);
  5817. args: ["subString"],
  5818. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5819. referencedClasses: [],
  5820. //>>excludeEnd("ide");
  5821. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5822. messageSends: []
  5823. }, function ($methodClass){ return function (subString){
  5824. var self=this,$self=this;
  5825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5826. return $core.withContext(function($ctx1) {
  5827. //>>excludeEnd("ctx");
  5828. return self.indexOf(subString) != -1;
  5829. return self;
  5830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5831. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5832. //>>excludeEnd("ctx");
  5833. }; }),
  5834. $globals.String);
  5835. $core.addMethod(
  5836. $core.method({
  5837. selector: "isCapitalized",
  5838. protocol: "testing",
  5839. //>>excludeStart("ide", pragmas.excludeIdeData);
  5840. args: [],
  5841. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5842. referencedClasses: [],
  5843. //>>excludeEnd("ide");
  5844. pragmas: [],
  5845. messageSends: ["==", "asUppercase", "first"]
  5846. }, function ($methodClass){ return function (){
  5847. var self=this,$self=this;
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. return $core.withContext(function($ctx1) {
  5850. //>>excludeEnd("ctx");
  5851. return $recv($recv([$self._first()
  5852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5853. ,$ctx1.sendIdx["first"]=1
  5854. //>>excludeEnd("ctx");
  5855. ][0])._asUppercase()).__eq_eq($self._first());
  5856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5857. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5858. //>>excludeEnd("ctx");
  5859. }; }),
  5860. $globals.String);
  5861. $core.addMethod(
  5862. $core.method({
  5863. selector: "isImmutable",
  5864. protocol: "testing",
  5865. //>>excludeStart("ide", pragmas.excludeIdeData);
  5866. args: [],
  5867. source: "isImmutable\x0a\x09^ true",
  5868. referencedClasses: [],
  5869. //>>excludeEnd("ide");
  5870. pragmas: [],
  5871. messageSends: []
  5872. }, function ($methodClass){ return function (){
  5873. var self=this,$self=this;
  5874. return true;
  5875. }; }),
  5876. $globals.String);
  5877. $core.addMethod(
  5878. $core.method({
  5879. selector: "isSelector",
  5880. protocol: "testing",
  5881. //>>excludeStart("ide", pragmas.excludeIdeData);
  5882. args: [],
  5883. 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>",
  5884. referencedClasses: [],
  5885. //>>excludeEnd("ide");
  5886. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5887. messageSends: []
  5888. }, function ($methodClass){ return function (){
  5889. var self=this,$self=this;
  5890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5891. return $core.withContext(function($ctx1) {
  5892. //>>excludeEnd("ctx");
  5893. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5894. return self;
  5895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5896. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5897. //>>excludeEnd("ctx");
  5898. }; }),
  5899. $globals.String);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "isString",
  5903. protocol: "testing",
  5904. //>>excludeStart("ide", pragmas.excludeIdeData);
  5905. args: [],
  5906. source: "isString\x0a\x09^ true",
  5907. referencedClasses: [],
  5908. //>>excludeEnd("ide");
  5909. pragmas: [],
  5910. messageSends: []
  5911. }, function ($methodClass){ return function (){
  5912. var self=this,$self=this;
  5913. return true;
  5914. }; }),
  5915. $globals.String);
  5916. $core.addMethod(
  5917. $core.method({
  5918. selector: "isVowel",
  5919. protocol: "testing",
  5920. //>>excludeStart("ide", pragmas.excludeIdeData);
  5921. args: [],
  5922. 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 ]",
  5923. referencedClasses: [],
  5924. //>>excludeEnd("ide");
  5925. pragmas: [],
  5926. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5927. }, function ($methodClass){ return function (){
  5928. var self=this,$self=this;
  5929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5930. return $core.withContext(function($ctx1) {
  5931. //>>excludeEnd("ctx");
  5932. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5934. return $core.withContext(function($ctx2) {
  5935. //>>excludeEnd("ctx");
  5936. return "aeiou"._includes_($self._asLowercase());
  5937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5939. //>>excludeEnd("ctx");
  5940. }));
  5941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5942. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5943. //>>excludeEnd("ctx");
  5944. }; }),
  5945. $globals.String);
  5946. $core.addMethod(
  5947. $core.method({
  5948. selector: "join:",
  5949. protocol: "split join",
  5950. //>>excludeStart("ide", pragmas.excludeIdeData);
  5951. args: ["aCollection"],
  5952. 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 ]]",
  5953. referencedClasses: ["String"],
  5954. //>>excludeEnd("ide");
  5955. pragmas: [],
  5956. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5957. }, function ($methodClass){ return function (aCollection){
  5958. var self=this,$self=this;
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. return $core.withContext(function($ctx1) {
  5961. //>>excludeEnd("ctx");
  5962. return $recv($globals.String)._streamContents_((function(stream){
  5963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5964. return $core.withContext(function($ctx2) {
  5965. //>>excludeEnd("ctx");
  5966. return $recv(aCollection)._do_separatedBy_((function(each){
  5967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5968. return $core.withContext(function($ctx3) {
  5969. //>>excludeEnd("ctx");
  5970. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5972. ,$ctx3.sendIdx["nextPutAll:"]=1
  5973. //>>excludeEnd("ctx");
  5974. ][0];
  5975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5976. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5977. //>>excludeEnd("ctx");
  5978. }),(function(){
  5979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5980. return $core.withContext(function($ctx3) {
  5981. //>>excludeEnd("ctx");
  5982. return $recv(stream)._nextPutAll_(self);
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5985. //>>excludeEnd("ctx");
  5986. }));
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5989. //>>excludeEnd("ctx");
  5990. }));
  5991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5992. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5993. //>>excludeEnd("ctx");
  5994. }; }),
  5995. $globals.String);
  5996. $core.addMethod(
  5997. $core.method({
  5998. selector: "lineIndicesDo:",
  5999. protocol: "split join",
  6000. //>>excludeStart("ide", pragmas.excludeIdeData);
  6001. args: ["aBlock"],
  6002. 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 ] ]]",
  6003. referencedClasses: ["String"],
  6004. //>>excludeEnd("ide");
  6005. pragmas: [],
  6006. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6007. }, function ($methodClass){ return function (aBlock){
  6008. var self=this,$self=this;
  6009. var cr,lf,start,sz,nextLF,nextCR;
  6010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6011. return $core.withContext(function($ctx1) {
  6012. //>>excludeEnd("ctx");
  6013. var $early={};
  6014. try {
  6015. start=(1);
  6016. sz=$self._size();
  6017. cr=$recv($globals.String)._cr();
  6018. nextCR=[$self._indexOf_startingAt_(cr,(1))
  6019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6020. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  6021. //>>excludeEnd("ctx");
  6022. ][0];
  6023. lf=$recv($globals.String)._lf();
  6024. nextLF=[$self._indexOf_startingAt_(lf,(1))
  6025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6026. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  6027. //>>excludeEnd("ctx");
  6028. ][0];
  6029. $recv((function(){
  6030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6031. return $core.withContext(function($ctx2) {
  6032. //>>excludeEnd("ctx");
  6033. return $recv(start).__lt_eq(sz);
  6034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6036. //>>excludeEnd("ctx");
  6037. }))._whileTrue_((function(){
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. return $core.withContext(function($ctx2) {
  6040. //>>excludeEnd("ctx");
  6041. if($core.assert([$recv([$recv(nextLF).__eq((0))
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. ,$ctx2.sendIdx["="]=1
  6044. //>>excludeEnd("ctx");
  6045. ][0])._and_((function(){
  6046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6047. return $core.withContext(function($ctx3) {
  6048. //>>excludeEnd("ctx");
  6049. return [$recv(nextCR).__eq((0))
  6050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6051. ,$ctx3.sendIdx["="]=2
  6052. //>>excludeEnd("ctx");
  6053. ][0];
  6054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6055. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6056. //>>excludeEnd("ctx");
  6057. }))
  6058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6059. ,$ctx2.sendIdx["and:"]=1
  6060. //>>excludeEnd("ctx");
  6061. ][0])){
  6062. [$recv(aBlock)._value_value_value_(start,sz,sz)
  6063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6064. ,$ctx2.sendIdx["value:value:value:"]=1
  6065. //>>excludeEnd("ctx");
  6066. ][0];
  6067. throw $early=[self];
  6068. }
  6069. if($core.assert($recv([$recv(nextCR).__eq((0))
  6070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6071. ,$ctx2.sendIdx["="]=3
  6072. //>>excludeEnd("ctx");
  6073. ][0])._or_((function(){
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. return $core.withContext(function($ctx3) {
  6076. //>>excludeEnd("ctx");
  6077. return $recv([(0).__lt(nextLF)
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. ,$ctx3.sendIdx["<"]=1
  6080. //>>excludeEnd("ctx");
  6081. ][0])._and_((function(){
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. return $core.withContext(function($ctx4) {
  6084. //>>excludeEnd("ctx");
  6085. return $recv(nextLF).__lt(nextCR);
  6086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6087. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6088. //>>excludeEnd("ctx");
  6089. }));
  6090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6091. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6092. //>>excludeEnd("ctx");
  6093. })))){
  6094. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  6095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6096. ,$ctx2.sendIdx["-"]=1
  6097. //>>excludeEnd("ctx");
  6098. ][0],nextLF)
  6099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6100. ,$ctx2.sendIdx["value:value:value:"]=2
  6101. //>>excludeEnd("ctx");
  6102. ][0];
  6103. start=[(1).__plus(nextLF)
  6104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6105. ,$ctx2.sendIdx["+"]=1
  6106. //>>excludeEnd("ctx");
  6107. ][0];
  6108. nextLF=[$self._indexOf_startingAt_(lf,start)
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  6111. //>>excludeEnd("ctx");
  6112. ][0];
  6113. return nextLF;
  6114. } else {
  6115. if($core.assert($recv([(1).__plus(nextCR)
  6116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6117. ,$ctx2.sendIdx["+"]=2
  6118. //>>excludeEnd("ctx");
  6119. ][0]).__eq(nextLF))){
  6120. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6122. ,$ctx2.sendIdx["-"]=2
  6123. //>>excludeEnd("ctx");
  6124. ][0],nextLF)
  6125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6126. ,$ctx2.sendIdx["value:value:value:"]=3
  6127. //>>excludeEnd("ctx");
  6128. ][0];
  6129. start=[(1).__plus(nextLF)
  6130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6131. ,$ctx2.sendIdx["+"]=3
  6132. //>>excludeEnd("ctx");
  6133. ][0];
  6134. nextCR=[$self._indexOf_startingAt_(cr,start)
  6135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6136. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6137. //>>excludeEnd("ctx");
  6138. ][0];
  6139. nextLF=[$self._indexOf_startingAt_(lf,start)
  6140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6141. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6142. //>>excludeEnd("ctx");
  6143. ][0];
  6144. return nextLF;
  6145. } else {
  6146. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6147. start=(1).__plus(nextCR);
  6148. nextCR=$self._indexOf_startingAt_(cr,start);
  6149. return nextCR;
  6150. }
  6151. }
  6152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6154. //>>excludeEnd("ctx");
  6155. }));
  6156. return self;
  6157. }
  6158. catch(e) {if(e===$early)return e[0]; throw e}
  6159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6160. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6161. //>>excludeEnd("ctx");
  6162. }; }),
  6163. $globals.String);
  6164. $core.addMethod(
  6165. $core.method({
  6166. selector: "lineNumber:",
  6167. protocol: "split join",
  6168. //>>excludeStart("ide", pragmas.excludeIdeData);
  6169. args: ["anIndex"],
  6170. 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",
  6171. referencedClasses: [],
  6172. //>>excludeEnd("ide");
  6173. pragmas: [],
  6174. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6175. }, function ($methodClass){ return function (anIndex){
  6176. var self=this,$self=this;
  6177. var lineCount;
  6178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6179. return $core.withContext(function($ctx1) {
  6180. //>>excludeEnd("ctx");
  6181. var $early={};
  6182. try {
  6183. lineCount=(0);
  6184. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. return $core.withContext(function($ctx2) {
  6187. //>>excludeEnd("ctx");
  6188. lineCount=$recv(lineCount).__plus((1));
  6189. if($core.assert($recv(lineCount).__eq(anIndex))){
  6190. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6191. }
  6192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6193. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6194. //>>excludeEnd("ctx");
  6195. }));
  6196. return nil;
  6197. }
  6198. catch(e) {if(e===$early)return e[0]; throw e}
  6199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6200. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6201. //>>excludeEnd("ctx");
  6202. }; }),
  6203. $globals.String);
  6204. $core.addMethod(
  6205. $core.method({
  6206. selector: "lines",
  6207. protocol: "split join",
  6208. //>>excludeStart("ide", pragmas.excludeIdeData);
  6209. args: [],
  6210. 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'>",
  6211. referencedClasses: [],
  6212. //>>excludeEnd("ide");
  6213. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6214. messageSends: []
  6215. }, function ($methodClass){ return function (){
  6216. var self=this,$self=this;
  6217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6218. return $core.withContext(function($ctx1) {
  6219. //>>excludeEnd("ctx");
  6220. var result = self.split(/\r\n|\r|\n/);
  6221. if (!result[result.length-1]) result.pop();
  6222. return result;;
  6223. return self;
  6224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6225. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6226. //>>excludeEnd("ctx");
  6227. }; }),
  6228. $globals.String);
  6229. $core.addMethod(
  6230. $core.method({
  6231. selector: "linesDo:",
  6232. protocol: "split join",
  6233. //>>excludeStart("ide", pragmas.excludeIdeData);
  6234. args: ["aBlock"],
  6235. 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",
  6236. referencedClasses: [],
  6237. //>>excludeEnd("ide");
  6238. pragmas: [],
  6239. messageSends: ["do:", "lines"]
  6240. }, function ($methodClass){ return function (aBlock){
  6241. var self=this,$self=this;
  6242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6243. return $core.withContext(function($ctx1) {
  6244. //>>excludeEnd("ctx");
  6245. $recv($self._lines())._do_(aBlock);
  6246. return self;
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6249. //>>excludeEnd("ctx");
  6250. }; }),
  6251. $globals.String);
  6252. $core.addMethod(
  6253. $core.method({
  6254. selector: "match:",
  6255. protocol: "regular expressions",
  6256. //>>excludeStart("ide", pragmas.excludeIdeData);
  6257. args: ["aRegexp"],
  6258. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6259. referencedClasses: [],
  6260. //>>excludeEnd("ide");
  6261. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6262. messageSends: []
  6263. }, function ($methodClass){ return function (aRegexp){
  6264. var self=this,$self=this;
  6265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6266. return $core.withContext(function($ctx1) {
  6267. //>>excludeEnd("ctx");
  6268. return self.search(aRegexp) != -1;
  6269. return self;
  6270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6271. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6272. //>>excludeEnd("ctx");
  6273. }; }),
  6274. $globals.String);
  6275. $core.addMethod(
  6276. $core.method({
  6277. selector: "matchesOf:",
  6278. protocol: "regular expressions",
  6279. //>>excludeStart("ide", pragmas.excludeIdeData);
  6280. args: ["aRegularExpression"],
  6281. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6282. referencedClasses: [],
  6283. //>>excludeEnd("ide");
  6284. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6285. messageSends: []
  6286. }, function ($methodClass){ return function (aRegularExpression){
  6287. var self=this,$self=this;
  6288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6289. return $core.withContext(function($ctx1) {
  6290. //>>excludeEnd("ctx");
  6291. return self.match(aRegularExpression);
  6292. return self;
  6293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6294. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6295. //>>excludeEnd("ctx");
  6296. }; }),
  6297. $globals.String);
  6298. $core.addMethod(
  6299. $core.method({
  6300. selector: "printNl",
  6301. protocol: "printing",
  6302. //>>excludeStart("ide", pragmas.excludeIdeData);
  6303. args: [],
  6304. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6305. referencedClasses: [],
  6306. //>>excludeEnd("ide");
  6307. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6308. messageSends: []
  6309. }, function ($methodClass){ return function (){
  6310. var self=this,$self=this;
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. return $core.withContext(function($ctx1) {
  6313. //>>excludeEnd("ctx");
  6314. console.log(self);
  6315. return self;
  6316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6317. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6318. //>>excludeEnd("ctx");
  6319. }; }),
  6320. $globals.String);
  6321. $core.addMethod(
  6322. $core.method({
  6323. selector: "printOn:",
  6324. protocol: "printing",
  6325. //>>excludeStart("ide", pragmas.excludeIdeData);
  6326. args: ["aStream"],
  6327. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6328. referencedClasses: [],
  6329. //>>excludeEnd("ide");
  6330. pragmas: [],
  6331. messageSends: ["nextPutAll:", "replace:with:"]
  6332. }, function ($methodClass){ return function (aStream){
  6333. var self=this,$self=this;
  6334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6335. return $core.withContext(function($ctx1) {
  6336. //>>excludeEnd("ctx");
  6337. [$recv(aStream)._nextPutAll_("'")
  6338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6339. ,$ctx1.sendIdx["nextPutAll:"]=1
  6340. //>>excludeEnd("ctx");
  6341. ][0];
  6342. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. ,$ctx1.sendIdx["nextPutAll:"]=2
  6345. //>>excludeEnd("ctx");
  6346. ][0];
  6347. $recv(aStream)._nextPutAll_("'");
  6348. return self;
  6349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6350. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6351. //>>excludeEnd("ctx");
  6352. }; }),
  6353. $globals.String);
  6354. $core.addMethod(
  6355. $core.method({
  6356. selector: "putOn:",
  6357. protocol: "streaming",
  6358. //>>excludeStart("ide", pragmas.excludeIdeData);
  6359. args: ["aStream"],
  6360. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6361. referencedClasses: [],
  6362. //>>excludeEnd("ide");
  6363. pragmas: [],
  6364. messageSends: ["nextPutString:"]
  6365. }, function ($methodClass){ return function (aStream){
  6366. var self=this,$self=this;
  6367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6368. return $core.withContext(function($ctx1) {
  6369. //>>excludeEnd("ctx");
  6370. $recv(aStream)._nextPutString_(self);
  6371. return self;
  6372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6373. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6374. //>>excludeEnd("ctx");
  6375. }; }),
  6376. $globals.String);
  6377. $core.addMethod(
  6378. $core.method({
  6379. selector: "remove:",
  6380. protocol: "adding/removing",
  6381. //>>excludeStart("ide", pragmas.excludeIdeData);
  6382. args: ["anObject"],
  6383. source: "remove: anObject\x0a\x09self errorReadOnly",
  6384. referencedClasses: [],
  6385. //>>excludeEnd("ide");
  6386. pragmas: [],
  6387. messageSends: ["errorReadOnly"]
  6388. }, function ($methodClass){ return function (anObject){
  6389. var self=this,$self=this;
  6390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6391. return $core.withContext(function($ctx1) {
  6392. //>>excludeEnd("ctx");
  6393. $self._errorReadOnly();
  6394. return self;
  6395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6396. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6397. //>>excludeEnd("ctx");
  6398. }; }),
  6399. $globals.String);
  6400. $core.addMethod(
  6401. $core.method({
  6402. selector: "remove:ifAbsent:",
  6403. protocol: "adding/removing",
  6404. //>>excludeStart("ide", pragmas.excludeIdeData);
  6405. args: ["anObject", "aBlock"],
  6406. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6407. referencedClasses: [],
  6408. //>>excludeEnd("ide");
  6409. pragmas: [],
  6410. messageSends: ["errorReadOnly"]
  6411. }, function ($methodClass){ return function (anObject,aBlock){
  6412. var self=this,$self=this;
  6413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6414. return $core.withContext(function($ctx1) {
  6415. //>>excludeEnd("ctx");
  6416. $self._errorReadOnly();
  6417. return self;
  6418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6419. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6420. //>>excludeEnd("ctx");
  6421. }; }),
  6422. $globals.String);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "replace:with:",
  6426. protocol: "regular expressions",
  6427. //>>excludeStart("ide", pragmas.excludeIdeData);
  6428. args: ["aString", "anotherString"],
  6429. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6430. referencedClasses: ["RegularExpression"],
  6431. //>>excludeEnd("ide");
  6432. pragmas: [],
  6433. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6434. }, function ($methodClass){ return function (aString,anotherString){
  6435. var self=this,$self=this;
  6436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6437. return $core.withContext(function($ctx1) {
  6438. //>>excludeEnd("ctx");
  6439. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6441. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6442. //>>excludeEnd("ctx");
  6443. }; }),
  6444. $globals.String);
  6445. $core.addMethod(
  6446. $core.method({
  6447. selector: "replaceRegexp:with:",
  6448. protocol: "regular expressions",
  6449. //>>excludeStart("ide", pragmas.excludeIdeData);
  6450. args: ["aRegexp", "aString"],
  6451. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6452. referencedClasses: [],
  6453. //>>excludeEnd("ide");
  6454. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6455. messageSends: []
  6456. }, function ($methodClass){ return function (aRegexp,aString){
  6457. var self=this,$self=this;
  6458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6459. return $core.withContext(function($ctx1) {
  6460. //>>excludeEnd("ctx");
  6461. return self.replace(aRegexp, aString);
  6462. return self;
  6463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6464. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6465. //>>excludeEnd("ctx");
  6466. }; }),
  6467. $globals.String);
  6468. $core.addMethod(
  6469. $core.method({
  6470. selector: "reversed",
  6471. protocol: "converting",
  6472. //>>excludeStart("ide", pragmas.excludeIdeData);
  6473. args: [],
  6474. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6475. referencedClasses: [],
  6476. //>>excludeEnd("ide");
  6477. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6478. messageSends: []
  6479. }, function ($methodClass){ return function (){
  6480. var self=this,$self=this;
  6481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6482. return $core.withContext(function($ctx1) {
  6483. //>>excludeEnd("ctx");
  6484. return self.split("").reverse().join("");
  6485. return self;
  6486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6487. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6488. //>>excludeEnd("ctx");
  6489. }; }),
  6490. $globals.String);
  6491. $core.addMethod(
  6492. $core.method({
  6493. selector: "shallowCopy",
  6494. protocol: "copying",
  6495. //>>excludeStart("ide", pragmas.excludeIdeData);
  6496. args: [],
  6497. source: "shallowCopy\x0a\x09^ self",
  6498. referencedClasses: [],
  6499. //>>excludeEnd("ide");
  6500. pragmas: [],
  6501. messageSends: []
  6502. }, function ($methodClass){ return function (){
  6503. var self=this,$self=this;
  6504. return self;
  6505. }; }),
  6506. $globals.String);
  6507. $core.addMethod(
  6508. $core.method({
  6509. selector: "shortenedPrintString",
  6510. protocol: "printing",
  6511. //>>excludeStart("ide", pragmas.excludeIdeData);
  6512. args: [],
  6513. source: "shortenedPrintString\x0a\x09^ self printString size > 30\x0a\x09\x09ifTrue: [ (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ self printString ]",
  6514. referencedClasses: [],
  6515. //>>excludeEnd("ide");
  6516. pragmas: [],
  6517. messageSends: ["ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:"]
  6518. }, function ($methodClass){ return function (){
  6519. var self=this,$self=this;
  6520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6521. return $core.withContext(function($ctx1) {
  6522. //>>excludeEnd("ctx");
  6523. if($core.assert($recv($recv([$self._printString()
  6524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6525. ,$ctx1.sendIdx["printString"]=1
  6526. //>>excludeEnd("ctx");
  6527. ][0])._size()).__gt((30)))){
  6528. return $recv($recv([$self._printString()
  6529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6530. ,$ctx1.sendIdx["printString"]=2
  6531. //>>excludeEnd("ctx");
  6532. ][0])._copyFrom_to_((1),(30))).__comma("...'");
  6533. } else {
  6534. return $self._printString();
  6535. }
  6536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6537. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  6538. //>>excludeEnd("ctx");
  6539. }; }),
  6540. $globals.String);
  6541. $core.addMethod(
  6542. $core.method({
  6543. selector: "subStrings:",
  6544. protocol: "split join",
  6545. //>>excludeStart("ide", pragmas.excludeIdeData);
  6546. args: ["aString"],
  6547. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6548. referencedClasses: [],
  6549. //>>excludeEnd("ide");
  6550. pragmas: [],
  6551. messageSends: ["tokenize:"]
  6552. }, function ($methodClass){ return function (aString){
  6553. var self=this,$self=this;
  6554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6555. return $core.withContext(function($ctx1) {
  6556. //>>excludeEnd("ctx");
  6557. return $self._tokenize_(aString);
  6558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6559. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6560. //>>excludeEnd("ctx");
  6561. }; }),
  6562. $globals.String);
  6563. $core.addMethod(
  6564. $core.method({
  6565. selector: "symbolPrintString",
  6566. protocol: "printing",
  6567. //>>excludeStart("ide", pragmas.excludeIdeData);
  6568. args: [],
  6569. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6570. referencedClasses: ["String"],
  6571. //>>excludeEnd("ide");
  6572. pragmas: [],
  6573. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6574. }, function ($methodClass){ return function (){
  6575. var self=this,$self=this;
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. return $core.withContext(function($ctx1) {
  6578. //>>excludeEnd("ctx");
  6579. return $recv($globals.String)._streamContents_((function(str){
  6580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6581. return $core.withContext(function($ctx2) {
  6582. //>>excludeEnd("ctx");
  6583. return $self._asSymbolPrintOn_(str);
  6584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6585. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6586. //>>excludeEnd("ctx");
  6587. }));
  6588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6589. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6590. //>>excludeEnd("ctx");
  6591. }; }),
  6592. $globals.String);
  6593. $core.addMethod(
  6594. $core.method({
  6595. selector: "tokenize:",
  6596. protocol: "split join",
  6597. //>>excludeStart("ide", pragmas.excludeIdeData);
  6598. args: ["aString"],
  6599. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6600. referencedClasses: [],
  6601. //>>excludeEnd("ide");
  6602. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6603. messageSends: []
  6604. }, function ($methodClass){ return function (aString){
  6605. var self=this,$self=this;
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. return $core.withContext(function($ctx1) {
  6608. //>>excludeEnd("ctx");
  6609. return self.split(aString);
  6610. return self;
  6611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6612. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6613. //>>excludeEnd("ctx");
  6614. }; }),
  6615. $globals.String);
  6616. $core.addMethod(
  6617. $core.method({
  6618. selector: "trimBoth",
  6619. protocol: "regular expressions",
  6620. //>>excludeStart("ide", pragmas.excludeIdeData);
  6621. args: [],
  6622. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6623. referencedClasses: [],
  6624. //>>excludeEnd("ide");
  6625. pragmas: [],
  6626. messageSends: ["trimBoth:"]
  6627. }, function ($methodClass){ return function (){
  6628. var self=this,$self=this;
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. return $core.withContext(function($ctx1) {
  6631. //>>excludeEnd("ctx");
  6632. return $self._trimBoth_("\x5cs");
  6633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6634. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6635. //>>excludeEnd("ctx");
  6636. }; }),
  6637. $globals.String);
  6638. $core.addMethod(
  6639. $core.method({
  6640. selector: "trimBoth:",
  6641. protocol: "regular expressions",
  6642. //>>excludeStart("ide", pragmas.excludeIdeData);
  6643. args: ["separators"],
  6644. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6645. referencedClasses: [],
  6646. //>>excludeEnd("ide");
  6647. pragmas: [],
  6648. messageSends: ["trimRight:", "trimLeft:"]
  6649. }, function ($methodClass){ return function (separators){
  6650. var self=this,$self=this;
  6651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6652. return $core.withContext(function($ctx1) {
  6653. //>>excludeEnd("ctx");
  6654. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6656. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6657. //>>excludeEnd("ctx");
  6658. }; }),
  6659. $globals.String);
  6660. $core.addMethod(
  6661. $core.method({
  6662. selector: "trimLeft",
  6663. protocol: "regular expressions",
  6664. //>>excludeStart("ide", pragmas.excludeIdeData);
  6665. args: [],
  6666. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6667. referencedClasses: [],
  6668. //>>excludeEnd("ide");
  6669. pragmas: [],
  6670. messageSends: ["trimLeft:"]
  6671. }, function ($methodClass){ return function (){
  6672. var self=this,$self=this;
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. return $core.withContext(function($ctx1) {
  6675. //>>excludeEnd("ctx");
  6676. return $self._trimLeft_("\x5cs");
  6677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6678. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6679. //>>excludeEnd("ctx");
  6680. }; }),
  6681. $globals.String);
  6682. $core.addMethod(
  6683. $core.method({
  6684. selector: "trimLeft:",
  6685. protocol: "regular expressions",
  6686. //>>excludeStart("ide", pragmas.excludeIdeData);
  6687. args: ["separators"],
  6688. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6689. referencedClasses: ["RegularExpression"],
  6690. //>>excludeEnd("ide");
  6691. pragmas: [],
  6692. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6693. }, function ($methodClass){ return function (separators){
  6694. var self=this,$self=this;
  6695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6696. return $core.withContext(function($ctx1) {
  6697. //>>excludeEnd("ctx");
  6698. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6700. ,$ctx1.sendIdx[","]=1
  6701. //>>excludeEnd("ctx");
  6702. ][0],"g"),"");
  6703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6704. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6705. //>>excludeEnd("ctx");
  6706. }; }),
  6707. $globals.String);
  6708. $core.addMethod(
  6709. $core.method({
  6710. selector: "trimRight",
  6711. protocol: "regular expressions",
  6712. //>>excludeStart("ide", pragmas.excludeIdeData);
  6713. args: [],
  6714. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6715. referencedClasses: [],
  6716. //>>excludeEnd("ide");
  6717. pragmas: [],
  6718. messageSends: ["trimRight:"]
  6719. }, function ($methodClass){ return function (){
  6720. var self=this,$self=this;
  6721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6722. return $core.withContext(function($ctx1) {
  6723. //>>excludeEnd("ctx");
  6724. return $self._trimRight_("\x5cs");
  6725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6726. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6727. //>>excludeEnd("ctx");
  6728. }; }),
  6729. $globals.String);
  6730. $core.addMethod(
  6731. $core.method({
  6732. selector: "trimRight:",
  6733. protocol: "regular expressions",
  6734. //>>excludeStart("ide", pragmas.excludeIdeData);
  6735. args: ["separators"],
  6736. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6737. referencedClasses: ["RegularExpression"],
  6738. //>>excludeEnd("ide");
  6739. pragmas: [],
  6740. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6741. }, function ($methodClass){ return function (separators){
  6742. var self=this,$self=this;
  6743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6744. return $core.withContext(function($ctx1) {
  6745. //>>excludeEnd("ctx");
  6746. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. ,$ctx1.sendIdx[","]=1
  6749. //>>excludeEnd("ctx");
  6750. ][0],"g"),"");
  6751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6752. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6753. //>>excludeEnd("ctx");
  6754. }; }),
  6755. $globals.String);
  6756. $core.addMethod(
  6757. $core.method({
  6758. selector: "unescaped",
  6759. protocol: "converting",
  6760. //>>excludeStart("ide", pragmas.excludeIdeData);
  6761. args: [],
  6762. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6763. referencedClasses: [],
  6764. //>>excludeEnd("ide");
  6765. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6766. messageSends: []
  6767. }, function ($methodClass){ return function (){
  6768. var self=this,$self=this;
  6769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6770. return $core.withContext(function($ctx1) {
  6771. //>>excludeEnd("ctx");
  6772. return unescape(self);
  6773. return self;
  6774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6775. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6776. //>>excludeEnd("ctx");
  6777. }; }),
  6778. $globals.String);
  6779. $core.addMethod(
  6780. $core.method({
  6781. selector: "uriComponentDecoded",
  6782. protocol: "converting",
  6783. //>>excludeStart("ide", pragmas.excludeIdeData);
  6784. args: [],
  6785. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6786. referencedClasses: [],
  6787. //>>excludeEnd("ide");
  6788. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6789. messageSends: []
  6790. }, function ($methodClass){ return function (){
  6791. var self=this,$self=this;
  6792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6793. return $core.withContext(function($ctx1) {
  6794. //>>excludeEnd("ctx");
  6795. return decodeURIComponent(self);
  6796. return self;
  6797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6798. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6799. //>>excludeEnd("ctx");
  6800. }; }),
  6801. $globals.String);
  6802. $core.addMethod(
  6803. $core.method({
  6804. selector: "uriComponentEncoded",
  6805. protocol: "converting",
  6806. //>>excludeStart("ide", pragmas.excludeIdeData);
  6807. args: [],
  6808. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6809. referencedClasses: [],
  6810. //>>excludeEnd("ide");
  6811. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6812. messageSends: []
  6813. }, function ($methodClass){ return function (){
  6814. var self=this,$self=this;
  6815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6816. return $core.withContext(function($ctx1) {
  6817. //>>excludeEnd("ctx");
  6818. return encodeURIComponent(self);
  6819. return self;
  6820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6821. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6822. //>>excludeEnd("ctx");
  6823. }; }),
  6824. $globals.String);
  6825. $core.addMethod(
  6826. $core.method({
  6827. selector: "uriDecoded",
  6828. protocol: "converting",
  6829. //>>excludeStart("ide", pragmas.excludeIdeData);
  6830. args: [],
  6831. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6832. referencedClasses: [],
  6833. //>>excludeEnd("ide");
  6834. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6835. messageSends: []
  6836. }, function ($methodClass){ return function (){
  6837. var self=this,$self=this;
  6838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6839. return $core.withContext(function($ctx1) {
  6840. //>>excludeEnd("ctx");
  6841. return decodeURI(self);
  6842. return self;
  6843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6844. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6845. //>>excludeEnd("ctx");
  6846. }; }),
  6847. $globals.String);
  6848. $core.addMethod(
  6849. $core.method({
  6850. selector: "uriEncoded",
  6851. protocol: "converting",
  6852. //>>excludeStart("ide", pragmas.excludeIdeData);
  6853. args: [],
  6854. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6855. referencedClasses: [],
  6856. //>>excludeEnd("ide");
  6857. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6858. messageSends: []
  6859. }, function ($methodClass){ return function (){
  6860. var self=this,$self=this;
  6861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6862. return $core.withContext(function($ctx1) {
  6863. //>>excludeEnd("ctx");
  6864. return encodeURI(self);
  6865. return self;
  6866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6867. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6868. //>>excludeEnd("ctx");
  6869. }; }),
  6870. $globals.String);
  6871. $core.addMethod(
  6872. $core.method({
  6873. selector: "value:",
  6874. protocol: "evaluating",
  6875. //>>excludeStart("ide", pragmas.excludeIdeData);
  6876. args: ["anObject"],
  6877. source: "value: anObject \x0a\x09^ anObject perform: self",
  6878. referencedClasses: [],
  6879. //>>excludeEnd("ide");
  6880. pragmas: [],
  6881. messageSends: ["perform:"]
  6882. }, function ($methodClass){ return function (anObject){
  6883. var self=this,$self=this;
  6884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6885. return $core.withContext(function($ctx1) {
  6886. //>>excludeEnd("ctx");
  6887. return $recv(anObject)._perform_(self);
  6888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6889. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6890. //>>excludeEnd("ctx");
  6891. }; }),
  6892. $globals.String);
  6893. $core.addMethod(
  6894. $core.method({
  6895. selector: "cr",
  6896. protocol: "accessing",
  6897. //>>excludeStart("ide", pragmas.excludeIdeData);
  6898. args: [],
  6899. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6900. referencedClasses: [],
  6901. //>>excludeEnd("ide");
  6902. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6903. messageSends: []
  6904. }, function ($methodClass){ return function (){
  6905. var self=this,$self=this;
  6906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6907. return $core.withContext(function($ctx1) {
  6908. //>>excludeEnd("ctx");
  6909. return "\r";
  6910. return self;
  6911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6912. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6913. //>>excludeEnd("ctx");
  6914. }; }),
  6915. $globals.String.a$cls);
  6916. $core.addMethod(
  6917. $core.method({
  6918. selector: "crlf",
  6919. protocol: "accessing",
  6920. //>>excludeStart("ide", pragmas.excludeIdeData);
  6921. args: [],
  6922. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6923. referencedClasses: [],
  6924. //>>excludeEnd("ide");
  6925. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6926. messageSends: []
  6927. }, function ($methodClass){ return function (){
  6928. var self=this,$self=this;
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. return $core.withContext(function($ctx1) {
  6931. //>>excludeEnd("ctx");
  6932. return "\r\n";
  6933. return self;
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6936. //>>excludeEnd("ctx");
  6937. }; }),
  6938. $globals.String.a$cls);
  6939. $core.addMethod(
  6940. $core.method({
  6941. selector: "esc",
  6942. protocol: "accessing",
  6943. //>>excludeStart("ide", pragmas.excludeIdeData);
  6944. args: [],
  6945. source: "esc\x0a\x09^ self fromCharCode: 27",
  6946. referencedClasses: [],
  6947. //>>excludeEnd("ide");
  6948. pragmas: [],
  6949. messageSends: ["fromCharCode:"]
  6950. }, function ($methodClass){ return function (){
  6951. var self=this,$self=this;
  6952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6953. return $core.withContext(function($ctx1) {
  6954. //>>excludeEnd("ctx");
  6955. return $self._fromCharCode_((27));
  6956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6957. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6958. //>>excludeEnd("ctx");
  6959. }; }),
  6960. $globals.String.a$cls);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "fromCharCode:",
  6964. protocol: "instance creation",
  6965. //>>excludeStart("ide", pragmas.excludeIdeData);
  6966. args: ["anInteger"],
  6967. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6968. referencedClasses: [],
  6969. //>>excludeEnd("ide");
  6970. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6971. messageSends: []
  6972. }, function ($methodClass){ return function (anInteger){
  6973. var self=this,$self=this;
  6974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6975. return $core.withContext(function($ctx1) {
  6976. //>>excludeEnd("ctx");
  6977. return String.fromCharCode(anInteger);
  6978. return self;
  6979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6980. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6981. //>>excludeEnd("ctx");
  6982. }; }),
  6983. $globals.String.a$cls);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "fromString:",
  6987. protocol: "instance creation",
  6988. //>>excludeStart("ide", pragmas.excludeIdeData);
  6989. args: ["aString"],
  6990. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6991. referencedClasses: [],
  6992. //>>excludeEnd("ide");
  6993. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6994. messageSends: []
  6995. }, function ($methodClass){ return function (aString){
  6996. var self=this,$self=this;
  6997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6998. return $core.withContext(function($ctx1) {
  6999. //>>excludeEnd("ctx");
  7000. return String(aString);
  7001. return self;
  7002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7003. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  7004. //>>excludeEnd("ctx");
  7005. }; }),
  7006. $globals.String.a$cls);
  7007. $core.addMethod(
  7008. $core.method({
  7009. selector: "lf",
  7010. protocol: "accessing",
  7011. //>>excludeStart("ide", pragmas.excludeIdeData);
  7012. args: [],
  7013. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7014. referencedClasses: [],
  7015. //>>excludeEnd("ide");
  7016. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  7017. messageSends: []
  7018. }, function ($methodClass){ return function (){
  7019. var self=this,$self=this;
  7020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7021. return $core.withContext(function($ctx1) {
  7022. //>>excludeEnd("ctx");
  7023. return "\n";
  7024. return self;
  7025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7026. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  7027. //>>excludeEnd("ctx");
  7028. }; }),
  7029. $globals.String.a$cls);
  7030. $core.addMethod(
  7031. $core.method({
  7032. selector: "random",
  7033. protocol: "random",
  7034. //>>excludeStart("ide", pragmas.excludeIdeData);
  7035. args: [],
  7036. 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);'>",
  7037. referencedClasses: [],
  7038. //>>excludeEnd("ide");
  7039. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  7040. messageSends: []
  7041. }, function ($methodClass){ return function (){
  7042. var self=this,$self=this;
  7043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7044. return $core.withContext(function($ctx1) {
  7045. //>>excludeEnd("ctx");
  7046. return ((10+22*Math.random())/32).toString(32).slice(2);;
  7047. return self;
  7048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7049. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  7050. //>>excludeEnd("ctx");
  7051. }; }),
  7052. $globals.String.a$cls);
  7053. $core.addMethod(
  7054. $core.method({
  7055. selector: "randomNotIn:",
  7056. protocol: "random",
  7057. //>>excludeStart("ide", pragmas.excludeIdeData);
  7058. args: ["aString"],
  7059. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7060. referencedClasses: [],
  7061. //>>excludeEnd("ide");
  7062. pragmas: [],
  7063. messageSends: ["whileTrue", "random", "includesSubString:"]
  7064. }, function ($methodClass){ return function (aString){
  7065. var self=this,$self=this;
  7066. var result;
  7067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7068. return $core.withContext(function($ctx1) {
  7069. //>>excludeEnd("ctx");
  7070. $recv((function(){
  7071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7072. return $core.withContext(function($ctx2) {
  7073. //>>excludeEnd("ctx");
  7074. result=$self._random();
  7075. return $recv(aString)._includesSubString_(result);
  7076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7077. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7078. //>>excludeEnd("ctx");
  7079. }))._whileTrue();
  7080. return result;
  7081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7082. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  7083. //>>excludeEnd("ctx");
  7084. }; }),
  7085. $globals.String.a$cls);
  7086. $core.addMethod(
  7087. $core.method({
  7088. selector: "space",
  7089. protocol: "accessing",
  7090. //>>excludeStart("ide", pragmas.excludeIdeData);
  7091. args: [],
  7092. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7093. referencedClasses: [],
  7094. //>>excludeEnd("ide");
  7095. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  7096. messageSends: []
  7097. }, function ($methodClass){ return function (){
  7098. var self=this,$self=this;
  7099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7100. return $core.withContext(function($ctx1) {
  7101. //>>excludeEnd("ctx");
  7102. return " ";
  7103. return self;
  7104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7105. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  7106. //>>excludeEnd("ctx");
  7107. }; }),
  7108. $globals.String.a$cls);
  7109. $core.addMethod(
  7110. $core.method({
  7111. selector: "streamClass",
  7112. protocol: "accessing",
  7113. //>>excludeStart("ide", pragmas.excludeIdeData);
  7114. args: [],
  7115. source: "streamClass\x0a\x09\x09^ StringStream",
  7116. referencedClasses: ["StringStream"],
  7117. //>>excludeEnd("ide");
  7118. pragmas: [],
  7119. messageSends: []
  7120. }, function ($methodClass){ return function (){
  7121. var self=this,$self=this;
  7122. return $globals.StringStream;
  7123. }; }),
  7124. $globals.String.a$cls);
  7125. $core.addMethod(
  7126. $core.method({
  7127. selector: "tab",
  7128. protocol: "accessing",
  7129. //>>excludeStart("ide", pragmas.excludeIdeData);
  7130. args: [],
  7131. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7132. referencedClasses: [],
  7133. //>>excludeEnd("ide");
  7134. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  7135. messageSends: []
  7136. }, function ($methodClass){ return function (){
  7137. var self=this,$self=this;
  7138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7139. return $core.withContext(function($ctx1) {
  7140. //>>excludeEnd("ctx");
  7141. return "\t";
  7142. return self;
  7143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7144. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7145. //>>excludeEnd("ctx");
  7146. }; }),
  7147. $globals.String.a$cls);
  7148. $core.addMethod(
  7149. $core.method({
  7150. selector: "value:",
  7151. protocol: "instance creation",
  7152. //>>excludeStart("ide", pragmas.excludeIdeData);
  7153. args: ["aUTFCharCode"],
  7154. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7155. referencedClasses: [],
  7156. //>>excludeEnd("ide");
  7157. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7158. messageSends: []
  7159. }, function ($methodClass){ return function (aUTFCharCode){
  7160. var self=this,$self=this;
  7161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7162. return $core.withContext(function($ctx1) {
  7163. //>>excludeEnd("ctx");
  7164. return String.fromCharCode(aUTFCharCode);;
  7165. return self;
  7166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7167. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7168. //>>excludeEnd("ctx");
  7169. }; }),
  7170. $globals.String.a$cls);
  7171. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7172. //>>excludeStart("ide", pragmas.excludeIdeData);
  7173. $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`.";
  7174. //>>excludeEnd("ide");
  7175. $core.addMethod(
  7176. $core.method({
  7177. selector: "=",
  7178. protocol: "comparing",
  7179. //>>excludeStart("ide", pragmas.excludeIdeData);
  7180. args: ["aCollection"],
  7181. 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",
  7182. referencedClasses: [],
  7183. //>>excludeEnd("ide");
  7184. pragmas: [],
  7185. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7186. }, function ($methodClass){ return function (aCollection){
  7187. var self=this,$self=this;
  7188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7189. return $core.withContext(function($ctx1) {
  7190. //>>excludeEnd("ctx");
  7191. var $early={};
  7192. try {
  7193. if(!$core.assert([$recv([$self._class()
  7194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7195. ,$ctx1.sendIdx["class"]=1
  7196. //>>excludeEnd("ctx");
  7197. ][0]).__eq($recv(aCollection)._class())
  7198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7199. ,$ctx1.sendIdx["="]=1
  7200. //>>excludeEnd("ctx");
  7201. ][0])){
  7202. return false;
  7203. }
  7204. if(!$core.assert($recv([$self._size()
  7205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7206. ,$ctx1.sendIdx["size"]=1
  7207. //>>excludeEnd("ctx");
  7208. ][0]).__eq($recv(aCollection)._size()))){
  7209. return false;
  7210. }
  7211. $self._do_((function(each){
  7212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7213. return $core.withContext(function($ctx2) {
  7214. //>>excludeEnd("ctx");
  7215. if(!$core.assert($recv(aCollection)._includes_(each))){
  7216. throw $early=[false];
  7217. }
  7218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7220. //>>excludeEnd("ctx");
  7221. }));
  7222. return true;
  7223. }
  7224. catch(e) {if(e===$early)return e[0]; throw e}
  7225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7226. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7227. //>>excludeEnd("ctx");
  7228. }; }),
  7229. $globals.Set);
  7230. $core.addMethod(
  7231. $core.method({
  7232. selector: "add:",
  7233. protocol: "adding/removing",
  7234. //>>excludeStart("ide", pragmas.excludeIdeData);
  7235. args: ["anObject"],
  7236. 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 ]",
  7237. referencedClasses: [],
  7238. //>>excludeEnd("ide");
  7239. pragmas: [],
  7240. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7241. }, function ($methodClass){ return function (anObject){
  7242. var self=this,$self=this;
  7243. var bucket;
  7244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7245. return $core.withContext(function($ctx1) {
  7246. //>>excludeEnd("ctx");
  7247. var $1;
  7248. bucket=$self._bucketsOfElement_(anObject);
  7249. $1=$recv(bucket)._second();
  7250. if($1 == null || $1.a$nil){
  7251. var object,slowBucket;
  7252. object=[$recv(bucket)._first()
  7253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7254. ,$ctx1.sendIdx["first"]=1
  7255. //>>excludeEnd("ctx");
  7256. ][0];
  7257. slowBucket=$recv(bucket)._third();
  7258. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7260. return $core.withContext(function($ctx2) {
  7261. //>>excludeEnd("ctx");
  7262. $recv(slowBucket)._add_(object);
  7263. $self.size=$recv($self.size).__plus((1));
  7264. return $self.size;
  7265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7267. //>>excludeEnd("ctx");
  7268. }));
  7269. return object;
  7270. } else {
  7271. var primitiveBucket;
  7272. primitiveBucket=$1;
  7273. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7274. }
  7275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7276. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7277. //>>excludeEnd("ctx");
  7278. }; }),
  7279. $globals.Set);
  7280. $core.addMethod(
  7281. $core.method({
  7282. selector: "add:in:",
  7283. protocol: "private",
  7284. //>>excludeStart("ide", pragmas.excludeIdeData);
  7285. args: ["anObject", "anotherObject"],
  7286. 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'>",
  7287. referencedClasses: [],
  7288. //>>excludeEnd("ide");
  7289. 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"]]],
  7290. messageSends: []
  7291. }, function ($methodClass){ return function (anObject,anotherObject){
  7292. var self=this,$self=this;
  7293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7294. return $core.withContext(function($ctx1) {
  7295. //>>excludeEnd("ctx");
  7296. if (anObject in anotherObject.store) { return anObject; }
  7297. $self.size++;
  7298. anotherObject.store[anObject] = true;
  7299. return anObject;
  7300. ;
  7301. return self;
  7302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7303. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7304. //>>excludeEnd("ctx");
  7305. }; }),
  7306. $globals.Set);
  7307. $core.addMethod(
  7308. $core.method({
  7309. selector: "bucketsOfElement:",
  7310. protocol: "private",
  7311. //>>excludeStart("ide", pragmas.excludeIdeData);
  7312. args: ["anObject"],
  7313. 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'>",
  7314. referencedClasses: [],
  7315. //>>excludeEnd("ide");
  7316. 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"]]],
  7317. messageSends: []
  7318. }, function ($methodClass){ return function (anObject){
  7319. var self=this,$self=this;
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. return $core.withContext(function($ctx1) {
  7322. //>>excludeEnd("ctx");
  7323. // include nil to well-known objects under "boolean" fastBucket
  7324. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7325. var prim = anObject.valueOf();
  7326. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7327. var bucket = null;
  7328. $self.slowBucketStores.some(function (store) {
  7329. return bucket = store._bucketOfElement_(anObject);
  7330. });
  7331. return [ anObject, null, bucket || $self.defaultBucket ];
  7332. }
  7333. return [ prim, $self.fastBuckets[typeof prim] ];
  7334. ;
  7335. return self;
  7336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7337. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7338. //>>excludeEnd("ctx");
  7339. }; }),
  7340. $globals.Set);
  7341. $core.addMethod(
  7342. $core.method({
  7343. selector: "classNameOf:",
  7344. protocol: "private",
  7345. //>>excludeStart("ide", pragmas.excludeIdeData);
  7346. args: ["anObject"],
  7347. 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'>",
  7348. referencedClasses: [],
  7349. //>>excludeEnd("ide");
  7350. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7351. messageSends: []
  7352. }, function ($methodClass){ return function (anObject){
  7353. var self=this,$self=this;
  7354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7355. return $core.withContext(function($ctx1) {
  7356. //>>excludeEnd("ctx");
  7357. return anObject.a$cls != null && anObject.a$cls.name;
  7358. return self;
  7359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7360. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7361. //>>excludeEnd("ctx");
  7362. }; }),
  7363. $globals.Set);
  7364. $core.addMethod(
  7365. $core.method({
  7366. selector: "collect:",
  7367. protocol: "enumerating",
  7368. //>>excludeStart("ide", pragmas.excludeIdeData);
  7369. args: ["aBlock"],
  7370. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7371. referencedClasses: [],
  7372. //>>excludeEnd("ide");
  7373. pragmas: [],
  7374. messageSends: ["new", "class", "do:", "add:", "value:"]
  7375. }, function ($methodClass){ return function (aBlock){
  7376. var self=this,$self=this;
  7377. var collection;
  7378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7379. return $core.withContext(function($ctx1) {
  7380. //>>excludeEnd("ctx");
  7381. collection=$recv($self._class())._new();
  7382. $self._do_((function(each){
  7383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7384. return $core.withContext(function($ctx2) {
  7385. //>>excludeEnd("ctx");
  7386. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7389. //>>excludeEnd("ctx");
  7390. }));
  7391. return collection;
  7392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7393. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7394. //>>excludeEnd("ctx");
  7395. }; }),
  7396. $globals.Set);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "do:",
  7400. protocol: "enumerating",
  7401. //>>excludeStart("ide", pragmas.excludeIdeData);
  7402. args: ["aBlock"],
  7403. 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'>",
  7404. referencedClasses: [],
  7405. //>>excludeEnd("ide");
  7406. 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"]]],
  7407. messageSends: []
  7408. }, function ($methodClass){ return function (aBlock){
  7409. var self=this,$self=this;
  7410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7411. return $core.withContext(function($ctx1) {
  7412. //>>excludeEnd("ctx");
  7413. var el, keys, i;
  7414. el = $self.fastBuckets;
  7415. keys = Object.keys(el);
  7416. for (i = 0; i < keys.length; ++i) {
  7417. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7418. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7419. else { store._do_(aBlock); }
  7420. }
  7421. el = $self.slowBucketStores;
  7422. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7423. $self.defaultBucket._do_(aBlock);
  7424. ;
  7425. return self;
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7428. //>>excludeEnd("ctx");
  7429. }; }),
  7430. $globals.Set);
  7431. $core.addMethod(
  7432. $core.method({
  7433. selector: "includes:",
  7434. protocol: "testing",
  7435. //>>excludeStart("ide", pragmas.excludeIdeData);
  7436. args: ["anObject"],
  7437. 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 ]",
  7438. referencedClasses: [],
  7439. //>>excludeEnd("ide");
  7440. pragmas: [],
  7441. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7442. }, function ($methodClass){ return function (anObject){
  7443. var self=this,$self=this;
  7444. var bucket;
  7445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7446. return $core.withContext(function($ctx1) {
  7447. //>>excludeEnd("ctx");
  7448. var $1;
  7449. bucket=$self._bucketsOfElement_(anObject);
  7450. $1=$recv(bucket)._second();
  7451. if($1 == null || $1.a$nil){
  7452. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7454. ,$ctx1.sendIdx["first"]=1
  7455. //>>excludeEnd("ctx");
  7456. ][0]);
  7457. } else {
  7458. var primitiveBucket;
  7459. primitiveBucket=$1;
  7460. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7461. }
  7462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7463. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7464. //>>excludeEnd("ctx");
  7465. }; }),
  7466. $globals.Set);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "includes:in:",
  7470. protocol: "private",
  7471. //>>excludeStart("ide", pragmas.excludeIdeData);
  7472. args: ["anObject", "anotherObject"],
  7473. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7474. referencedClasses: [],
  7475. //>>excludeEnd("ide");
  7476. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7477. messageSends: []
  7478. }, function ($methodClass){ return function (anObject,anotherObject){
  7479. var self=this,$self=this;
  7480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7481. return $core.withContext(function($ctx1) {
  7482. //>>excludeEnd("ctx");
  7483. return anObject in anotherObject.store;
  7484. return self;
  7485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7486. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7487. //>>excludeEnd("ctx");
  7488. }; }),
  7489. $globals.Set);
  7490. $core.addMethod(
  7491. $core.method({
  7492. selector: "initialize",
  7493. protocol: "initialization",
  7494. //>>excludeStart("ide", pragmas.excludeIdeData);
  7495. args: [],
  7496. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7497. referencedClasses: [],
  7498. //>>excludeEnd("ide");
  7499. pragmas: [],
  7500. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7501. }, function ($methodClass){ return function (){
  7502. var self=this,$self=this;
  7503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7504. return $core.withContext(function($ctx1) {
  7505. //>>excludeEnd("ctx");
  7506. [(
  7507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7508. $ctx1.supercall = true,
  7509. //>>excludeEnd("ctx");
  7510. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7512. ,$ctx1.supercall = false
  7513. //>>excludeEnd("ctx");
  7514. ][0];
  7515. $self.defaultBucket=[];
  7516. $self._initializeSlowBucketStores();
  7517. $self._removeAll();
  7518. return self;
  7519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7520. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7521. //>>excludeEnd("ctx");
  7522. }; }),
  7523. $globals.Set);
  7524. $core.addMethod(
  7525. $core.method({
  7526. selector: "initializeSlowBucketStores",
  7527. protocol: "initialization",
  7528. //>>excludeStart("ide", pragmas.excludeIdeData);
  7529. args: [],
  7530. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7531. referencedClasses: ["ArrayBucketStore"],
  7532. //>>excludeEnd("ide");
  7533. pragmas: [],
  7534. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7535. }, function ($methodClass){ return function (){
  7536. var self=this,$self=this;
  7537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7538. return $core.withContext(function($ctx1) {
  7539. //>>excludeEnd("ctx");
  7540. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7542. return $core.withContext(function($ctx2) {
  7543. //>>excludeEnd("ctx");
  7544. return $self._classNameOf_(x);
  7545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7546. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7547. //>>excludeEnd("ctx");
  7548. }))
  7549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7550. ,$ctx1.sendIdx["hashBlock:"]=1
  7551. //>>excludeEnd("ctx");
  7552. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7554. return $core.withContext(function($ctx2) {
  7555. //>>excludeEnd("ctx");
  7556. return $self._jsConstructorNameOf_(x);
  7557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7558. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7559. //>>excludeEnd("ctx");
  7560. }))];
  7561. return self;
  7562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7563. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7564. //>>excludeEnd("ctx");
  7565. }; }),
  7566. $globals.Set);
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "jsConstructorNameOf:",
  7570. protocol: "private",
  7571. //>>excludeStart("ide", pragmas.excludeIdeData);
  7572. args: ["anObject"],
  7573. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7574. referencedClasses: [],
  7575. //>>excludeEnd("ide");
  7576. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7577. messageSends: []
  7578. }, function ($methodClass){ return function (anObject){
  7579. var self=this,$self=this;
  7580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7581. return $core.withContext(function($ctx1) {
  7582. //>>excludeEnd("ctx");
  7583. return anObject.constructor && anObject.constructor.name;
  7584. return self;
  7585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7586. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7587. //>>excludeEnd("ctx");
  7588. }; }),
  7589. $globals.Set);
  7590. $core.addMethod(
  7591. $core.method({
  7592. selector: "printOn:",
  7593. protocol: "printing",
  7594. //>>excludeStart("ide", pragmas.excludeIdeData);
  7595. args: ["aStream"],
  7596. 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: ')'",
  7597. referencedClasses: [],
  7598. //>>excludeEnd("ide");
  7599. pragmas: [],
  7600. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7601. }, function ($methodClass){ return function (aStream){
  7602. var self=this,$self=this;
  7603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7604. return $core.withContext(function($ctx1) {
  7605. //>>excludeEnd("ctx");
  7606. [(
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. $ctx1.supercall = true,
  7609. //>>excludeEnd("ctx");
  7610. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7612. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7613. //>>excludeEnd("ctx");
  7614. ][0];
  7615. [$recv(aStream)._nextPutAll_(" (")
  7616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7617. ,$ctx1.sendIdx["nextPutAll:"]=1
  7618. //>>excludeEnd("ctx");
  7619. ][0];
  7620. $self._do_separatedBy_((function(each){
  7621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7622. return $core.withContext(function($ctx2) {
  7623. //>>excludeEnd("ctx");
  7624. return $recv(each)._printOn_(aStream);
  7625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7627. //>>excludeEnd("ctx");
  7628. }),(function(){
  7629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7630. return $core.withContext(function($ctx2) {
  7631. //>>excludeEnd("ctx");
  7632. return [$recv(aStream)._nextPutAll_(" ")
  7633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7634. ,$ctx2.sendIdx["nextPutAll:"]=2
  7635. //>>excludeEnd("ctx");
  7636. ][0];
  7637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7638. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7639. //>>excludeEnd("ctx");
  7640. }));
  7641. $recv(aStream)._nextPutAll_(")");
  7642. return self;
  7643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7644. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7645. //>>excludeEnd("ctx");
  7646. }; }),
  7647. $globals.Set);
  7648. $core.addMethod(
  7649. $core.method({
  7650. selector: "remove:ifAbsent:",
  7651. protocol: "adding/removing",
  7652. //>>excludeStart("ide", pragmas.excludeIdeData);
  7653. args: ["anObject", "aBlock"],
  7654. 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 ]",
  7655. referencedClasses: [],
  7656. //>>excludeEnd("ide");
  7657. pragmas: [],
  7658. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7659. }, function ($methodClass){ return function (anObject,aBlock){
  7660. var self=this,$self=this;
  7661. var bucket;
  7662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7663. return $core.withContext(function($ctx1) {
  7664. //>>excludeEnd("ctx");
  7665. var $1;
  7666. var $early={};
  7667. try {
  7668. bucket=$self._bucketsOfElement_(anObject);
  7669. $1=$recv(bucket)._second();
  7670. if($1 == null || $1.a$nil){
  7671. var obj;
  7672. obj=[$recv(bucket)._first()
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. ,$ctx1.sendIdx["first"]=1
  7675. //>>excludeEnd("ctx");
  7676. ][0];
  7677. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. return $core.withContext(function($ctx2) {
  7680. //>>excludeEnd("ctx");
  7681. throw $early=[$recv(aBlock)._value()];
  7682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7683. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7684. //>>excludeEnd("ctx");
  7685. }));
  7686. $self.size=$recv($self.size).__minus((1));
  7687. return obj;
  7688. } else {
  7689. var primitiveBucket;
  7690. primitiveBucket=$1;
  7691. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7692. }
  7693. }
  7694. catch(e) {if(e===$early)return e[0]; throw e}
  7695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7696. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7697. //>>excludeEnd("ctx");
  7698. }; }),
  7699. $globals.Set);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "remove:in:ifAbsent:",
  7703. protocol: "private",
  7704. //>>excludeStart("ide", pragmas.excludeIdeData);
  7705. args: ["anObject", "anotherObject", "aBlock"],
  7706. 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}'>",
  7707. referencedClasses: [],
  7708. //>>excludeEnd("ide");
  7709. 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}"]]],
  7710. messageSends: []
  7711. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7712. var self=this,$self=this;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. return $core.withContext(function($ctx1) {
  7715. //>>excludeEnd("ctx");
  7716. if (anObject in anotherObject.store) {
  7717. delete anotherObject.store[anObject];
  7718. $self.size--;
  7719. return anObject;
  7720. } else {
  7721. return aBlock._value();
  7722. };
  7723. return self;
  7724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7725. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7726. //>>excludeEnd("ctx");
  7727. }; }),
  7728. $globals.Set);
  7729. $core.addMethod(
  7730. $core.method({
  7731. selector: "removeAll",
  7732. protocol: "adding/removing",
  7733. //>>excludeStart("ide", pragmas.excludeIdeData);
  7734. args: [],
  7735. 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'>",
  7736. referencedClasses: [],
  7737. //>>excludeEnd("ide");
  7738. 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"]]],
  7739. messageSends: []
  7740. }, function ($methodClass){ return function (){
  7741. var self=this,$self=this;
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. return $core.withContext(function($ctx1) {
  7744. //>>excludeEnd("ctx");
  7745. $self.fastBuckets = {
  7746. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7747. "number": { store: Object.create(null), fn: Number },
  7748. "string": { store: Object.create(null) }
  7749. };
  7750. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7751. $self.defaultBucket._removeAll();
  7752. $self.size = 0;
  7753. ;
  7754. return self;
  7755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7756. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7757. //>>excludeEnd("ctx");
  7758. }; }),
  7759. $globals.Set);
  7760. $core.addMethod(
  7761. $core.method({
  7762. selector: "select:",
  7763. protocol: "enumerating",
  7764. //>>excludeStart("ide", pragmas.excludeIdeData);
  7765. args: ["aBlock"],
  7766. 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",
  7767. referencedClasses: [],
  7768. //>>excludeEnd("ide");
  7769. pragmas: [],
  7770. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7771. }, function ($methodClass){ return function (aBlock){
  7772. var self=this,$self=this;
  7773. var collection;
  7774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7775. return $core.withContext(function($ctx1) {
  7776. //>>excludeEnd("ctx");
  7777. collection=$recv($self._class())._new();
  7778. $self._do_((function(each){
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. return $core.withContext(function($ctx2) {
  7781. //>>excludeEnd("ctx");
  7782. if($core.assert($recv(aBlock)._value_(each))){
  7783. return $recv(collection)._add_(each);
  7784. }
  7785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7787. //>>excludeEnd("ctx");
  7788. }));
  7789. return collection;
  7790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7791. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7792. //>>excludeEnd("ctx");
  7793. }; }),
  7794. $globals.Set);
  7795. $core.addMethod(
  7796. $core.method({
  7797. selector: "select:thenCollect:",
  7798. protocol: "enumerating",
  7799. //>>excludeStart("ide", pragmas.excludeIdeData);
  7800. args: ["selectBlock", "collectBlock"],
  7801. 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",
  7802. referencedClasses: [],
  7803. //>>excludeEnd("ide");
  7804. pragmas: [],
  7805. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7806. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7807. var self=this,$self=this;
  7808. var collection;
  7809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7810. return $core.withContext(function($ctx1) {
  7811. //>>excludeEnd("ctx");
  7812. collection=$recv($self._class())._new();
  7813. $self._do_((function(each){
  7814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7815. return $core.withContext(function($ctx2) {
  7816. //>>excludeEnd("ctx");
  7817. if($core.assert([$recv(selectBlock)._value_(each)
  7818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7819. ,$ctx2.sendIdx["value:"]=1
  7820. //>>excludeEnd("ctx");
  7821. ][0])){
  7822. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7823. }
  7824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7826. //>>excludeEnd("ctx");
  7827. }));
  7828. return collection;
  7829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7830. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7831. //>>excludeEnd("ctx");
  7832. }; }),
  7833. $globals.Set);
  7834. $core.addMethod(
  7835. $core.method({
  7836. selector: "size",
  7837. protocol: "accessing",
  7838. //>>excludeStart("ide", pragmas.excludeIdeData);
  7839. args: [],
  7840. source: "size\x0a\x09^ size",
  7841. referencedClasses: [],
  7842. //>>excludeEnd("ide");
  7843. pragmas: [],
  7844. messageSends: []
  7845. }, function ($methodClass){ return function (){
  7846. var self=this,$self=this;
  7847. return $self.size;
  7848. }; }),
  7849. $globals.Set);
  7850. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7851. //>>excludeStart("ide", pragmas.excludeIdeData);
  7852. $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.";
  7853. //>>excludeEnd("ide");
  7854. $core.addMethod(
  7855. $core.method({
  7856. selector: "<<",
  7857. protocol: "writing",
  7858. //>>excludeStart("ide", pragmas.excludeIdeData);
  7859. args: ["anObject"],
  7860. source: "<< anObject\x0a\x09self write: anObject",
  7861. referencedClasses: [],
  7862. //>>excludeEnd("ide");
  7863. pragmas: [],
  7864. messageSends: ["write:"]
  7865. }, function ($methodClass){ return function (anObject){
  7866. var self=this,$self=this;
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. return $core.withContext(function($ctx1) {
  7869. //>>excludeEnd("ctx");
  7870. $self._write_(anObject);
  7871. return self;
  7872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7873. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7874. //>>excludeEnd("ctx");
  7875. }; }),
  7876. $globals.ProtoStream);
  7877. $core.addMethod(
  7878. $core.method({
  7879. selector: "atEnd",
  7880. protocol: "testing",
  7881. //>>excludeStart("ide", pragmas.excludeIdeData);
  7882. args: [],
  7883. source: "atEnd\x0a\x09self subclassResponsibility",
  7884. referencedClasses: [],
  7885. //>>excludeEnd("ide");
  7886. pragmas: [],
  7887. messageSends: ["subclassResponsibility"]
  7888. }, function ($methodClass){ return function (){
  7889. var self=this,$self=this;
  7890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7891. return $core.withContext(function($ctx1) {
  7892. //>>excludeEnd("ctx");
  7893. $self._subclassResponsibility();
  7894. return self;
  7895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7896. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7897. //>>excludeEnd("ctx");
  7898. }; }),
  7899. $globals.ProtoStream);
  7900. $core.addMethod(
  7901. $core.method({
  7902. selector: "atStart",
  7903. protocol: "testing",
  7904. //>>excludeStart("ide", pragmas.excludeIdeData);
  7905. args: [],
  7906. source: "atStart\x0a\x09self subclassResponsibility",
  7907. referencedClasses: [],
  7908. //>>excludeEnd("ide");
  7909. pragmas: [],
  7910. messageSends: ["subclassResponsibility"]
  7911. }, function ($methodClass){ return function (){
  7912. var self=this,$self=this;
  7913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7914. return $core.withContext(function($ctx1) {
  7915. //>>excludeEnd("ctx");
  7916. $self._subclassResponsibility();
  7917. return self;
  7918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7919. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7920. //>>excludeEnd("ctx");
  7921. }; }),
  7922. $globals.ProtoStream);
  7923. $core.addMethod(
  7924. $core.method({
  7925. selector: "contents",
  7926. protocol: "accessing",
  7927. //>>excludeStart("ide", pragmas.excludeIdeData);
  7928. args: [],
  7929. source: "contents\x0a\x09self subclassResponsibility",
  7930. referencedClasses: [],
  7931. //>>excludeEnd("ide");
  7932. pragmas: [],
  7933. messageSends: ["subclassResponsibility"]
  7934. }, function ($methodClass){ return function (){
  7935. var self=this,$self=this;
  7936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7937. return $core.withContext(function($ctx1) {
  7938. //>>excludeEnd("ctx");
  7939. $self._subclassResponsibility();
  7940. return self;
  7941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7942. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7943. //>>excludeEnd("ctx");
  7944. }; }),
  7945. $globals.ProtoStream);
  7946. $core.addMethod(
  7947. $core.method({
  7948. selector: "do:",
  7949. protocol: "enumerating",
  7950. //>>excludeStart("ide", pragmas.excludeIdeData);
  7951. args: ["aBlock"],
  7952. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7953. referencedClasses: [],
  7954. //>>excludeEnd("ide");
  7955. pragmas: [],
  7956. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7957. }, function ($methodClass){ return function (aBlock){
  7958. var self=this,$self=this;
  7959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7960. return $core.withContext(function($ctx1) {
  7961. //>>excludeEnd("ctx");
  7962. $recv((function(){
  7963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7964. return $core.withContext(function($ctx2) {
  7965. //>>excludeEnd("ctx");
  7966. return $self._atEnd();
  7967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7969. //>>excludeEnd("ctx");
  7970. }))._whileFalse_((function(){
  7971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7972. return $core.withContext(function($ctx2) {
  7973. //>>excludeEnd("ctx");
  7974. return $recv(aBlock)._value_($self._next());
  7975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7977. //>>excludeEnd("ctx");
  7978. }));
  7979. return self;
  7980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7981. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7982. //>>excludeEnd("ctx");
  7983. }; }),
  7984. $globals.ProtoStream);
  7985. $core.addMethod(
  7986. $core.method({
  7987. selector: "isEmpty",
  7988. protocol: "testing",
  7989. //>>excludeStart("ide", pragmas.excludeIdeData);
  7990. args: [],
  7991. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7992. referencedClasses: [],
  7993. //>>excludeEnd("ide");
  7994. pragmas: [],
  7995. messageSends: ["and:", "atStart", "atEnd"]
  7996. }, function ($methodClass){ return function (){
  7997. var self=this,$self=this;
  7998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7999. return $core.withContext(function($ctx1) {
  8000. //>>excludeEnd("ctx");
  8001. return $recv($self._atStart())._and_((function(){
  8002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8003. return $core.withContext(function($ctx2) {
  8004. //>>excludeEnd("ctx");
  8005. return $self._atEnd();
  8006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8008. //>>excludeEnd("ctx");
  8009. }));
  8010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8011. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8012. //>>excludeEnd("ctx");
  8013. }; }),
  8014. $globals.ProtoStream);
  8015. $core.addMethod(
  8016. $core.method({
  8017. selector: "next",
  8018. protocol: "reading",
  8019. //>>excludeStart("ide", pragmas.excludeIdeData);
  8020. args: [],
  8021. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8022. referencedClasses: [],
  8023. //>>excludeEnd("ide");
  8024. pragmas: [],
  8025. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8026. }, function ($methodClass){ return function (){
  8027. var self=this,$self=this;
  8028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8029. return $core.withContext(function($ctx1) {
  8030. //>>excludeEnd("ctx");
  8031. if($core.assert($self._atEnd())){
  8032. return nil;
  8033. } else {
  8034. return $self._subclassResponsibility();
  8035. }
  8036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8037. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8038. //>>excludeEnd("ctx");
  8039. }; }),
  8040. $globals.ProtoStream);
  8041. $core.addMethod(
  8042. $core.method({
  8043. selector: "nextPut:",
  8044. protocol: "writing",
  8045. //>>excludeStart("ide", pragmas.excludeIdeData);
  8046. args: ["anObject"],
  8047. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8048. referencedClasses: [],
  8049. //>>excludeEnd("ide");
  8050. pragmas: [],
  8051. messageSends: ["subclassResponsibility"]
  8052. }, function ($methodClass){ return function (anObject){
  8053. var self=this,$self=this;
  8054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8055. return $core.withContext(function($ctx1) {
  8056. //>>excludeEnd("ctx");
  8057. $self._subclassResponsibility();
  8058. return self;
  8059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8060. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8061. //>>excludeEnd("ctx");
  8062. }; }),
  8063. $globals.ProtoStream);
  8064. $core.addMethod(
  8065. $core.method({
  8066. selector: "nextPutAll:",
  8067. protocol: "writing",
  8068. //>>excludeStart("ide", pragmas.excludeIdeData);
  8069. args: ["aCollection"],
  8070. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8071. referencedClasses: [],
  8072. //>>excludeEnd("ide");
  8073. pragmas: [],
  8074. messageSends: ["do:", "nextPut:"]
  8075. }, function ($methodClass){ return function (aCollection){
  8076. var self=this,$self=this;
  8077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8078. return $core.withContext(function($ctx1) {
  8079. //>>excludeEnd("ctx");
  8080. $recv(aCollection)._do_((function(each){
  8081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8082. return $core.withContext(function($ctx2) {
  8083. //>>excludeEnd("ctx");
  8084. return $self._nextPut_(each);
  8085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8087. //>>excludeEnd("ctx");
  8088. }));
  8089. return self;
  8090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8091. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  8092. //>>excludeEnd("ctx");
  8093. }; }),
  8094. $globals.ProtoStream);
  8095. $core.addMethod(
  8096. $core.method({
  8097. selector: "nextPutString:",
  8098. protocol: "writing",
  8099. //>>excludeStart("ide", pragmas.excludeIdeData);
  8100. args: ["aString"],
  8101. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8102. referencedClasses: [],
  8103. //>>excludeEnd("ide");
  8104. pragmas: [],
  8105. messageSends: ["nextPut:"]
  8106. }, function ($methodClass){ return function (aString){
  8107. var self=this,$self=this;
  8108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8109. return $core.withContext(function($ctx1) {
  8110. //>>excludeEnd("ctx");
  8111. $self._nextPut_(aString);
  8112. return self;
  8113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8114. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8115. //>>excludeEnd("ctx");
  8116. }; }),
  8117. $globals.ProtoStream);
  8118. $core.addMethod(
  8119. $core.method({
  8120. selector: "peek",
  8121. protocol: "reading",
  8122. //>>excludeStart("ide", pragmas.excludeIdeData);
  8123. args: [],
  8124. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8125. referencedClasses: [],
  8126. //>>excludeEnd("ide");
  8127. pragmas: [],
  8128. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8129. }, function ($methodClass){ return function (){
  8130. var self=this,$self=this;
  8131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8132. return $core.withContext(function($ctx1) {
  8133. //>>excludeEnd("ctx");
  8134. if($core.assert($self._atEnd())){
  8135. return nil;
  8136. } else {
  8137. return $self._subclassResponsibility();
  8138. }
  8139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8140. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8141. //>>excludeEnd("ctx");
  8142. }; }),
  8143. $globals.ProtoStream);
  8144. $core.addMethod(
  8145. $core.method({
  8146. selector: "reset",
  8147. protocol: "actions",
  8148. //>>excludeStart("ide", pragmas.excludeIdeData);
  8149. args: [],
  8150. source: "reset\x0a\x09self subclassResponsibility",
  8151. referencedClasses: [],
  8152. //>>excludeEnd("ide");
  8153. pragmas: [],
  8154. messageSends: ["subclassResponsibility"]
  8155. }, function ($methodClass){ return function (){
  8156. var self=this,$self=this;
  8157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8158. return $core.withContext(function($ctx1) {
  8159. //>>excludeEnd("ctx");
  8160. $self._subclassResponsibility();
  8161. return self;
  8162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8163. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8164. //>>excludeEnd("ctx");
  8165. }; }),
  8166. $globals.ProtoStream);
  8167. $core.addMethod(
  8168. $core.method({
  8169. selector: "resetContents",
  8170. protocol: "actions",
  8171. //>>excludeStart("ide", pragmas.excludeIdeData);
  8172. args: [],
  8173. source: "resetContents\x0a\x09self subclassResponsibility",
  8174. referencedClasses: [],
  8175. //>>excludeEnd("ide");
  8176. pragmas: [],
  8177. messageSends: ["subclassResponsibility"]
  8178. }, function ($methodClass){ return function (){
  8179. var self=this,$self=this;
  8180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8181. return $core.withContext(function($ctx1) {
  8182. //>>excludeEnd("ctx");
  8183. $self._subclassResponsibility();
  8184. return self;
  8185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8186. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8187. //>>excludeEnd("ctx");
  8188. }; }),
  8189. $globals.ProtoStream);
  8190. $core.addMethod(
  8191. $core.method({
  8192. selector: "setToEnd",
  8193. protocol: "positioning",
  8194. //>>excludeStart("ide", pragmas.excludeIdeData);
  8195. args: [],
  8196. source: "setToEnd\x0a\x09self subclassResponsibility",
  8197. referencedClasses: [],
  8198. //>>excludeEnd("ide");
  8199. pragmas: [],
  8200. messageSends: ["subclassResponsibility"]
  8201. }, function ($methodClass){ return function (){
  8202. var self=this,$self=this;
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. return $core.withContext(function($ctx1) {
  8205. //>>excludeEnd("ctx");
  8206. $self._subclassResponsibility();
  8207. return self;
  8208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8209. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8210. //>>excludeEnd("ctx");
  8211. }; }),
  8212. $globals.ProtoStream);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "setToStart",
  8216. protocol: "positioning",
  8217. //>>excludeStart("ide", pragmas.excludeIdeData);
  8218. args: [],
  8219. source: "setToStart\x0a\x09self reset",
  8220. referencedClasses: [],
  8221. //>>excludeEnd("ide");
  8222. pragmas: [],
  8223. messageSends: ["reset"]
  8224. }, function ($methodClass){ return function (){
  8225. var self=this,$self=this;
  8226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8227. return $core.withContext(function($ctx1) {
  8228. //>>excludeEnd("ctx");
  8229. $self._reset();
  8230. return self;
  8231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8232. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8233. //>>excludeEnd("ctx");
  8234. }; }),
  8235. $globals.ProtoStream);
  8236. $core.addMethod(
  8237. $core.method({
  8238. selector: "write:",
  8239. protocol: "writing",
  8240. //>>excludeStart("ide", pragmas.excludeIdeData);
  8241. args: ["anObject"],
  8242. source: "write: anObject\x0a\x09anObject putOn: self",
  8243. referencedClasses: [],
  8244. //>>excludeEnd("ide");
  8245. pragmas: [],
  8246. messageSends: ["putOn:"]
  8247. }, function ($methodClass){ return function (anObject){
  8248. var self=this,$self=this;
  8249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8250. return $core.withContext(function($ctx1) {
  8251. //>>excludeEnd("ctx");
  8252. $recv(anObject)._putOn_(self);
  8253. return self;
  8254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8255. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8256. //>>excludeEnd("ctx");
  8257. }; }),
  8258. $globals.ProtoStream);
  8259. $core.addMethod(
  8260. $core.method({
  8261. selector: "on:",
  8262. protocol: "instance creation",
  8263. //>>excludeStart("ide", pragmas.excludeIdeData);
  8264. args: ["aCollection"],
  8265. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8266. referencedClasses: [],
  8267. //>>excludeEnd("ide");
  8268. pragmas: [],
  8269. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8270. }, function ($methodClass){ return function (aCollection){
  8271. var self=this,$self=this;
  8272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8273. return $core.withContext(function($ctx1) {
  8274. //>>excludeEnd("ctx");
  8275. var $1;
  8276. $1=$self._new();
  8277. $recv($1)._setCollection_(aCollection);
  8278. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8279. return $recv($1)._yourself();
  8280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8281. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8282. //>>excludeEnd("ctx");
  8283. }; }),
  8284. $globals.ProtoStream.a$cls);
  8285. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8286. //>>excludeStart("ide", pragmas.excludeIdeData);
  8287. $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.";
  8288. //>>excludeEnd("ide");
  8289. $core.addMethod(
  8290. $core.method({
  8291. selector: "atEnd",
  8292. protocol: "testing",
  8293. //>>excludeStart("ide", pragmas.excludeIdeData);
  8294. args: [],
  8295. source: "atEnd\x0a\x09^ self position = self size",
  8296. referencedClasses: [],
  8297. //>>excludeEnd("ide");
  8298. pragmas: [],
  8299. messageSends: ["=", "position", "size"]
  8300. }, function ($methodClass){ return function (){
  8301. var self=this,$self=this;
  8302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8303. return $core.withContext(function($ctx1) {
  8304. //>>excludeEnd("ctx");
  8305. return $recv($self._position()).__eq($self._size());
  8306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8307. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8308. //>>excludeEnd("ctx");
  8309. }; }),
  8310. $globals.Stream);
  8311. $core.addMethod(
  8312. $core.method({
  8313. selector: "atStart",
  8314. protocol: "testing",
  8315. //>>excludeStart("ide", pragmas.excludeIdeData);
  8316. args: [],
  8317. source: "atStart\x0a\x09^ self position = 0",
  8318. referencedClasses: [],
  8319. //>>excludeEnd("ide");
  8320. pragmas: [],
  8321. messageSends: ["=", "position"]
  8322. }, function ($methodClass){ return function (){
  8323. var self=this,$self=this;
  8324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8325. return $core.withContext(function($ctx1) {
  8326. //>>excludeEnd("ctx");
  8327. return $recv($self._position()).__eq((0));
  8328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8329. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8330. //>>excludeEnd("ctx");
  8331. }; }),
  8332. $globals.Stream);
  8333. $core.addMethod(
  8334. $core.method({
  8335. selector: "close",
  8336. protocol: "actions",
  8337. //>>excludeStart("ide", pragmas.excludeIdeData);
  8338. args: [],
  8339. source: "close",
  8340. referencedClasses: [],
  8341. //>>excludeEnd("ide");
  8342. pragmas: [],
  8343. messageSends: []
  8344. }, function ($methodClass){ return function (){
  8345. var self=this,$self=this;
  8346. return self;
  8347. }; }),
  8348. $globals.Stream);
  8349. $core.addMethod(
  8350. $core.method({
  8351. selector: "collection",
  8352. protocol: "accessing",
  8353. //>>excludeStart("ide", pragmas.excludeIdeData);
  8354. args: [],
  8355. source: "collection\x0a\x09^ collection",
  8356. referencedClasses: [],
  8357. //>>excludeEnd("ide");
  8358. pragmas: [],
  8359. messageSends: []
  8360. }, function ($methodClass){ return function (){
  8361. var self=this,$self=this;
  8362. return $self.collection;
  8363. }; }),
  8364. $globals.Stream);
  8365. $core.addMethod(
  8366. $core.method({
  8367. selector: "contents",
  8368. protocol: "accessing",
  8369. //>>excludeStart("ide", pragmas.excludeIdeData);
  8370. args: [],
  8371. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8372. referencedClasses: [],
  8373. //>>excludeEnd("ide");
  8374. pragmas: [],
  8375. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8376. }, function ($methodClass){ return function (){
  8377. var self=this,$self=this;
  8378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8379. return $core.withContext(function($ctx1) {
  8380. //>>excludeEnd("ctx");
  8381. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8383. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8384. //>>excludeEnd("ctx");
  8385. }; }),
  8386. $globals.Stream);
  8387. $core.addMethod(
  8388. $core.method({
  8389. selector: "flush",
  8390. protocol: "actions",
  8391. //>>excludeStart("ide", pragmas.excludeIdeData);
  8392. args: [],
  8393. source: "flush",
  8394. referencedClasses: [],
  8395. //>>excludeEnd("ide");
  8396. pragmas: [],
  8397. messageSends: []
  8398. }, function ($methodClass){ return function (){
  8399. var self=this,$self=this;
  8400. return self;
  8401. }; }),
  8402. $globals.Stream);
  8403. $core.addMethod(
  8404. $core.method({
  8405. selector: "isEmpty",
  8406. protocol: "testing",
  8407. //>>excludeStart("ide", pragmas.excludeIdeData);
  8408. args: [],
  8409. source: "isEmpty\x0a\x09^ self size = 0",
  8410. referencedClasses: [],
  8411. //>>excludeEnd("ide");
  8412. pragmas: [],
  8413. messageSends: ["=", "size"]
  8414. }, function ($methodClass){ return function (){
  8415. var self=this,$self=this;
  8416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8417. return $core.withContext(function($ctx1) {
  8418. //>>excludeEnd("ctx");
  8419. return $recv($self._size()).__eq((0));
  8420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8421. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8422. //>>excludeEnd("ctx");
  8423. }; }),
  8424. $globals.Stream);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "next",
  8428. protocol: "reading",
  8429. //>>excludeStart("ide", pragmas.excludeIdeData);
  8430. args: [],
  8431. 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 ]",
  8432. referencedClasses: [],
  8433. //>>excludeEnd("ide");
  8434. pragmas: [],
  8435. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8436. }, function ($methodClass){ return function (){
  8437. var self=this,$self=this;
  8438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8439. return $core.withContext(function($ctx1) {
  8440. //>>excludeEnd("ctx");
  8441. if($core.assert($self._atEnd())){
  8442. return nil;
  8443. } else {
  8444. $self._position_($recv([$self._position()
  8445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8446. ,$ctx1.sendIdx["position"]=1
  8447. //>>excludeEnd("ctx");
  8448. ][0]).__plus((1)));
  8449. return $recv($self.collection)._at_($self._position());
  8450. }
  8451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8452. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8453. //>>excludeEnd("ctx");
  8454. }; }),
  8455. $globals.Stream);
  8456. $core.addMethod(
  8457. $core.method({
  8458. selector: "next:",
  8459. protocol: "reading",
  8460. //>>excludeStart("ide", pragmas.excludeIdeData);
  8461. args: ["anInteger"],
  8462. 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",
  8463. referencedClasses: [],
  8464. //>>excludeEnd("ide");
  8465. pragmas: [],
  8466. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8467. }, function ($methodClass){ return function (anInteger){
  8468. var self=this,$self=this;
  8469. var tempCollection;
  8470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8471. return $core.withContext(function($ctx1) {
  8472. //>>excludeEnd("ctx");
  8473. tempCollection=$recv($recv($self._collection())._class())._new();
  8474. $recv(anInteger)._timesRepeat_((function(){
  8475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8476. return $core.withContext(function($ctx2) {
  8477. //>>excludeEnd("ctx");
  8478. if(!$core.assert($self._atEnd())){
  8479. return $recv(tempCollection)._add_($self._next());
  8480. }
  8481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8483. //>>excludeEnd("ctx");
  8484. }));
  8485. return tempCollection;
  8486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8487. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8488. //>>excludeEnd("ctx");
  8489. }; }),
  8490. $globals.Stream);
  8491. $core.addMethod(
  8492. $core.method({
  8493. selector: "nextPut:",
  8494. protocol: "writing",
  8495. //>>excludeStart("ide", pragmas.excludeIdeData);
  8496. args: ["anObject"],
  8497. 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)",
  8498. referencedClasses: [],
  8499. //>>excludeEnd("ide");
  8500. pragmas: [],
  8501. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8502. }, function ($methodClass){ return function (anObject){
  8503. var self=this,$self=this;
  8504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8505. return $core.withContext(function($ctx1) {
  8506. //>>excludeEnd("ctx");
  8507. $self._position_($recv([$self._position()
  8508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8509. ,$ctx1.sendIdx["position"]=1
  8510. //>>excludeEnd("ctx");
  8511. ][0]).__plus((1)));
  8512. $recv($self._collection())._at_put_([$self._position()
  8513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8514. ,$ctx1.sendIdx["position"]=2
  8515. //>>excludeEnd("ctx");
  8516. ][0],anObject);
  8517. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8518. return self;
  8519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8520. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8521. //>>excludeEnd("ctx");
  8522. }; }),
  8523. $globals.Stream);
  8524. $core.addMethod(
  8525. $core.method({
  8526. selector: "peek",
  8527. protocol: "reading",
  8528. //>>excludeStart("ide", pragmas.excludeIdeData);
  8529. args: [],
  8530. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8531. referencedClasses: [],
  8532. //>>excludeEnd("ide");
  8533. pragmas: [],
  8534. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8535. }, function ($methodClass){ return function (){
  8536. var self=this,$self=this;
  8537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8538. return $core.withContext(function($ctx1) {
  8539. //>>excludeEnd("ctx");
  8540. if(!$core.assert($self._atEnd())){
  8541. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8542. }
  8543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8544. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8545. //>>excludeEnd("ctx");
  8546. }; }),
  8547. $globals.Stream);
  8548. $core.addMethod(
  8549. $core.method({
  8550. selector: "position",
  8551. protocol: "accessing",
  8552. //>>excludeStart("ide", pragmas.excludeIdeData);
  8553. args: [],
  8554. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8555. referencedClasses: [],
  8556. //>>excludeEnd("ide");
  8557. pragmas: [],
  8558. messageSends: ["ifNil:"]
  8559. }, function ($methodClass){ return function (){
  8560. var self=this,$self=this;
  8561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8562. return $core.withContext(function($ctx1) {
  8563. //>>excludeEnd("ctx");
  8564. var $1;
  8565. $1=$self.position;
  8566. if($1 == null || $1.a$nil){
  8567. $self.position=(0);
  8568. return $self.position;
  8569. } else {
  8570. return $1;
  8571. }
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8574. //>>excludeEnd("ctx");
  8575. }; }),
  8576. $globals.Stream);
  8577. $core.addMethod(
  8578. $core.method({
  8579. selector: "position:",
  8580. protocol: "accessing",
  8581. //>>excludeStart("ide", pragmas.excludeIdeData);
  8582. args: ["anInteger"],
  8583. source: "position: anInteger\x0a\x09position := anInteger",
  8584. referencedClasses: [],
  8585. //>>excludeEnd("ide");
  8586. pragmas: [],
  8587. messageSends: []
  8588. }, function ($methodClass){ return function (anInteger){
  8589. var self=this,$self=this;
  8590. $self.position=anInteger;
  8591. return self;
  8592. }; }),
  8593. $globals.Stream);
  8594. $core.addMethod(
  8595. $core.method({
  8596. selector: "reset",
  8597. protocol: "actions",
  8598. //>>excludeStart("ide", pragmas.excludeIdeData);
  8599. args: [],
  8600. source: "reset\x0a\x09self position: 0",
  8601. referencedClasses: [],
  8602. //>>excludeEnd("ide");
  8603. pragmas: [],
  8604. messageSends: ["position:"]
  8605. }, function ($methodClass){ return function (){
  8606. var self=this,$self=this;
  8607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8608. return $core.withContext(function($ctx1) {
  8609. //>>excludeEnd("ctx");
  8610. $self._position_((0));
  8611. return self;
  8612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8613. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8614. //>>excludeEnd("ctx");
  8615. }; }),
  8616. $globals.Stream);
  8617. $core.addMethod(
  8618. $core.method({
  8619. selector: "resetContents",
  8620. protocol: "actions",
  8621. //>>excludeStart("ide", pragmas.excludeIdeData);
  8622. args: [],
  8623. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8624. referencedClasses: [],
  8625. //>>excludeEnd("ide");
  8626. pragmas: [],
  8627. messageSends: ["reset", "setStreamSize:"]
  8628. }, function ($methodClass){ return function (){
  8629. var self=this,$self=this;
  8630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8631. return $core.withContext(function($ctx1) {
  8632. //>>excludeEnd("ctx");
  8633. $self._reset();
  8634. $self._setStreamSize_((0));
  8635. return self;
  8636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8637. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8638. //>>excludeEnd("ctx");
  8639. }; }),
  8640. $globals.Stream);
  8641. $core.addMethod(
  8642. $core.method({
  8643. selector: "setCollection:",
  8644. protocol: "accessing",
  8645. //>>excludeStart("ide", pragmas.excludeIdeData);
  8646. args: ["aCollection"],
  8647. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8648. referencedClasses: [],
  8649. //>>excludeEnd("ide");
  8650. pragmas: [],
  8651. messageSends: []
  8652. }, function ($methodClass){ return function (aCollection){
  8653. var self=this,$self=this;
  8654. $self.collection=aCollection;
  8655. return self;
  8656. }; }),
  8657. $globals.Stream);
  8658. $core.addMethod(
  8659. $core.method({
  8660. selector: "setStreamSize:",
  8661. protocol: "accessing",
  8662. //>>excludeStart("ide", pragmas.excludeIdeData);
  8663. args: ["anInteger"],
  8664. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8665. referencedClasses: [],
  8666. //>>excludeEnd("ide");
  8667. pragmas: [],
  8668. messageSends: []
  8669. }, function ($methodClass){ return function (anInteger){
  8670. var self=this,$self=this;
  8671. $self.streamSize=anInteger;
  8672. return self;
  8673. }; }),
  8674. $globals.Stream);
  8675. $core.addMethod(
  8676. $core.method({
  8677. selector: "setToEnd",
  8678. protocol: "positioning",
  8679. //>>excludeStart("ide", pragmas.excludeIdeData);
  8680. args: [],
  8681. source: "setToEnd\x0a\x09self position: self size",
  8682. referencedClasses: [],
  8683. //>>excludeEnd("ide");
  8684. pragmas: [],
  8685. messageSends: ["position:", "size"]
  8686. }, function ($methodClass){ return function (){
  8687. var self=this,$self=this;
  8688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8689. return $core.withContext(function($ctx1) {
  8690. //>>excludeEnd("ctx");
  8691. $self._position_($self._size());
  8692. return self;
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8695. //>>excludeEnd("ctx");
  8696. }; }),
  8697. $globals.Stream);
  8698. $core.addMethod(
  8699. $core.method({
  8700. selector: "size",
  8701. protocol: "accessing",
  8702. //>>excludeStart("ide", pragmas.excludeIdeData);
  8703. args: [],
  8704. source: "size\x0a\x09^ self streamSize",
  8705. referencedClasses: [],
  8706. //>>excludeEnd("ide");
  8707. pragmas: [],
  8708. messageSends: ["streamSize"]
  8709. }, function ($methodClass){ return function (){
  8710. var self=this,$self=this;
  8711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8712. return $core.withContext(function($ctx1) {
  8713. //>>excludeEnd("ctx");
  8714. return $self._streamSize();
  8715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8716. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8717. //>>excludeEnd("ctx");
  8718. }; }),
  8719. $globals.Stream);
  8720. $core.addMethod(
  8721. $core.method({
  8722. selector: "skip:",
  8723. protocol: "positioning",
  8724. //>>excludeStart("ide", pragmas.excludeIdeData);
  8725. args: ["anInteger"],
  8726. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8727. referencedClasses: [],
  8728. //>>excludeEnd("ide");
  8729. pragmas: [],
  8730. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8731. }, function ($methodClass){ return function (anInteger){
  8732. var self=this,$self=this;
  8733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8734. return $core.withContext(function($ctx1) {
  8735. //>>excludeEnd("ctx");
  8736. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8737. return self;
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8740. //>>excludeEnd("ctx");
  8741. }; }),
  8742. $globals.Stream);
  8743. $core.addMethod(
  8744. $core.method({
  8745. selector: "streamSize",
  8746. protocol: "accessing",
  8747. //>>excludeStart("ide", pragmas.excludeIdeData);
  8748. args: [],
  8749. source: "streamSize\x0a\x09^ streamSize",
  8750. referencedClasses: [],
  8751. //>>excludeEnd("ide");
  8752. pragmas: [],
  8753. messageSends: []
  8754. }, function ($methodClass){ return function (){
  8755. var self=this,$self=this;
  8756. return $self.streamSize;
  8757. }; }),
  8758. $globals.Stream);
  8759. $core.addMethod(
  8760. $core.method({
  8761. selector: "on:",
  8762. protocol: "instance creation",
  8763. //>>excludeStart("ide", pragmas.excludeIdeData);
  8764. args: ["aCollection"],
  8765. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8766. referencedClasses: [],
  8767. //>>excludeEnd("ide");
  8768. pragmas: [],
  8769. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8770. }, function ($methodClass){ return function (aCollection){
  8771. var self=this,$self=this;
  8772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8773. return $core.withContext(function($ctx1) {
  8774. //>>excludeEnd("ctx");
  8775. var $1;
  8776. $1=$self._new();
  8777. $recv($1)._setCollection_(aCollection);
  8778. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8779. return $recv($1)._yourself();
  8780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8781. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8782. //>>excludeEnd("ctx");
  8783. }; }),
  8784. $globals.Stream.a$cls);
  8785. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8786. //>>excludeStart("ide", pragmas.excludeIdeData);
  8787. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8788. //>>excludeEnd("ide");
  8789. $core.addMethod(
  8790. $core.method({
  8791. selector: "cr",
  8792. protocol: "writing",
  8793. //>>excludeStart("ide", pragmas.excludeIdeData);
  8794. args: [],
  8795. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8796. referencedClasses: ["String"],
  8797. //>>excludeEnd("ide");
  8798. pragmas: [],
  8799. messageSends: ["nextPutAll:", "cr"]
  8800. }, function ($methodClass){ return function (){
  8801. var self=this,$self=this;
  8802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8803. return $core.withContext(function($ctx1) {
  8804. //>>excludeEnd("ctx");
  8805. return $self._nextPutAll_($recv($globals.String)._cr());
  8806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8807. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8808. //>>excludeEnd("ctx");
  8809. }; }),
  8810. $globals.StringStream);
  8811. $core.addMethod(
  8812. $core.method({
  8813. selector: "crlf",
  8814. protocol: "writing",
  8815. //>>excludeStart("ide", pragmas.excludeIdeData);
  8816. args: [],
  8817. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8818. referencedClasses: ["String"],
  8819. //>>excludeEnd("ide");
  8820. pragmas: [],
  8821. messageSends: ["nextPutAll:", "crlf"]
  8822. }, function ($methodClass){ return function (){
  8823. var self=this,$self=this;
  8824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8825. return $core.withContext(function($ctx1) {
  8826. //>>excludeEnd("ctx");
  8827. return $self._nextPutAll_($recv($globals.String)._crlf());
  8828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8829. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8830. //>>excludeEnd("ctx");
  8831. }; }),
  8832. $globals.StringStream);
  8833. $core.addMethod(
  8834. $core.method({
  8835. selector: "lf",
  8836. protocol: "writing",
  8837. //>>excludeStart("ide", pragmas.excludeIdeData);
  8838. args: [],
  8839. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8840. referencedClasses: ["String"],
  8841. //>>excludeEnd("ide");
  8842. pragmas: [],
  8843. messageSends: ["nextPutAll:", "lf"]
  8844. }, function ($methodClass){ return function (){
  8845. var self=this,$self=this;
  8846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8847. return $core.withContext(function($ctx1) {
  8848. //>>excludeEnd("ctx");
  8849. return $self._nextPutAll_($recv($globals.String)._lf());
  8850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8851. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8852. //>>excludeEnd("ctx");
  8853. }; }),
  8854. $globals.StringStream);
  8855. $core.addMethod(
  8856. $core.method({
  8857. selector: "next:",
  8858. protocol: "reading",
  8859. //>>excludeStart("ide", pragmas.excludeIdeData);
  8860. args: ["anInteger"],
  8861. 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",
  8862. referencedClasses: [],
  8863. //>>excludeEnd("ide");
  8864. pragmas: [],
  8865. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8866. }, function ($methodClass){ return function (anInteger){
  8867. var self=this,$self=this;
  8868. var tempCollection;
  8869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8870. return $core.withContext(function($ctx1) {
  8871. //>>excludeEnd("ctx");
  8872. tempCollection=$recv($recv($self._collection())._class())._new();
  8873. $recv(anInteger)._timesRepeat_((function(){
  8874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8875. return $core.withContext(function($ctx2) {
  8876. //>>excludeEnd("ctx");
  8877. if(!$core.assert($self._atEnd())){
  8878. tempCollection=$recv(tempCollection).__comma($self._next());
  8879. return tempCollection;
  8880. }
  8881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8883. //>>excludeEnd("ctx");
  8884. }));
  8885. return tempCollection;
  8886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8887. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8888. //>>excludeEnd("ctx");
  8889. }; }),
  8890. $globals.StringStream);
  8891. $core.addMethod(
  8892. $core.method({
  8893. selector: "nextPut:",
  8894. protocol: "writing",
  8895. //>>excludeStart("ide", pragmas.excludeIdeData);
  8896. args: ["aString"],
  8897. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8898. referencedClasses: [],
  8899. //>>excludeEnd("ide");
  8900. pragmas: [],
  8901. messageSends: ["nextPutAll:"]
  8902. }, function ($methodClass){ return function (aString){
  8903. var self=this,$self=this;
  8904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8905. return $core.withContext(function($ctx1) {
  8906. //>>excludeEnd("ctx");
  8907. $self._nextPutAll_(aString);
  8908. return self;
  8909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8910. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8911. //>>excludeEnd("ctx");
  8912. }; }),
  8913. $globals.StringStream);
  8914. $core.addMethod(
  8915. $core.method({
  8916. selector: "nextPutAll:",
  8917. protocol: "writing",
  8918. //>>excludeStart("ide", pragmas.excludeIdeData);
  8919. args: ["aString"],
  8920. 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)",
  8921. referencedClasses: [],
  8922. //>>excludeEnd("ide");
  8923. pragmas: [],
  8924. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8925. }, function ($methodClass){ return function (aString){
  8926. var self=this,$self=this;
  8927. var pre,post;
  8928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8929. return $core.withContext(function($ctx1) {
  8930. //>>excludeEnd("ctx");
  8931. if($core.assert($recv([$self._position()
  8932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8933. ,$ctx1.sendIdx["position"]=1
  8934. //>>excludeEnd("ctx");
  8935. ][0]).__eq([$recv([$self._collection()
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. ,$ctx1.sendIdx["collection"]=1
  8938. //>>excludeEnd("ctx");
  8939. ][0])._size()
  8940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8941. ,$ctx1.sendIdx["size"]=1
  8942. //>>excludeEnd("ctx");
  8943. ][0]))){
  8944. [$self._setCollection_([$recv([$self._collection()
  8945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8946. ,$ctx1.sendIdx["collection"]=2
  8947. //>>excludeEnd("ctx");
  8948. ][0]).__comma(aString)
  8949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8950. ,$ctx1.sendIdx[","]=1
  8951. //>>excludeEnd("ctx");
  8952. ][0])
  8953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8954. ,$ctx1.sendIdx["setCollection:"]=1
  8955. //>>excludeEnd("ctx");
  8956. ][0];
  8957. } else {
  8958. pre=[$recv([$self._collection()
  8959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8960. ,$ctx1.sendIdx["collection"]=3
  8961. //>>excludeEnd("ctx");
  8962. ][0])._copyFrom_to_((1),[$self._position()
  8963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8964. ,$ctx1.sendIdx["position"]=2
  8965. //>>excludeEnd("ctx");
  8966. ][0])
  8967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8968. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8969. //>>excludeEnd("ctx");
  8970. ][0];
  8971. post=$recv([$self._collection()
  8972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8973. ,$ctx1.sendIdx["collection"]=4
  8974. //>>excludeEnd("ctx");
  8975. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. ,$ctx1.sendIdx["position"]=3
  8978. //>>excludeEnd("ctx");
  8979. ][0]).__plus((1))
  8980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8981. ,$ctx1.sendIdx["+"]=2
  8982. //>>excludeEnd("ctx");
  8983. ][0]).__plus([$recv(aString)._size()
  8984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8985. ,$ctx1.sendIdx["size"]=2
  8986. //>>excludeEnd("ctx");
  8987. ][0])
  8988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8989. ,$ctx1.sendIdx["+"]=1
  8990. //>>excludeEnd("ctx");
  8991. ][0],[$recv($self._collection())._size()
  8992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8993. ,$ctx1.sendIdx["size"]=3
  8994. //>>excludeEnd("ctx");
  8995. ][0]);
  8996. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8998. ,$ctx1.sendIdx[","]=2
  8999. //>>excludeEnd("ctx");
  9000. ][0]);
  9001. }
  9002. $self._position_($recv([$self._position()
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. ,$ctx1.sendIdx["position"]=4
  9005. //>>excludeEnd("ctx");
  9006. ][0]).__plus($recv(aString)._size()));
  9007. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9008. return self;
  9009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9010. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  9011. //>>excludeEnd("ctx");
  9012. }; }),
  9013. $globals.StringStream);
  9014. $core.addMethod(
  9015. $core.method({
  9016. selector: "nextPutString:",
  9017. protocol: "writing",
  9018. //>>excludeStart("ide", pragmas.excludeIdeData);
  9019. args: ["aString"],
  9020. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9021. referencedClasses: [],
  9022. //>>excludeEnd("ide");
  9023. pragmas: [],
  9024. messageSends: ["nextPutAll:"]
  9025. }, function ($methodClass){ return function (aString){
  9026. var self=this,$self=this;
  9027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9028. return $core.withContext(function($ctx1) {
  9029. //>>excludeEnd("ctx");
  9030. $self._nextPutAll_(aString);
  9031. return self;
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  9034. //>>excludeEnd("ctx");
  9035. }; }),
  9036. $globals.StringStream);
  9037. $core.addMethod(
  9038. $core.method({
  9039. selector: "print:",
  9040. protocol: "writing",
  9041. //>>excludeStart("ide", pragmas.excludeIdeData);
  9042. args: ["anObject"],
  9043. source: "print: anObject\x0a\x09anObject printOn: self",
  9044. referencedClasses: [],
  9045. //>>excludeEnd("ide");
  9046. pragmas: [],
  9047. messageSends: ["printOn:"]
  9048. }, function ($methodClass){ return function (anObject){
  9049. var self=this,$self=this;
  9050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9051. return $core.withContext(function($ctx1) {
  9052. //>>excludeEnd("ctx");
  9053. $recv(anObject)._printOn_(self);
  9054. return self;
  9055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9056. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  9057. //>>excludeEnd("ctx");
  9058. }; }),
  9059. $globals.StringStream);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "printSymbol:",
  9063. protocol: "writing",
  9064. //>>excludeStart("ide", pragmas.excludeIdeData);
  9065. args: ["anObject"],
  9066. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9067. referencedClasses: [],
  9068. //>>excludeEnd("ide");
  9069. pragmas: [],
  9070. messageSends: ["asSymbolPrintOn:"]
  9071. }, function ($methodClass){ return function (anObject){
  9072. var self=this,$self=this;
  9073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9074. return $core.withContext(function($ctx1) {
  9075. //>>excludeEnd("ctx");
  9076. $recv(anObject)._asSymbolPrintOn_(self);
  9077. return self;
  9078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9079. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  9080. //>>excludeEnd("ctx");
  9081. }; }),
  9082. $globals.StringStream);
  9083. $core.addMethod(
  9084. $core.method({
  9085. selector: "space",
  9086. protocol: "writing",
  9087. //>>excludeStart("ide", pragmas.excludeIdeData);
  9088. args: [],
  9089. source: "space\x0a\x09self nextPut: ' '",
  9090. referencedClasses: [],
  9091. //>>excludeEnd("ide");
  9092. pragmas: [],
  9093. messageSends: ["nextPut:"]
  9094. }, function ($methodClass){ return function (){
  9095. var self=this,$self=this;
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. return $core.withContext(function($ctx1) {
  9098. //>>excludeEnd("ctx");
  9099. $self._nextPut_(" ");
  9100. return self;
  9101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9102. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  9103. //>>excludeEnd("ctx");
  9104. }; }),
  9105. $globals.StringStream);
  9106. $core.addMethod(
  9107. $core.method({
  9108. selector: "tab",
  9109. protocol: "writing",
  9110. //>>excludeStart("ide", pragmas.excludeIdeData);
  9111. args: [],
  9112. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9113. referencedClasses: ["String"],
  9114. //>>excludeEnd("ide");
  9115. pragmas: [],
  9116. messageSends: ["nextPutAll:", "tab"]
  9117. }, function ($methodClass){ return function (){
  9118. var self=this,$self=this;
  9119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9120. return $core.withContext(function($ctx1) {
  9121. //>>excludeEnd("ctx");
  9122. return $self._nextPutAll_($recv($globals.String)._tab());
  9123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9124. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9125. //>>excludeEnd("ctx");
  9126. }; }),
  9127. $globals.StringStream);
  9128. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9129. //>>excludeStart("ide", pragmas.excludeIdeData);
  9130. $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.";
  9131. //>>excludeEnd("ide");
  9132. $core.addMethod(
  9133. $core.method({
  9134. selector: "initialize",
  9135. protocol: "initialization",
  9136. //>>excludeStart("ide", pragmas.excludeIdeData);
  9137. args: [],
  9138. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9139. referencedClasses: ["OrderedCollection"],
  9140. //>>excludeEnd("ide");
  9141. pragmas: [],
  9142. messageSends: ["initialize", "new"]
  9143. }, function ($methodClass){ return function (){
  9144. var self=this,$self=this;
  9145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9146. return $core.withContext(function($ctx1) {
  9147. //>>excludeEnd("ctx");
  9148. [(
  9149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9150. $ctx1.supercall = true,
  9151. //>>excludeEnd("ctx");
  9152. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9154. ,$ctx1.supercall = false
  9155. //>>excludeEnd("ctx");
  9156. ][0];
  9157. $self.read=[$recv($globals.OrderedCollection)._new()
  9158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9159. ,$ctx1.sendIdx["new"]=1
  9160. //>>excludeEnd("ctx");
  9161. ][0];
  9162. $self.write=$recv($globals.OrderedCollection)._new();
  9163. $self.readIndex=(1);
  9164. return self;
  9165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9166. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9167. //>>excludeEnd("ctx");
  9168. }; }),
  9169. $globals.Queue);
  9170. $core.addMethod(
  9171. $core.method({
  9172. selector: "next",
  9173. protocol: "accessing",
  9174. //>>excludeStart("ide", pragmas.excludeIdeData);
  9175. args: [],
  9176. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9177. referencedClasses: [],
  9178. //>>excludeEnd("ide");
  9179. pragmas: [],
  9180. messageSends: ["nextIfAbsent:", "error:"]
  9181. }, function ($methodClass){ return function (){
  9182. var self=this,$self=this;
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. return $core.withContext(function($ctx1) {
  9185. //>>excludeEnd("ctx");
  9186. return $self._nextIfAbsent_((function(){
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. return $core.withContext(function($ctx2) {
  9189. //>>excludeEnd("ctx");
  9190. return $self._error_("Cannot read from empty Queue.");
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9193. //>>excludeEnd("ctx");
  9194. }));
  9195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9196. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9197. //>>excludeEnd("ctx");
  9198. }; }),
  9199. $globals.Queue);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "nextIfAbsent:",
  9203. protocol: "accessing",
  9204. //>>excludeStart("ide", pragmas.excludeIdeData);
  9205. args: ["aBlock"],
  9206. 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",
  9207. referencedClasses: ["OrderedCollection"],
  9208. //>>excludeEnd("ide");
  9209. pragmas: [],
  9210. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9211. }, function ($methodClass){ return function (aBlock){
  9212. var self=this,$self=this;
  9213. var result;
  9214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9215. return $core.withContext(function($ctx1) {
  9216. //>>excludeEnd("ctx");
  9217. var $early={};
  9218. try {
  9219. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9221. return $core.withContext(function($ctx2) {
  9222. //>>excludeEnd("ctx");
  9223. $recv($self.write)._ifEmpty_((function(){
  9224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9225. return $core.withContext(function($ctx3) {
  9226. //>>excludeEnd("ctx");
  9227. if($core.assert($recv($self.readIndex).__gt((1)))){
  9228. $self.read=[];
  9229. $self.readIndex=(1);
  9230. $self.readIndex;
  9231. }
  9232. throw $early=[$recv(aBlock)._value()];
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9235. //>>excludeEnd("ctx");
  9236. }));
  9237. $self.read=$self.write;
  9238. $self.readIndex=(1);
  9239. $self.write=$recv($globals.OrderedCollection)._new();
  9240. return $recv($self.read)._first();
  9241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9243. //>>excludeEnd("ctx");
  9244. }));
  9245. $recv($self.read)._at_put_($self.readIndex,nil);
  9246. $self.readIndex=$recv($self.readIndex).__plus((1));
  9247. return result;
  9248. }
  9249. catch(e) {if(e===$early)return e[0]; throw e}
  9250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9251. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9252. //>>excludeEnd("ctx");
  9253. }; }),
  9254. $globals.Queue);
  9255. $core.addMethod(
  9256. $core.method({
  9257. selector: "nextPut:",
  9258. protocol: "accessing",
  9259. //>>excludeStart("ide", pragmas.excludeIdeData);
  9260. args: ["anObject"],
  9261. source: "nextPut: anObject\x0a\x09write add: anObject",
  9262. referencedClasses: [],
  9263. //>>excludeEnd("ide");
  9264. pragmas: [],
  9265. messageSends: ["add:"]
  9266. }, function ($methodClass){ return function (anObject){
  9267. var self=this,$self=this;
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. return $core.withContext(function($ctx1) {
  9270. //>>excludeEnd("ctx");
  9271. $recv($self.write)._add_(anObject);
  9272. return self;
  9273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9274. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9275. //>>excludeEnd("ctx");
  9276. }; }),
  9277. $globals.Queue);
  9278. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9279. //>>excludeStart("ide", pragmas.excludeIdeData);
  9280. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9281. //>>excludeEnd("ide");
  9282. $core.addMethod(
  9283. $core.method({
  9284. selector: "compile:",
  9285. protocol: "evaluating",
  9286. //>>excludeStart("ide", pragmas.excludeIdeData);
  9287. args: ["aString"],
  9288. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9289. referencedClasses: [],
  9290. //>>excludeEnd("ide");
  9291. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9292. messageSends: []
  9293. }, function ($methodClass){ return function (aString){
  9294. var self=this,$self=this;
  9295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9296. return $core.withContext(function($ctx1) {
  9297. //>>excludeEnd("ctx");
  9298. return self.compile(aString);
  9299. return self;
  9300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9301. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9302. //>>excludeEnd("ctx");
  9303. }; }),
  9304. $globals.RegularExpression);
  9305. $core.addMethod(
  9306. $core.method({
  9307. selector: "exec:",
  9308. protocol: "evaluating",
  9309. //>>excludeStart("ide", pragmas.excludeIdeData);
  9310. args: ["aString"],
  9311. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9312. referencedClasses: [],
  9313. //>>excludeEnd("ide");
  9314. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9315. messageSends: []
  9316. }, function ($methodClass){ return function (aString){
  9317. var self=this,$self=this;
  9318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9319. return $core.withContext(function($ctx1) {
  9320. //>>excludeEnd("ctx");
  9321. return self.exec(aString) || nil;
  9322. return self;
  9323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9324. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9325. //>>excludeEnd("ctx");
  9326. }; }),
  9327. $globals.RegularExpression);
  9328. $core.addMethod(
  9329. $core.method({
  9330. selector: "test:",
  9331. protocol: "evaluating",
  9332. //>>excludeStart("ide", pragmas.excludeIdeData);
  9333. args: ["aString"],
  9334. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9335. referencedClasses: [],
  9336. //>>excludeEnd("ide");
  9337. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9338. messageSends: []
  9339. }, function ($methodClass){ return function (aString){
  9340. var self=this,$self=this;
  9341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9342. return $core.withContext(function($ctx1) {
  9343. //>>excludeEnd("ctx");
  9344. return self.test(aString);
  9345. return self;
  9346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9347. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9348. //>>excludeEnd("ctx");
  9349. }; }),
  9350. $globals.RegularExpression);
  9351. $core.addMethod(
  9352. $core.method({
  9353. selector: "fromString:",
  9354. protocol: "instance creation",
  9355. //>>excludeStart("ide", pragmas.excludeIdeData);
  9356. args: ["aString"],
  9357. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9358. referencedClasses: [],
  9359. //>>excludeEnd("ide");
  9360. pragmas: [],
  9361. messageSends: ["fromString:flag:"]
  9362. }, function ($methodClass){ return function (aString){
  9363. var self=this,$self=this;
  9364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9365. return $core.withContext(function($ctx1) {
  9366. //>>excludeEnd("ctx");
  9367. return $self._fromString_flag_(aString,"");
  9368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9369. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9370. //>>excludeEnd("ctx");
  9371. }; }),
  9372. $globals.RegularExpression.a$cls);
  9373. $core.addMethod(
  9374. $core.method({
  9375. selector: "fromString:flag:",
  9376. protocol: "instance creation",
  9377. //>>excludeStart("ide", pragmas.excludeIdeData);
  9378. args: ["aString", "anotherString"],
  9379. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9380. referencedClasses: [],
  9381. //>>excludeEnd("ide");
  9382. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9383. messageSends: []
  9384. }, function ($methodClass){ return function (aString,anotherString){
  9385. var self=this,$self=this;
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. return $core.withContext(function($ctx1) {
  9388. //>>excludeEnd("ctx");
  9389. return new RegExp(aString, anotherString);
  9390. return self;
  9391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9392. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9393. //>>excludeEnd("ctx");
  9394. }; }),
  9395. $globals.RegularExpression.a$cls);
  9396. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9397. $core.addMethod(
  9398. $core.method({
  9399. selector: "at:",
  9400. protocol: "accessing",
  9401. //>>excludeStart("ide", pragmas.excludeIdeData);
  9402. args: ["anIndex"],
  9403. 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 ]",
  9404. referencedClasses: [],
  9405. //>>excludeEnd("ide");
  9406. pragmas: [],
  9407. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9408. }, function ($methodClass){ return function (anIndex){
  9409. var self=this,$self=this;
  9410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9411. return $core.withContext(function($ctx1) {
  9412. //>>excludeEnd("ctx");
  9413. return $self._at_ifAbsent_(anIndex,(function(){
  9414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9415. return $core.withContext(function($ctx2) {
  9416. //>>excludeEnd("ctx");
  9417. return $self._errorNotFound();
  9418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9420. //>>excludeEnd("ctx");
  9421. }));
  9422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9423. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9424. //>>excludeEnd("ctx");
  9425. }; }),
  9426. $globals.TKeyValueCollection);
  9427. $core.addMethod(
  9428. $core.method({
  9429. selector: "at:ifAbsent:",
  9430. protocol: "accessing",
  9431. //>>excludeStart("ide", pragmas.excludeIdeData);
  9432. args: ["anIndex", "aBlock"],
  9433. 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",
  9434. referencedClasses: [],
  9435. //>>excludeEnd("ide");
  9436. pragmas: [],
  9437. messageSends: ["subclassResponsibility"]
  9438. }, function ($methodClass){ return function (anIndex,aBlock){
  9439. var self=this,$self=this;
  9440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9441. return $core.withContext(function($ctx1) {
  9442. //>>excludeEnd("ctx");
  9443. $self._subclassResponsibility();
  9444. return self;
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9447. //>>excludeEnd("ctx");
  9448. }; }),
  9449. $globals.TKeyValueCollection);
  9450. $core.addMethod(
  9451. $core.method({
  9452. selector: "at:ifAbsentPut:",
  9453. protocol: "accessing",
  9454. //>>excludeStart("ide", pragmas.excludeIdeData);
  9455. args: ["aKey", "aBlock"],
  9456. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9457. referencedClasses: [],
  9458. //>>excludeEnd("ide");
  9459. pragmas: [],
  9460. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9461. }, function ($methodClass){ return function (aKey,aBlock){
  9462. var self=this,$self=this;
  9463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9464. return $core.withContext(function($ctx1) {
  9465. //>>excludeEnd("ctx");
  9466. return $self._at_ifAbsent_(aKey,(function(){
  9467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9468. return $core.withContext(function($ctx2) {
  9469. //>>excludeEnd("ctx");
  9470. return $self._at_put_(aKey,$recv(aBlock)._value());
  9471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9473. //>>excludeEnd("ctx");
  9474. }));
  9475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9476. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9477. //>>excludeEnd("ctx");
  9478. }; }),
  9479. $globals.TKeyValueCollection);
  9480. $core.addMethod(
  9481. $core.method({
  9482. selector: "at:ifPresent:",
  9483. protocol: "accessing",
  9484. //>>excludeStart("ide", pragmas.excludeIdeData);
  9485. args: ["anIndex", "aBlock"],
  9486. 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 ]",
  9487. referencedClasses: [],
  9488. //>>excludeEnd("ide");
  9489. pragmas: [],
  9490. messageSends: ["at:ifPresent:ifAbsent:"]
  9491. }, function ($methodClass){ return function (anIndex,aBlock){
  9492. var self=this,$self=this;
  9493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9494. return $core.withContext(function($ctx1) {
  9495. //>>excludeEnd("ctx");
  9496. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9497. return nil;
  9498. }));
  9499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9500. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9501. //>>excludeEnd("ctx");
  9502. }; }),
  9503. $globals.TKeyValueCollection);
  9504. $core.addMethod(
  9505. $core.method({
  9506. selector: "at:ifPresent:ifAbsent:",
  9507. protocol: "accessing",
  9508. //>>excludeStart("ide", pragmas.excludeIdeData);
  9509. args: ["anIndex", "aBlock", "anotherBlock"],
  9510. 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",
  9511. referencedClasses: [],
  9512. //>>excludeEnd("ide");
  9513. pragmas: [],
  9514. messageSends: ["subclassResponsibility"]
  9515. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9516. var self=this,$self=this;
  9517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9518. return $core.withContext(function($ctx1) {
  9519. //>>excludeEnd("ctx");
  9520. $self._subclassResponsibility();
  9521. return self;
  9522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9523. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9524. //>>excludeEnd("ctx");
  9525. }; }),
  9526. $globals.TKeyValueCollection);
  9527. $core.addMethod(
  9528. $core.method({
  9529. selector: "at:put:",
  9530. protocol: "accessing",
  9531. //>>excludeStart("ide", pragmas.excludeIdeData);
  9532. args: ["anIndex", "anObject"],
  9533. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9534. referencedClasses: [],
  9535. //>>excludeEnd("ide");
  9536. pragmas: [],
  9537. messageSends: ["subclassResponsibility"]
  9538. }, function ($methodClass){ return function (anIndex,anObject){
  9539. var self=this,$self=this;
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. return $core.withContext(function($ctx1) {
  9542. //>>excludeEnd("ctx");
  9543. $self._subclassResponsibility();
  9544. return self;
  9545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9546. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9547. //>>excludeEnd("ctx");
  9548. }; }),
  9549. $globals.TKeyValueCollection);
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "indexOf:",
  9553. protocol: "accessing",
  9554. //>>excludeStart("ide", pragmas.excludeIdeData);
  9555. args: ["anObject"],
  9556. 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 ]",
  9557. referencedClasses: [],
  9558. //>>excludeEnd("ide");
  9559. pragmas: [],
  9560. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9561. }, function ($methodClass){ return function (anObject){
  9562. var self=this,$self=this;
  9563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9564. return $core.withContext(function($ctx1) {
  9565. //>>excludeEnd("ctx");
  9566. return $self._indexOf_ifAbsent_(anObject,(function(){
  9567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9568. return $core.withContext(function($ctx2) {
  9569. //>>excludeEnd("ctx");
  9570. return $self._errorNotFound();
  9571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9573. //>>excludeEnd("ctx");
  9574. }));
  9575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9576. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9577. //>>excludeEnd("ctx");
  9578. }; }),
  9579. $globals.TKeyValueCollection);
  9580. $core.addMethod(
  9581. $core.method({
  9582. selector: "indexOf:ifAbsent:",
  9583. protocol: "accessing",
  9584. //>>excludeStart("ide", pragmas.excludeIdeData);
  9585. args: ["anObject", "aBlock"],
  9586. 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",
  9587. referencedClasses: [],
  9588. //>>excludeEnd("ide");
  9589. pragmas: [],
  9590. messageSends: ["subclassResponsibility"]
  9591. }, function ($methodClass){ return function (anObject,aBlock){
  9592. var self=this,$self=this;
  9593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9594. return $core.withContext(function($ctx1) {
  9595. //>>excludeEnd("ctx");
  9596. $self._subclassResponsibility();
  9597. return self;
  9598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9599. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9600. //>>excludeEnd("ctx");
  9601. }; }),
  9602. $globals.TKeyValueCollection);
  9603. $core.addMethod(
  9604. $core.method({
  9605. selector: "with:do:",
  9606. protocol: "enumerating",
  9607. //>>excludeStart("ide", pragmas.excludeIdeData);
  9608. args: ["anotherCollection", "aBlock"],
  9609. 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) ]",
  9610. referencedClasses: [],
  9611. //>>excludeEnd("ide");
  9612. pragmas: [],
  9613. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9614. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9615. var self=this,$self=this;
  9616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9617. return $core.withContext(function($ctx1) {
  9618. //>>excludeEnd("ctx");
  9619. $self._withIndexDo_((function(each,index){
  9620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9621. return $core.withContext(function($ctx2) {
  9622. //>>excludeEnd("ctx");
  9623. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9625. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9626. //>>excludeEnd("ctx");
  9627. }));
  9628. return self;
  9629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9630. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9631. //>>excludeEnd("ctx");
  9632. }; }),
  9633. $globals.TKeyValueCollection);
  9634. $core.addMethod(
  9635. $core.method({
  9636. selector: "withIndexDo:",
  9637. protocol: "enumerating",
  9638. //>>excludeStart("ide", pragmas.excludeIdeData);
  9639. args: ["aBlock"],
  9640. 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",
  9641. referencedClasses: [],
  9642. //>>excludeEnd("ide");
  9643. pragmas: [],
  9644. messageSends: ["subclassResponsibility"]
  9645. }, function ($methodClass){ return function (aBlock){
  9646. var self=this,$self=this;
  9647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9648. return $core.withContext(function($ctx1) {
  9649. //>>excludeEnd("ctx");
  9650. $self._subclassResponsibility();
  9651. return self;
  9652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9653. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9654. //>>excludeEnd("ctx");
  9655. }; }),
  9656. $globals.TKeyValueCollection);
  9657. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9658. $core.addMethod(
  9659. $core.method({
  9660. selector: "at:ifAbsent:",
  9661. protocol: "accessing",
  9662. //>>excludeStart("ide", pragmas.excludeIdeData);
  9663. args: ["anIndex", "aBlock"],
  9664. 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'>",
  9665. referencedClasses: [],
  9666. //>>excludeEnd("ide");
  9667. 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"]]],
  9668. messageSends: []
  9669. }, function ($methodClass){ return function (anIndex,aBlock){
  9670. var self=this,$self=this;
  9671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9672. return $core.withContext(function($ctx1) {
  9673. //>>excludeEnd("ctx");
  9674. return anIndex >= 1 && anIndex <= self.length
  9675. ? self[anIndex - 1]
  9676. : aBlock._value()
  9677. ;
  9678. return self;
  9679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9680. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9681. //>>excludeEnd("ctx");
  9682. }; }),
  9683. $globals.TNativeZeroBasedCollection);
  9684. $core.addMethod(
  9685. $core.method({
  9686. selector: "at:ifPresent:ifAbsent:",
  9687. protocol: "accessing",
  9688. //>>excludeStart("ide", pragmas.excludeIdeData);
  9689. args: ["anIndex", "aBlock", "anotherBlock"],
  9690. 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'>",
  9691. referencedClasses: [],
  9692. //>>excludeEnd("ide");
  9693. 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"]]],
  9694. messageSends: []
  9695. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9696. var self=this,$self=this;
  9697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9698. return $core.withContext(function($ctx1) {
  9699. //>>excludeEnd("ctx");
  9700. return anIndex >= 1 && anIndex <= self.length
  9701. ? aBlock._value_(self[anIndex - 1])
  9702. : anotherBlock._value()
  9703. ;
  9704. return self;
  9705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9706. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9707. //>>excludeEnd("ctx");
  9708. }; }),
  9709. $globals.TNativeZeroBasedCollection);
  9710. $core.addMethod(
  9711. $core.method({
  9712. selector: "detect:ifNone:",
  9713. protocol: "enumerating",
  9714. //>>excludeStart("ide", pragmas.excludeIdeData);
  9715. args: ["aBlock", "anotherBlock"],
  9716. 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'>",
  9717. referencedClasses: [],
  9718. //>>excludeEnd("ide");
  9719. 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"]]],
  9720. messageSends: []
  9721. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9722. var self=this,$self=this;
  9723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9724. return $core.withContext(function($ctx1) {
  9725. //>>excludeEnd("ctx");
  9726. for(var i = 0; i < self.length; i++)
  9727. if(aBlock._value_(self[i]))
  9728. return self[i];
  9729. return anotherBlock._value();
  9730. ;
  9731. return self;
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9734. //>>excludeEnd("ctx");
  9735. }; }),
  9736. $globals.TNativeZeroBasedCollection);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "do:",
  9740. protocol: "enumerating",
  9741. //>>excludeStart("ide", pragmas.excludeIdeData);
  9742. args: ["aBlock"],
  9743. 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'>",
  9744. referencedClasses: [],
  9745. //>>excludeEnd("ide");
  9746. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9747. messageSends: []
  9748. }, function ($methodClass){ return function (aBlock){
  9749. var self=this,$self=this;
  9750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9751. return $core.withContext(function($ctx1) {
  9752. //>>excludeEnd("ctx");
  9753. for(var i=0; i < self.length; i++) {
  9754. aBlock._value_(self[i]);
  9755. }
  9756. ;
  9757. return self;
  9758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9759. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9760. //>>excludeEnd("ctx");
  9761. }; }),
  9762. $globals.TNativeZeroBasedCollection);
  9763. $core.addMethod(
  9764. $core.method({
  9765. selector: "indexOf:ifAbsent:",
  9766. protocol: "accessing",
  9767. //>>excludeStart("ide", pragmas.excludeIdeData);
  9768. args: ["anObject", "aBlock"],
  9769. 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'>",
  9770. referencedClasses: [],
  9771. //>>excludeEnd("ide");
  9772. 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"]]],
  9773. messageSends: []
  9774. }, function ($methodClass){ return function (anObject,aBlock){
  9775. var self=this,$self=this;
  9776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9777. return $core.withContext(function($ctx1) {
  9778. //>>excludeEnd("ctx");
  9779. for(var i=0; i < self.length; i++) {
  9780. if($recv(self[i]).__eq(anObject)) {return i+1}
  9781. };
  9782. return aBlock._value();
  9783. ;
  9784. return self;
  9785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9786. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9787. //>>excludeEnd("ctx");
  9788. }; }),
  9789. $globals.TNativeZeroBasedCollection);
  9790. $core.addMethod(
  9791. $core.method({
  9792. selector: "indexOf:startingAt:ifAbsent:",
  9793. protocol: "accessing",
  9794. //>>excludeStart("ide", pragmas.excludeIdeData);
  9795. args: ["anObject", "start", "aBlock"],
  9796. 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'>",
  9797. referencedClasses: [],
  9798. //>>excludeEnd("ide");
  9799. 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"]]],
  9800. messageSends: []
  9801. }, function ($methodClass){ return function (anObject,start,aBlock){
  9802. var self=this,$self=this;
  9803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9804. return $core.withContext(function($ctx1) {
  9805. //>>excludeEnd("ctx");
  9806. for(var i=start - 1; i < self.length; i++){
  9807. if($recv(self[i]).__eq(anObject)) {return i+1}
  9808. }
  9809. return aBlock._value();
  9810. ;
  9811. return self;
  9812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9813. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9814. //>>excludeEnd("ctx");
  9815. }; }),
  9816. $globals.TNativeZeroBasedCollection);
  9817. $core.addMethod(
  9818. $core.method({
  9819. selector: "single",
  9820. protocol: "accessing",
  9821. //>>excludeStart("ide", pragmas.excludeIdeData);
  9822. args: [],
  9823. 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'>",
  9824. referencedClasses: [],
  9825. //>>excludeEnd("ide");
  9826. 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];"]]],
  9827. messageSends: []
  9828. }, function ($methodClass){ return function (){
  9829. var self=this,$self=this;
  9830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9831. return $core.withContext(function($ctx1) {
  9832. //>>excludeEnd("ctx");
  9833. if (self.length == 0) throw new Error("Collection is empty");
  9834. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9835. return self[0];;
  9836. return self;
  9837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9838. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9839. //>>excludeEnd("ctx");
  9840. }; }),
  9841. $globals.TNativeZeroBasedCollection);
  9842. $core.addMethod(
  9843. $core.method({
  9844. selector: "size",
  9845. protocol: "accessing",
  9846. //>>excludeStart("ide", pragmas.excludeIdeData);
  9847. args: [],
  9848. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9849. referencedClasses: [],
  9850. //>>excludeEnd("ide");
  9851. pragmas: [["inlineJS:", ["return self.length"]]],
  9852. messageSends: []
  9853. }, function ($methodClass){ return function (){
  9854. var self=this,$self=this;
  9855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9856. return $core.withContext(function($ctx1) {
  9857. //>>excludeEnd("ctx");
  9858. return self.length;
  9859. return self;
  9860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9861. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9862. //>>excludeEnd("ctx");
  9863. }; }),
  9864. $globals.TNativeZeroBasedCollection);
  9865. $core.addMethod(
  9866. $core.method({
  9867. selector: "with:do:",
  9868. protocol: "enumerating",
  9869. //>>excludeStart("ide", pragmas.excludeIdeData);
  9870. args: ["anotherCollection", "aBlock"],
  9871. 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'>",
  9872. referencedClasses: [],
  9873. //>>excludeEnd("ide");
  9874. 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"]]],
  9875. messageSends: []
  9876. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9877. var self=this,$self=this;
  9878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9879. return $core.withContext(function($ctx1) {
  9880. //>>excludeEnd("ctx");
  9881. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9882. for(var i=0; i<self.length; i++) {
  9883. aBlock._value_value_(self[i], anotherCollection[i]);
  9884. }
  9885. ;
  9886. return self;
  9887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9888. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9889. //>>excludeEnd("ctx");
  9890. }; }),
  9891. $globals.TNativeZeroBasedCollection);
  9892. $core.addMethod(
  9893. $core.method({
  9894. selector: "withIndexDo:",
  9895. protocol: "enumerating",
  9896. //>>excludeStart("ide", pragmas.excludeIdeData);
  9897. args: ["aBlock"],
  9898. 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'>",
  9899. referencedClasses: [],
  9900. //>>excludeEnd("ide");
  9901. 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"]]],
  9902. messageSends: []
  9903. }, function ($methodClass){ return function (aBlock){
  9904. var self=this,$self=this;
  9905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9906. return $core.withContext(function($ctx1) {
  9907. //>>excludeEnd("ctx");
  9908. for(var i=0; i < self.length; i++) {
  9909. aBlock._value_value_(self[i], i+1);
  9910. }
  9911. ;
  9912. return self;
  9913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9914. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9915. //>>excludeEnd("ctx");
  9916. }; }),
  9917. $globals.TNativeZeroBasedCollection);
  9918. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9919. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9920. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9921. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9922. });