Kernel-Collections.js 357 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348
  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: ["anAssocitativeCollection"],
  1860. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1861. referencedClasses: [],
  1862. //>>excludeEnd("ide");
  1863. pragmas: [],
  1864. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1865. }, function ($methodClass){ return function (anAssocitativeCollection){
  1866. var self=this,$self=this;
  1867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1868. return $core.withContext(function($ctx1) {
  1869. //>>excludeEnd("ctx");
  1870. if(!$core.assert([$recv([$self._class()
  1871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1872. ,$ctx1.sendIdx["class"]=1
  1873. //>>excludeEnd("ctx");
  1874. ][0]).__eq($recv(anAssocitativeCollection)._class())
  1875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1876. ,$ctx1.sendIdx["="]=1
  1877. //>>excludeEnd("ctx");
  1878. ][0])){
  1879. return false;
  1880. }
  1881. if(!$core.assert([$recv([$self._size()
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. ,$ctx1.sendIdx["size"]=1
  1884. //>>excludeEnd("ctx");
  1885. ][0]).__eq($recv(anAssocitativeCollection)._size())
  1886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1887. ,$ctx1.sendIdx["="]=2
  1888. //>>excludeEnd("ctx");
  1889. ][0])){
  1890. return false;
  1891. }
  1892. return $recv([$self._associations()
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. ,$ctx1.sendIdx["associations"]=1
  1895. //>>excludeEnd("ctx");
  1896. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  1897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1898. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1899. //>>excludeEnd("ctx");
  1900. }; }),
  1901. $globals.AssociativeCollection);
  1902. $core.addMethod(
  1903. $core.method({
  1904. selector: "add:",
  1905. protocol: "adding/removing",
  1906. //>>excludeStart("ide", pragmas.excludeIdeData);
  1907. args: ["anAssociation"],
  1908. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1909. referencedClasses: [],
  1910. //>>excludeEnd("ide");
  1911. pragmas: [],
  1912. messageSends: ["at:put:", "key", "value"]
  1913. }, function ($methodClass){ return function (anAssociation){
  1914. var self=this,$self=this;
  1915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1916. return $core.withContext(function($ctx1) {
  1917. //>>excludeEnd("ctx");
  1918. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1919. return self;
  1920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1921. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1922. //>>excludeEnd("ctx");
  1923. }; }),
  1924. $globals.AssociativeCollection);
  1925. $core.addMethod(
  1926. $core.method({
  1927. selector: "addAll:",
  1928. protocol: "adding/removing",
  1929. //>>excludeStart("ide", pragmas.excludeIdeData);
  1930. args: ["anAssociativeCollection"],
  1931. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1932. referencedClasses: [],
  1933. //>>excludeEnd("ide");
  1934. pragmas: [],
  1935. messageSends: ["addAll:", "associations"]
  1936. }, function ($methodClass){ return function (anAssociativeCollection){
  1937. var self=this,$self=this;
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. return $core.withContext(function($ctx1) {
  1940. //>>excludeEnd("ctx");
  1941. [(
  1942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1943. $ctx1.supercall = true,
  1944. //>>excludeEnd("ctx");
  1945. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1947. ,$ctx1.supercall = false
  1948. //>>excludeEnd("ctx");
  1949. ][0];
  1950. return anAssociativeCollection;
  1951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1952. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1953. //>>excludeEnd("ctx");
  1954. }; }),
  1955. $globals.AssociativeCollection);
  1956. $core.addMethod(
  1957. $core.method({
  1958. selector: "asDictionary",
  1959. protocol: "converting",
  1960. //>>excludeStart("ide", pragmas.excludeIdeData);
  1961. args: [],
  1962. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1963. referencedClasses: ["Dictionary"],
  1964. //>>excludeEnd("ide");
  1965. pragmas: [],
  1966. messageSends: ["from:", "associations"]
  1967. }, function ($methodClass){ return function (){
  1968. var self=this,$self=this;
  1969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1970. return $core.withContext(function($ctx1) {
  1971. //>>excludeEnd("ctx");
  1972. return $recv($globals.Dictionary)._from_($self._associations());
  1973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1974. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1975. //>>excludeEnd("ctx");
  1976. }; }),
  1977. $globals.AssociativeCollection);
  1978. $core.addMethod(
  1979. $core.method({
  1980. selector: "asHashedCollection",
  1981. protocol: "converting",
  1982. //>>excludeStart("ide", pragmas.excludeIdeData);
  1983. args: [],
  1984. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1985. referencedClasses: ["HashedCollection"],
  1986. //>>excludeEnd("ide");
  1987. pragmas: [],
  1988. messageSends: ["from:", "associations"]
  1989. }, function ($methodClass){ return function (){
  1990. var self=this,$self=this;
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. return $core.withContext(function($ctx1) {
  1993. //>>excludeEnd("ctx");
  1994. return $recv($globals.HashedCollection)._from_($self._associations());
  1995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1996. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1997. //>>excludeEnd("ctx");
  1998. }; }),
  1999. $globals.AssociativeCollection);
  2000. $core.addMethod(
  2001. $core.method({
  2002. selector: "asJavaScriptObject",
  2003. protocol: "converting",
  2004. //>>excludeStart("ide", pragmas.excludeIdeData);
  2005. args: [],
  2006. 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",
  2007. referencedClasses: ["HashedCollection"],
  2008. //>>excludeEnd("ide");
  2009. pragmas: [],
  2010. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2011. }, function ($methodClass){ return function (){
  2012. var self=this,$self=this;
  2013. var hash;
  2014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2015. return $core.withContext(function($ctx1) {
  2016. //>>excludeEnd("ctx");
  2017. hash=$recv($globals.HashedCollection)._new();
  2018. $self._keysAndValuesDo_((function(key,value){
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. return $core.withContext(function($ctx2) {
  2021. //>>excludeEnd("ctx");
  2022. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2025. //>>excludeEnd("ctx");
  2026. }));
  2027. return hash;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  2030. //>>excludeEnd("ctx");
  2031. }; }),
  2032. $globals.AssociativeCollection);
  2033. $core.addMethod(
  2034. $core.method({
  2035. selector: "associations",
  2036. protocol: "accessing",
  2037. //>>excludeStart("ide", pragmas.excludeIdeData);
  2038. args: [],
  2039. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2040. referencedClasses: [],
  2041. //>>excludeEnd("ide");
  2042. pragmas: [],
  2043. messageSends: ["associationsDo:", "add:"]
  2044. }, function ($methodClass){ return function (){
  2045. var self=this,$self=this;
  2046. var associations;
  2047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2048. return $core.withContext(function($ctx1) {
  2049. //>>excludeEnd("ctx");
  2050. associations=[];
  2051. $self._associationsDo_((function(each){
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. return $core.withContext(function($ctx2) {
  2054. //>>excludeEnd("ctx");
  2055. return $recv(associations)._add_(each);
  2056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2058. //>>excludeEnd("ctx");
  2059. }));
  2060. return associations;
  2061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2062. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2063. //>>excludeEnd("ctx");
  2064. }; }),
  2065. $globals.AssociativeCollection);
  2066. $core.addMethod(
  2067. $core.method({
  2068. selector: "associationsDo:",
  2069. protocol: "enumerating",
  2070. //>>excludeStart("ide", pragmas.excludeIdeData);
  2071. args: ["aBlock"],
  2072. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2073. referencedClasses: ["Association"],
  2074. //>>excludeEnd("ide");
  2075. pragmas: [],
  2076. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2077. }, function ($methodClass){ return function (aBlock){
  2078. var self=this,$self=this;
  2079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2080. return $core.withContext(function($ctx1) {
  2081. //>>excludeEnd("ctx");
  2082. $self._keysAndValuesDo_((function(key,value){
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. return $core.withContext(function($ctx2) {
  2085. //>>excludeEnd("ctx");
  2086. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2089. //>>excludeEnd("ctx");
  2090. }));
  2091. return self;
  2092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2093. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2094. //>>excludeEnd("ctx");
  2095. }; }),
  2096. $globals.AssociativeCollection);
  2097. $core.addMethod(
  2098. $core.method({
  2099. selector: "at:ifPresent:ifAbsent:",
  2100. protocol: "accessing",
  2101. //>>excludeStart("ide", pragmas.excludeIdeData);
  2102. args: ["aKey", "aBlock", "anotherBlock"],
  2103. 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 ]",
  2104. referencedClasses: [],
  2105. //>>excludeEnd("ide");
  2106. pragmas: [],
  2107. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2108. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2109. var self=this,$self=this;
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. return $core.withContext(function($ctx1) {
  2112. //>>excludeEnd("ctx");
  2113. if($core.assert($self._includesKey_(aKey))){
  2114. return $recv(aBlock)._value_($self._at_(aKey));
  2115. } else {
  2116. return $recv(anotherBlock)._value();
  2117. }
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2120. //>>excludeEnd("ctx");
  2121. }; }),
  2122. $globals.AssociativeCollection);
  2123. $core.addMethod(
  2124. $core.method({
  2125. selector: "collect:",
  2126. protocol: "enumerating",
  2127. //>>excludeStart("ide", pragmas.excludeIdeData);
  2128. args: ["aBlock"],
  2129. 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",
  2130. referencedClasses: [],
  2131. //>>excludeEnd("ide");
  2132. pragmas: [],
  2133. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2134. }, function ($methodClass){ return function (aBlock){
  2135. var self=this,$self=this;
  2136. var newDict;
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. return $core.withContext(function($ctx1) {
  2139. //>>excludeEnd("ctx");
  2140. newDict=$recv($self._class())._new();
  2141. $self._keysAndValuesDo_((function(key,value){
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx2) {
  2144. //>>excludeEnd("ctx");
  2145. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2147. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2148. //>>excludeEnd("ctx");
  2149. }));
  2150. return newDict;
  2151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2152. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2153. //>>excludeEnd("ctx");
  2154. }; }),
  2155. $globals.AssociativeCollection);
  2156. $core.addMethod(
  2157. $core.method({
  2158. selector: "deepCopy",
  2159. protocol: "copying",
  2160. //>>excludeStart("ide", pragmas.excludeIdeData);
  2161. args: [],
  2162. 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",
  2163. referencedClasses: [],
  2164. //>>excludeEnd("ide");
  2165. pragmas: [],
  2166. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2167. }, function ($methodClass){ return function (){
  2168. var self=this,$self=this;
  2169. var copy;
  2170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2171. return $core.withContext(function($ctx1) {
  2172. //>>excludeEnd("ctx");
  2173. copy=$recv($self._class())._new();
  2174. $self._keysAndValuesDo_((function(key,value){
  2175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2176. return $core.withContext(function($ctx2) {
  2177. //>>excludeEnd("ctx");
  2178. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2181. //>>excludeEnd("ctx");
  2182. }));
  2183. return copy;
  2184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2185. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2186. //>>excludeEnd("ctx");
  2187. }; }),
  2188. $globals.AssociativeCollection);
  2189. $core.addMethod(
  2190. $core.method({
  2191. selector: "detect:ifNone:",
  2192. protocol: "enumerating",
  2193. //>>excludeStart("ide", pragmas.excludeIdeData);
  2194. args: ["aBlock", "anotherBlock"],
  2195. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2196. referencedClasses: [],
  2197. //>>excludeEnd("ide");
  2198. pragmas: [],
  2199. messageSends: ["detect:ifNone:", "values"]
  2200. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2201. var self=this,$self=this;
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. return $core.withContext(function($ctx1) {
  2204. //>>excludeEnd("ctx");
  2205. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2207. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2208. //>>excludeEnd("ctx");
  2209. }; }),
  2210. $globals.AssociativeCollection);
  2211. $core.addMethod(
  2212. $core.method({
  2213. selector: "do:",
  2214. protocol: "enumerating",
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: ["aBlock"],
  2217. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2218. referencedClasses: [],
  2219. //>>excludeEnd("ide");
  2220. pragmas: [],
  2221. messageSends: ["valuesDo:"]
  2222. }, function ($methodClass){ return function (aBlock){
  2223. var self=this,$self=this;
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. return $core.withContext(function($ctx1) {
  2226. //>>excludeEnd("ctx");
  2227. $self._valuesDo_(aBlock);
  2228. return self;
  2229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2230. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2231. //>>excludeEnd("ctx");
  2232. }; }),
  2233. $globals.AssociativeCollection);
  2234. $core.addMethod(
  2235. $core.method({
  2236. selector: "includes:",
  2237. protocol: "enumerating",
  2238. //>>excludeStart("ide", pragmas.excludeIdeData);
  2239. args: ["anObject"],
  2240. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2241. referencedClasses: [],
  2242. //>>excludeEnd("ide");
  2243. pragmas: [],
  2244. messageSends: ["includes:", "values"]
  2245. }, function ($methodClass){ return function (anObject){
  2246. var self=this,$self=this;
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. return $core.withContext(function($ctx1) {
  2249. //>>excludeEnd("ctx");
  2250. return $recv($self._values())._includes_(anObject);
  2251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2252. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2253. //>>excludeEnd("ctx");
  2254. }; }),
  2255. $globals.AssociativeCollection);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "includesKey:",
  2259. protocol: "testing",
  2260. //>>excludeStart("ide", pragmas.excludeIdeData);
  2261. args: ["aKey"],
  2262. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2263. referencedClasses: [],
  2264. //>>excludeEnd("ide");
  2265. pragmas: [],
  2266. messageSends: ["subclassResponsibility"]
  2267. }, function ($methodClass){ return function (aKey){
  2268. var self=this,$self=this;
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. return $core.withContext(function($ctx1) {
  2271. //>>excludeEnd("ctx");
  2272. $self._subclassResponsibility();
  2273. return self;
  2274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2275. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2276. //>>excludeEnd("ctx");
  2277. }; }),
  2278. $globals.AssociativeCollection);
  2279. $core.addMethod(
  2280. $core.method({
  2281. selector: "indexOf:ifAbsent:",
  2282. protocol: "accessing",
  2283. //>>excludeStart("ide", pragmas.excludeIdeData);
  2284. args: ["anObject", "aBlock"],
  2285. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2286. referencedClasses: [],
  2287. //>>excludeEnd("ide");
  2288. pragmas: [],
  2289. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2290. }, function ($methodClass){ return function (anObject,aBlock){
  2291. var self=this,$self=this;
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. return $core.withContext(function($ctx1) {
  2294. //>>excludeEnd("ctx");
  2295. return $recv($self._keys())._detect_ifNone_((function(each){
  2296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2297. return $core.withContext(function($ctx2) {
  2298. //>>excludeEnd("ctx");
  2299. return $recv($self._at_(each)).__eq(anObject);
  2300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2302. //>>excludeEnd("ctx");
  2303. }),aBlock);
  2304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2305. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2306. //>>excludeEnd("ctx");
  2307. }; }),
  2308. $globals.AssociativeCollection);
  2309. $core.addMethod(
  2310. $core.method({
  2311. selector: "keyAtValue:",
  2312. protocol: "accessing",
  2313. //>>excludeStart("ide", pragmas.excludeIdeData);
  2314. args: ["anObject"],
  2315. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2316. referencedClasses: [],
  2317. //>>excludeEnd("ide");
  2318. pragmas: [],
  2319. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2320. }, function ($methodClass){ return function (anObject){
  2321. var self=this,$self=this;
  2322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2323. return $core.withContext(function($ctx1) {
  2324. //>>excludeEnd("ctx");
  2325. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. return $core.withContext(function($ctx2) {
  2328. //>>excludeEnd("ctx");
  2329. return $self._errorNotFound();
  2330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2332. //>>excludeEnd("ctx");
  2333. }));
  2334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2335. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2336. //>>excludeEnd("ctx");
  2337. }; }),
  2338. $globals.AssociativeCollection);
  2339. $core.addMethod(
  2340. $core.method({
  2341. selector: "keyAtValue:ifAbsent:",
  2342. protocol: "accessing",
  2343. //>>excludeStart("ide", pragmas.excludeIdeData);
  2344. args: ["anObject", "aBlock"],
  2345. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2346. referencedClasses: [],
  2347. //>>excludeEnd("ide");
  2348. pragmas: [],
  2349. messageSends: ["indexOf:ifAbsent:"]
  2350. }, function ($methodClass){ return function (anObject,aBlock){
  2351. var self=this,$self=this;
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. return $core.withContext(function($ctx1) {
  2354. //>>excludeEnd("ctx");
  2355. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2357. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2358. //>>excludeEnd("ctx");
  2359. }; }),
  2360. $globals.AssociativeCollection);
  2361. $core.addMethod(
  2362. $core.method({
  2363. selector: "keys",
  2364. protocol: "accessing",
  2365. //>>excludeStart("ide", pragmas.excludeIdeData);
  2366. args: [],
  2367. source: "keys\x0a\x09self subclassResponsibility",
  2368. referencedClasses: [],
  2369. //>>excludeEnd("ide");
  2370. pragmas: [],
  2371. messageSends: ["subclassResponsibility"]
  2372. }, function ($methodClass){ return function (){
  2373. var self=this,$self=this;
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. return $core.withContext(function($ctx1) {
  2376. //>>excludeEnd("ctx");
  2377. $self._subclassResponsibility();
  2378. return self;
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2381. //>>excludeEnd("ctx");
  2382. }; }),
  2383. $globals.AssociativeCollection);
  2384. $core.addMethod(
  2385. $core.method({
  2386. selector: "keysAndValuesDo:",
  2387. protocol: "enumerating",
  2388. //>>excludeStart("ide", pragmas.excludeIdeData);
  2389. args: ["aBlock"],
  2390. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2391. referencedClasses: [],
  2392. //>>excludeEnd("ide");
  2393. pragmas: [],
  2394. messageSends: ["keysDo:", "value:value:", "at:"]
  2395. }, function ($methodClass){ return function (aBlock){
  2396. var self=this,$self=this;
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. return $core.withContext(function($ctx1) {
  2399. //>>excludeEnd("ctx");
  2400. $self._keysDo_((function(each){
  2401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2402. return $core.withContext(function($ctx2) {
  2403. //>>excludeEnd("ctx");
  2404. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2407. //>>excludeEnd("ctx");
  2408. }));
  2409. return self;
  2410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2411. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2412. //>>excludeEnd("ctx");
  2413. }; }),
  2414. $globals.AssociativeCollection);
  2415. $core.addMethod(
  2416. $core.method({
  2417. selector: "keysDo:",
  2418. protocol: "enumerating",
  2419. //>>excludeStart("ide", pragmas.excludeIdeData);
  2420. args: ["aBlock"],
  2421. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2422. referencedClasses: [],
  2423. //>>excludeEnd("ide");
  2424. pragmas: [],
  2425. messageSends: ["subclassResponsibility"]
  2426. }, function ($methodClass){ return function (aBlock){
  2427. var self=this,$self=this;
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. return $core.withContext(function($ctx1) {
  2430. //>>excludeEnd("ctx");
  2431. $self._subclassResponsibility();
  2432. return self;
  2433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2434. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2435. //>>excludeEnd("ctx");
  2436. }; }),
  2437. $globals.AssociativeCollection);
  2438. $core.addMethod(
  2439. $core.method({
  2440. selector: "printOn:",
  2441. protocol: "printing",
  2442. //>>excludeStart("ide", pragmas.excludeIdeData);
  2443. args: ["aStream"],
  2444. 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: ')'",
  2445. referencedClasses: [],
  2446. //>>excludeEnd("ide");
  2447. pragmas: [],
  2448. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2449. }, function ($methodClass){ return function (aStream){
  2450. var self=this,$self=this;
  2451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2452. return $core.withContext(function($ctx1) {
  2453. //>>excludeEnd("ctx");
  2454. [(
  2455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2456. $ctx1.supercall = true,
  2457. //>>excludeEnd("ctx");
  2458. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2460. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2461. //>>excludeEnd("ctx");
  2462. ][0];
  2463. [$recv(aStream)._nextPutAll_(" (")
  2464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2465. ,$ctx1.sendIdx["nextPutAll:"]=1
  2466. //>>excludeEnd("ctx");
  2467. ][0];
  2468. $recv($self._associations())._do_separatedBy_((function(each){
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. return $core.withContext(function($ctx2) {
  2471. //>>excludeEnd("ctx");
  2472. return $recv(each)._printOn_(aStream);
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2475. //>>excludeEnd("ctx");
  2476. }),(function(){
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. return $core.withContext(function($ctx2) {
  2479. //>>excludeEnd("ctx");
  2480. return [$recv(aStream)._nextPutAll_(" , ")
  2481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2482. ,$ctx2.sendIdx["nextPutAll:"]=2
  2483. //>>excludeEnd("ctx");
  2484. ][0];
  2485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2486. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2487. //>>excludeEnd("ctx");
  2488. }));
  2489. $recv(aStream)._nextPutAll_(")");
  2490. return self;
  2491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2492. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2493. //>>excludeEnd("ctx");
  2494. }; }),
  2495. $globals.AssociativeCollection);
  2496. $core.addMethod(
  2497. $core.method({
  2498. selector: "remove:ifAbsent:",
  2499. protocol: "adding/removing",
  2500. //>>excludeStart("ide", pragmas.excludeIdeData);
  2501. args: ["aKey", "aBlock"],
  2502. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2503. referencedClasses: [],
  2504. //>>excludeEnd("ide");
  2505. pragmas: [],
  2506. messageSends: ["removeKey:ifAbsent:"]
  2507. }, function ($methodClass){ return function (aKey,aBlock){
  2508. var self=this,$self=this;
  2509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2510. return $core.withContext(function($ctx1) {
  2511. //>>excludeEnd("ctx");
  2512. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2514. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2515. //>>excludeEnd("ctx");
  2516. }; }),
  2517. $globals.AssociativeCollection);
  2518. $core.addMethod(
  2519. $core.method({
  2520. selector: "removeAll",
  2521. protocol: "adding/removing",
  2522. //>>excludeStart("ide", pragmas.excludeIdeData);
  2523. args: [],
  2524. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2525. referencedClasses: [],
  2526. //>>excludeEnd("ide");
  2527. pragmas: [],
  2528. messageSends: ["do:", "keys", "removeKey:"]
  2529. }, function ($methodClass){ return function (){
  2530. var self=this,$self=this;
  2531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2532. return $core.withContext(function($ctx1) {
  2533. //>>excludeEnd("ctx");
  2534. return $recv($self._keys())._do_((function(each){
  2535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2536. return $core.withContext(function($ctx2) {
  2537. //>>excludeEnd("ctx");
  2538. return $self._removeKey_(each);
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2541. //>>excludeEnd("ctx");
  2542. }));
  2543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2544. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2545. //>>excludeEnd("ctx");
  2546. }; }),
  2547. $globals.AssociativeCollection);
  2548. $core.addMethod(
  2549. $core.method({
  2550. selector: "removeKey:",
  2551. protocol: "adding/removing",
  2552. //>>excludeStart("ide", pragmas.excludeIdeData);
  2553. args: ["aKey"],
  2554. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2555. referencedClasses: [],
  2556. //>>excludeEnd("ide");
  2557. pragmas: [],
  2558. messageSends: ["remove:"]
  2559. }, function ($methodClass){ return function (aKey){
  2560. var self=this,$self=this;
  2561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2562. return $core.withContext(function($ctx1) {
  2563. //>>excludeEnd("ctx");
  2564. return $self._remove_(aKey);
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2567. //>>excludeEnd("ctx");
  2568. }; }),
  2569. $globals.AssociativeCollection);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "removeKey:ifAbsent:",
  2573. protocol: "adding/removing",
  2574. //>>excludeStart("ide", pragmas.excludeIdeData);
  2575. args: ["aKey", "aBlock"],
  2576. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2577. referencedClasses: [],
  2578. //>>excludeEnd("ide");
  2579. pragmas: [],
  2580. messageSends: ["subclassResponsibility"]
  2581. }, function ($methodClass){ return function (aKey,aBlock){
  2582. var self=this,$self=this;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. return $core.withContext(function($ctx1) {
  2585. //>>excludeEnd("ctx");
  2586. $self._subclassResponsibility();
  2587. return self;
  2588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2589. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2590. //>>excludeEnd("ctx");
  2591. }; }),
  2592. $globals.AssociativeCollection);
  2593. $core.addMethod(
  2594. $core.method({
  2595. selector: "select:",
  2596. protocol: "enumerating",
  2597. //>>excludeStart("ide", pragmas.excludeIdeData);
  2598. args: ["aBlock"],
  2599. 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",
  2600. referencedClasses: [],
  2601. //>>excludeEnd("ide");
  2602. pragmas: [],
  2603. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2604. }, function ($methodClass){ return function (aBlock){
  2605. var self=this,$self=this;
  2606. var newDict;
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. return $core.withContext(function($ctx1) {
  2609. //>>excludeEnd("ctx");
  2610. newDict=$recv($self._class())._new();
  2611. $self._keysAndValuesDo_((function(key,value){
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. return $core.withContext(function($ctx2) {
  2614. //>>excludeEnd("ctx");
  2615. if($core.assert($recv(aBlock)._value_(value))){
  2616. return $recv(newDict)._at_put_(key,value);
  2617. }
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2620. //>>excludeEnd("ctx");
  2621. }));
  2622. return newDict;
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2625. //>>excludeEnd("ctx");
  2626. }; }),
  2627. $globals.AssociativeCollection);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "select:thenCollect:",
  2631. protocol: "enumerating",
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: ["selectBlock", "collectBlock"],
  2634. 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",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. pragmas: [],
  2638. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2639. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2640. var self=this,$self=this;
  2641. var newDict;
  2642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2643. return $core.withContext(function($ctx1) {
  2644. //>>excludeEnd("ctx");
  2645. newDict=$recv($self._class())._new();
  2646. $self._keysAndValuesDo_((function(key,value){
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx2) {
  2649. //>>excludeEnd("ctx");
  2650. if($core.assert([$recv(selectBlock)._value_(value)
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. ,$ctx2.sendIdx["value:"]=1
  2653. //>>excludeEnd("ctx");
  2654. ][0])){
  2655. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2656. }
  2657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2658. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2659. //>>excludeEnd("ctx");
  2660. }));
  2661. return newDict;
  2662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2663. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2664. //>>excludeEnd("ctx");
  2665. }; }),
  2666. $globals.AssociativeCollection);
  2667. $core.addMethod(
  2668. $core.method({
  2669. selector: "shallowCopy",
  2670. protocol: "copying",
  2671. //>>excludeStart("ide", pragmas.excludeIdeData);
  2672. args: [],
  2673. 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",
  2674. referencedClasses: [],
  2675. //>>excludeEnd("ide");
  2676. pragmas: [],
  2677. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2678. }, function ($methodClass){ return function (){
  2679. var self=this,$self=this;
  2680. var copy;
  2681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2682. return $core.withContext(function($ctx1) {
  2683. //>>excludeEnd("ctx");
  2684. copy=$recv($self._class())._new();
  2685. $self._keysAndValuesDo_((function(key,value){
  2686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2687. return $core.withContext(function($ctx2) {
  2688. //>>excludeEnd("ctx");
  2689. return $recv(copy)._at_put_(key,value);
  2690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2691. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2692. //>>excludeEnd("ctx");
  2693. }));
  2694. return copy;
  2695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2696. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2697. //>>excludeEnd("ctx");
  2698. }; }),
  2699. $globals.AssociativeCollection);
  2700. $core.addMethod(
  2701. $core.method({
  2702. selector: "shortenedPrintString",
  2703. protocol: "printing",
  2704. //>>excludeStart("ide", pragmas.excludeIdeData);
  2705. args: [],
  2706. 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' ]",
  2707. referencedClasses: [],
  2708. //>>excludeEnd("ide");
  2709. pragmas: [],
  2710. messageSends: ["ifTrue:ifFalse:", "<=", "size", "printString", "anyOne", "keys", ",", "at:put:", "copyEmpty", "at:", "yourself", "-"]
  2711. }, function ($methodClass){ return function (){
  2712. var self=this,$self=this;
  2713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2714. return $core.withContext(function($ctx1) {
  2715. //>>excludeEnd("ctx");
  2716. var $1;
  2717. if($core.assert($recv([$self._size()
  2718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2719. ,$ctx1.sendIdx["size"]=1
  2720. //>>excludeEnd("ctx");
  2721. ][0]).__lt_eq((1)))){
  2722. return [$self._printString()
  2723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2724. ,$ctx1.sendIdx["printString"]=1
  2725. //>>excludeEnd("ctx");
  2726. ][0];
  2727. } else {
  2728. var key;
  2729. key=$recv($self._keys())._anyOne();
  2730. $1=$self._copyEmpty();
  2731. $recv($1)._at_put_(key,$self._at_(key));
  2732. return [$recv([$recv($recv($recv($recv($1)._yourself())._printString()).__comma(" ... ")).__comma($recv($self._size()).__minus((1)))
  2733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2734. ,$ctx1.sendIdx[","]=2
  2735. //>>excludeEnd("ctx");
  2736. ][0]).__comma(" more items")
  2737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2738. ,$ctx1.sendIdx[","]=1
  2739. //>>excludeEnd("ctx");
  2740. ][0];
  2741. }
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  2744. //>>excludeEnd("ctx");
  2745. }; }),
  2746. $globals.AssociativeCollection);
  2747. $core.addMethod(
  2748. $core.method({
  2749. selector: "size",
  2750. protocol: "accessing",
  2751. //>>excludeStart("ide", pragmas.excludeIdeData);
  2752. args: [],
  2753. source: "size\x0a\x09^ self keys size",
  2754. referencedClasses: [],
  2755. //>>excludeEnd("ide");
  2756. pragmas: [],
  2757. messageSends: ["size", "keys"]
  2758. }, function ($methodClass){ return function (){
  2759. var self=this,$self=this;
  2760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2761. return $core.withContext(function($ctx1) {
  2762. //>>excludeEnd("ctx");
  2763. return $recv($self._keys())._size();
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2766. //>>excludeEnd("ctx");
  2767. }; }),
  2768. $globals.AssociativeCollection);
  2769. $core.addMethod(
  2770. $core.method({
  2771. selector: "values",
  2772. protocol: "accessing",
  2773. //>>excludeStart("ide", pragmas.excludeIdeData);
  2774. args: [],
  2775. source: "values\x0a\x09self subclassResponsibility",
  2776. referencedClasses: [],
  2777. //>>excludeEnd("ide");
  2778. pragmas: [],
  2779. messageSends: ["subclassResponsibility"]
  2780. }, function ($methodClass){ return function (){
  2781. var self=this,$self=this;
  2782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2783. return $core.withContext(function($ctx1) {
  2784. //>>excludeEnd("ctx");
  2785. $self._subclassResponsibility();
  2786. return self;
  2787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2788. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2789. //>>excludeEnd("ctx");
  2790. }; }),
  2791. $globals.AssociativeCollection);
  2792. $core.addMethod(
  2793. $core.method({
  2794. selector: "valuesDo:",
  2795. protocol: "enumerating",
  2796. //>>excludeStart("ide", pragmas.excludeIdeData);
  2797. args: ["aBlock"],
  2798. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2799. referencedClasses: [],
  2800. //>>excludeEnd("ide");
  2801. pragmas: [],
  2802. messageSends: ["subclassResponsibility"]
  2803. }, function ($methodClass){ return function (aBlock){
  2804. var self=this,$self=this;
  2805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2806. return $core.withContext(function($ctx1) {
  2807. //>>excludeEnd("ctx");
  2808. $self._subclassResponsibility();
  2809. return self;
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2812. //>>excludeEnd("ctx");
  2813. }; }),
  2814. $globals.AssociativeCollection);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "withIndexDo:",
  2818. protocol: "enumerating",
  2819. //>>excludeStart("ide", pragmas.excludeIdeData);
  2820. args: ["aBlock"],
  2821. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2822. referencedClasses: [],
  2823. //>>excludeEnd("ide");
  2824. pragmas: [],
  2825. messageSends: ["keysAndValuesDo:", "value:value:"]
  2826. }, function ($methodClass){ return function (aBlock){
  2827. var self=this,$self=this;
  2828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2829. return $core.withContext(function($ctx1) {
  2830. //>>excludeEnd("ctx");
  2831. $self._keysAndValuesDo_((function(key,value){
  2832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2833. return $core.withContext(function($ctx2) {
  2834. //>>excludeEnd("ctx");
  2835. return $recv(aBlock)._value_value_(value,key);
  2836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2837. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2838. //>>excludeEnd("ctx");
  2839. }));
  2840. return self;
  2841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2842. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2843. //>>excludeEnd("ctx");
  2844. }; }),
  2845. $globals.AssociativeCollection);
  2846. $core.addMethod(
  2847. $core.method({
  2848. selector: "from:",
  2849. protocol: "instance creation",
  2850. //>>excludeStart("ide", pragmas.excludeIdeData);
  2851. args: ["aCollection"],
  2852. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2853. referencedClasses: [],
  2854. //>>excludeEnd("ide");
  2855. pragmas: [],
  2856. messageSends: ["new", "do:", "add:"]
  2857. }, function ($methodClass){ return function (aCollection){
  2858. var self=this,$self=this;
  2859. var newCollection;
  2860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2861. return $core.withContext(function($ctx1) {
  2862. //>>excludeEnd("ctx");
  2863. newCollection=$self._new();
  2864. $recv(aCollection)._do_((function(each){
  2865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2866. return $core.withContext(function($ctx2) {
  2867. //>>excludeEnd("ctx");
  2868. return $recv(newCollection)._add_(each);
  2869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2871. //>>excludeEnd("ctx");
  2872. }));
  2873. return newCollection;
  2874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2875. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2876. //>>excludeEnd("ctx");
  2877. }; }),
  2878. $globals.AssociativeCollection.a$cls);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "fromPairs:",
  2882. protocol: "instance creation",
  2883. //>>excludeStart("ide", pragmas.excludeIdeData);
  2884. args: ["aCollection"],
  2885. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2886. referencedClasses: [],
  2887. //>>excludeEnd("ide");
  2888. pragmas: [],
  2889. messageSends: ["from:"]
  2890. }, function ($methodClass){ return function (aCollection){
  2891. var self=this,$self=this;
  2892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2893. return $core.withContext(function($ctx1) {
  2894. //>>excludeEnd("ctx");
  2895. return $self._from_(aCollection);
  2896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2897. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2898. //>>excludeEnd("ctx");
  2899. }; }),
  2900. $globals.AssociativeCollection.a$cls);
  2901. $core.addMethod(
  2902. $core.method({
  2903. selector: "newFromPairs:",
  2904. protocol: "instance creation",
  2905. //>>excludeStart("ide", pragmas.excludeIdeData);
  2906. args: ["aCollection"],
  2907. 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",
  2908. referencedClasses: [],
  2909. //>>excludeEnd("ide");
  2910. pragmas: [],
  2911. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2912. }, function ($methodClass){ return function (aCollection){
  2913. var self=this,$self=this;
  2914. var newCollection;
  2915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2916. return $core.withContext(function($ctx1) {
  2917. //>>excludeEnd("ctx");
  2918. if(!$core.assert($recv([$recv(aCollection)._size()
  2919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2920. ,$ctx1.sendIdx["size"]=1
  2921. //>>excludeEnd("ctx");
  2922. ][0])._even())){
  2923. $self._error_("#newFromPairs only accepts arrays of an even length");
  2924. }
  2925. newCollection=$self._new();
  2926. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2928. return $core.withContext(function($ctx2) {
  2929. //>>excludeEnd("ctx");
  2930. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2932. ,$ctx2.sendIdx["at:"]=1
  2933. //>>excludeEnd("ctx");
  2934. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2937. //>>excludeEnd("ctx");
  2938. }));
  2939. return newCollection;
  2940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2941. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2942. //>>excludeEnd("ctx");
  2943. }; }),
  2944. $globals.AssociativeCollection.a$cls);
  2945. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2946. //>>excludeStart("ide", pragmas.excludeIdeData);
  2947. $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.";
  2948. //>>excludeEnd("ide");
  2949. $core.addMethod(
  2950. $core.method({
  2951. selector: "at:ifAbsent:",
  2952. protocol: "accessing",
  2953. //>>excludeStart("ide", pragmas.excludeIdeData);
  2954. args: ["aKey", "aBlock"],
  2955. 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'>",
  2956. referencedClasses: [],
  2957. //>>excludeEnd("ide");
  2958. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2959. messageSends: []
  2960. }, function ($methodClass){ return function (aKey,aBlock){
  2961. var self=this,$self=this;
  2962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2963. return $core.withContext(function($ctx1) {
  2964. //>>excludeEnd("ctx");
  2965. var index = $self._positionOfKey_(aKey);
  2966. return index >=0 ? $self.values[index] : aBlock._value();
  2967. ;
  2968. return self;
  2969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2970. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2971. //>>excludeEnd("ctx");
  2972. }; }),
  2973. $globals.Dictionary);
  2974. $core.addMethod(
  2975. $core.method({
  2976. selector: "at:put:",
  2977. protocol: "accessing",
  2978. //>>excludeStart("ide", pragmas.excludeIdeData);
  2979. args: ["aKey", "aValue"],
  2980. 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'>",
  2981. referencedClasses: [],
  2982. //>>excludeEnd("ide");
  2983. 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"]]],
  2984. messageSends: []
  2985. }, function ($methodClass){ return function (aKey,aValue){
  2986. var self=this,$self=this;
  2987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2988. return $core.withContext(function($ctx1) {
  2989. //>>excludeEnd("ctx");
  2990. var index = $self._positionOfKey_(aKey);
  2991. if(index === -1) {
  2992. var keys = $self.keys;
  2993. index = keys.length;
  2994. keys.push(aKey);
  2995. }
  2996. return $self.values[index] = aValue;
  2997. ;
  2998. return self;
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3001. //>>excludeEnd("ctx");
  3002. }; }),
  3003. $globals.Dictionary);
  3004. $core.addMethod(
  3005. $core.method({
  3006. selector: "includesKey:",
  3007. protocol: "testing",
  3008. //>>excludeStart("ide", pragmas.excludeIdeData);
  3009. args: ["aKey"],
  3010. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3011. referencedClasses: [],
  3012. //>>excludeEnd("ide");
  3013. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  3014. messageSends: []
  3015. }, function ($methodClass){ return function (aKey){
  3016. var self=this,$self=this;
  3017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3018. return $core.withContext(function($ctx1) {
  3019. //>>excludeEnd("ctx");
  3020. return $self._positionOfKey_(aKey) >= 0;;
  3021. return self;
  3022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3023. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3024. //>>excludeEnd("ctx");
  3025. }; }),
  3026. $globals.Dictionary);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "indexOf:ifAbsent:",
  3030. protocol: "accessing",
  3031. //>>excludeStart("ide", pragmas.excludeIdeData);
  3032. args: ["anObject", "aBlock"],
  3033. 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 ]",
  3034. referencedClasses: [],
  3035. //>>excludeEnd("ide");
  3036. pragmas: [],
  3037. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3038. }, function ($methodClass){ return function (anObject,aBlock){
  3039. var self=this,$self=this;
  3040. var index;
  3041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3042. return $core.withContext(function($ctx1) {
  3043. //>>excludeEnd("ctx");
  3044. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  3045. return (0);
  3046. }));
  3047. if($core.assert($recv(index).__eq((0)))){
  3048. return $recv(aBlock)._value();
  3049. } else {
  3050. return $recv($self.keys)._at_(index);
  3051. }
  3052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3053. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  3054. //>>excludeEnd("ctx");
  3055. }; }),
  3056. $globals.Dictionary);
  3057. $core.addMethod(
  3058. $core.method({
  3059. selector: "initialize",
  3060. protocol: "initialization",
  3061. //>>excludeStart("ide", pragmas.excludeIdeData);
  3062. args: [],
  3063. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3064. referencedClasses: [],
  3065. //>>excludeEnd("ide");
  3066. pragmas: [],
  3067. messageSends: ["initialize"]
  3068. }, function ($methodClass){ return function (){
  3069. var self=this,$self=this;
  3070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3071. return $core.withContext(function($ctx1) {
  3072. //>>excludeEnd("ctx");
  3073. [(
  3074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3075. $ctx1.supercall = true,
  3076. //>>excludeEnd("ctx");
  3077. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  3078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3079. ,$ctx1.supercall = false
  3080. //>>excludeEnd("ctx");
  3081. ][0];
  3082. $self.keys=[];
  3083. $self.values=[];
  3084. return self;
  3085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3086. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3087. //>>excludeEnd("ctx");
  3088. }; }),
  3089. $globals.Dictionary);
  3090. $core.addMethod(
  3091. $core.method({
  3092. selector: "keys",
  3093. protocol: "accessing",
  3094. //>>excludeStart("ide", pragmas.excludeIdeData);
  3095. args: [],
  3096. source: "keys\x0a\x09^ keys copy",
  3097. referencedClasses: [],
  3098. //>>excludeEnd("ide");
  3099. pragmas: [],
  3100. messageSends: ["copy"]
  3101. }, function ($methodClass){ return function (){
  3102. var self=this,$self=this;
  3103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3104. return $core.withContext(function($ctx1) {
  3105. //>>excludeEnd("ctx");
  3106. return $recv($self.keys)._copy();
  3107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3108. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3109. //>>excludeEnd("ctx");
  3110. }; }),
  3111. $globals.Dictionary);
  3112. $core.addMethod(
  3113. $core.method({
  3114. selector: "keysAndValuesDo:",
  3115. protocol: "enumerating",
  3116. //>>excludeStart("ide", pragmas.excludeIdeData);
  3117. args: ["aBlock"],
  3118. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3119. referencedClasses: [],
  3120. //>>excludeEnd("ide");
  3121. pragmas: [],
  3122. messageSends: ["with:do:"]
  3123. }, function ($methodClass){ return function (aBlock){
  3124. var self=this,$self=this;
  3125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3126. return $core.withContext(function($ctx1) {
  3127. //>>excludeEnd("ctx");
  3128. return $recv($self.keys)._with_do_($self.values,aBlock);
  3129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3130. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3131. //>>excludeEnd("ctx");
  3132. }; }),
  3133. $globals.Dictionary);
  3134. $core.addMethod(
  3135. $core.method({
  3136. selector: "keysDo:",
  3137. protocol: "enumerating",
  3138. //>>excludeStart("ide", pragmas.excludeIdeData);
  3139. args: ["aBlock"],
  3140. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3141. referencedClasses: [],
  3142. //>>excludeEnd("ide");
  3143. pragmas: [],
  3144. messageSends: ["do:"]
  3145. }, function ($methodClass){ return function (aBlock){
  3146. var self=this,$self=this;
  3147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3148. return $core.withContext(function($ctx1) {
  3149. //>>excludeEnd("ctx");
  3150. return $recv($self.keys)._do_(aBlock);
  3151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3152. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3153. //>>excludeEnd("ctx");
  3154. }; }),
  3155. $globals.Dictionary);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "positionOfKey:",
  3159. protocol: "private",
  3160. //>>excludeStart("ide", pragmas.excludeIdeData);
  3161. args: ["anObject"],
  3162. 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'>",
  3163. referencedClasses: [],
  3164. //>>excludeEnd("ide");
  3165. 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"]]],
  3166. messageSends: []
  3167. }, function ($methodClass){ return function (anObject){
  3168. var self=this,$self=this;
  3169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3170. return $core.withContext(function($ctx1) {
  3171. //>>excludeEnd("ctx");
  3172. var keys = $self.keys;
  3173. for(var i=0;i<keys.length;i++){
  3174. if(keys[i].__eq(anObject)) { return i;}
  3175. }
  3176. return -1;
  3177. ;
  3178. return self;
  3179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3180. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3181. //>>excludeEnd("ctx");
  3182. }; }),
  3183. $globals.Dictionary);
  3184. $core.addMethod(
  3185. $core.method({
  3186. selector: "removeAll",
  3187. protocol: "adding/removing",
  3188. //>>excludeStart("ide", pragmas.excludeIdeData);
  3189. args: [],
  3190. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3191. referencedClasses: [],
  3192. //>>excludeEnd("ide");
  3193. pragmas: [],
  3194. messageSends: ["removeAll"]
  3195. }, function ($methodClass){ return function (){
  3196. var self=this,$self=this;
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. return $core.withContext(function($ctx1) {
  3199. //>>excludeEnd("ctx");
  3200. [$recv($self.keys)._removeAll()
  3201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3202. ,$ctx1.sendIdx["removeAll"]=1
  3203. //>>excludeEnd("ctx");
  3204. ][0];
  3205. $recv($self.values)._removeAll();
  3206. return self;
  3207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3208. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3209. //>>excludeEnd("ctx");
  3210. }; }),
  3211. $globals.Dictionary);
  3212. $core.addMethod(
  3213. $core.method({
  3214. selector: "removeKey:ifAbsent:",
  3215. protocol: "adding/removing",
  3216. //>>excludeStart("ide", pragmas.excludeIdeData);
  3217. args: ["aKey", "aBlock"],
  3218. 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'>",
  3219. referencedClasses: [],
  3220. //>>excludeEnd("ide");
  3221. 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"]]],
  3222. messageSends: []
  3223. }, function ($methodClass){ return function (aKey,aBlock){
  3224. var self=this,$self=this;
  3225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3226. return $core.withContext(function($ctx1) {
  3227. //>>excludeEnd("ctx");
  3228. var index = $self._positionOfKey_(aKey);
  3229. if(index === -1) {
  3230. return aBlock._value()
  3231. } else {
  3232. var keys = $self.keys, values = $self.values;
  3233. var value = values[index], l = keys.length;
  3234. keys[index] = keys[l-1];
  3235. keys.pop();
  3236. values[index] = values[l-1];
  3237. values.pop();
  3238. return value;
  3239. }
  3240. ;
  3241. return self;
  3242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3243. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3244. //>>excludeEnd("ctx");
  3245. }; }),
  3246. $globals.Dictionary);
  3247. $core.addMethod(
  3248. $core.method({
  3249. selector: "values",
  3250. protocol: "accessing",
  3251. //>>excludeStart("ide", pragmas.excludeIdeData);
  3252. args: [],
  3253. source: "values\x0a\x09^ values",
  3254. referencedClasses: [],
  3255. //>>excludeEnd("ide");
  3256. pragmas: [],
  3257. messageSends: []
  3258. }, function ($methodClass){ return function (){
  3259. var self=this,$self=this;
  3260. return $self.values;
  3261. }; }),
  3262. $globals.Dictionary);
  3263. $core.addMethod(
  3264. $core.method({
  3265. selector: "valuesDo:",
  3266. protocol: "enumerating",
  3267. //>>excludeStart("ide", pragmas.excludeIdeData);
  3268. args: ["aBlock"],
  3269. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3270. referencedClasses: [],
  3271. //>>excludeEnd("ide");
  3272. pragmas: [],
  3273. messageSends: ["do:"]
  3274. }, function ($methodClass){ return function (aBlock){
  3275. var self=this,$self=this;
  3276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3277. return $core.withContext(function($ctx1) {
  3278. //>>excludeEnd("ctx");
  3279. return $recv($self.values)._do_(aBlock);
  3280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3281. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3282. //>>excludeEnd("ctx");
  3283. }; }),
  3284. $globals.Dictionary);
  3285. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3286. //>>excludeStart("ide", pragmas.excludeIdeData);
  3287. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3288. //>>excludeEnd("ide");
  3289. $core.addMethod(
  3290. $core.method({
  3291. selector: "asJavaScriptSource",
  3292. protocol: "accessing",
  3293. //>>excludeStart("ide", pragmas.excludeIdeData);
  3294. args: [],
  3295. 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: '}' ]",
  3296. referencedClasses: ["String"],
  3297. //>>excludeEnd("ide");
  3298. pragmas: [],
  3299. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3300. }, function ($methodClass){ return function (){
  3301. var self=this,$self=this;
  3302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3303. return $core.withContext(function($ctx1) {
  3304. //>>excludeEnd("ctx");
  3305. return $recv($globals.String)._streamContents_((function(str){
  3306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3307. return $core.withContext(function($ctx2) {
  3308. //>>excludeEnd("ctx");
  3309. [$recv(str)._nextPut_("{")
  3310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3311. ,$ctx2.sendIdx["nextPut:"]=1
  3312. //>>excludeEnd("ctx");
  3313. ][0];
  3314. $self._keysAndValuesDo_((function(key,value){
  3315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3316. return $core.withContext(function($ctx3) {
  3317. //>>excludeEnd("ctx");
  3318. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3320. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3321. //>>excludeEnd("ctx");
  3322. ][0])
  3323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3324. ,$ctx3.sendIdx["nextPutAll:"]=1
  3325. //>>excludeEnd("ctx");
  3326. ][0];
  3327. [$recv(str)._nextPut_(":")
  3328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3329. ,$ctx3.sendIdx["nextPut:"]=2
  3330. //>>excludeEnd("ctx");
  3331. ][0];
  3332. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3333. return [$recv(str)._nextPut_(",")
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. ,$ctx3.sendIdx["nextPut:"]=3
  3336. //>>excludeEnd("ctx");
  3337. ][0];
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3340. //>>excludeEnd("ctx");
  3341. }));
  3342. $recv(str)._skip_((-1));
  3343. return $recv(str)._nextPut_("}");
  3344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3345. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3346. //>>excludeEnd("ctx");
  3347. }));
  3348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3349. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3350. //>>excludeEnd("ctx");
  3351. }; }),
  3352. $globals.HashedCollection);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "at:ifAbsent:",
  3356. protocol: "accessing",
  3357. //>>excludeStart("ide", pragmas.excludeIdeData);
  3358. args: ["aKey", "aBlock"],
  3359. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3360. referencedClasses: [],
  3361. //>>excludeEnd("ide");
  3362. pragmas: [],
  3363. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3364. }, function ($methodClass){ return function (aKey,aBlock){
  3365. var self=this,$self=this;
  3366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3367. return $core.withContext(function($ctx1) {
  3368. //>>excludeEnd("ctx");
  3369. if($core.assert($self._includesKey_(aKey))){
  3370. return $self._basicAt_(aKey);
  3371. } else {
  3372. return $recv(aBlock)._value();
  3373. }
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3376. //>>excludeEnd("ctx");
  3377. }; }),
  3378. $globals.HashedCollection);
  3379. $core.addMethod(
  3380. $core.method({
  3381. selector: "at:put:",
  3382. protocol: "accessing",
  3383. //>>excludeStart("ide", pragmas.excludeIdeData);
  3384. args: ["aKey", "aValue"],
  3385. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3386. referencedClasses: [],
  3387. //>>excludeEnd("ide");
  3388. pragmas: [],
  3389. messageSends: ["basicAt:put:"]
  3390. }, function ($methodClass){ return function (aKey,aValue){
  3391. var self=this,$self=this;
  3392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3393. return $core.withContext(function($ctx1) {
  3394. //>>excludeEnd("ctx");
  3395. return $self._basicAt_put_(aKey,aValue);
  3396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3397. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3398. //>>excludeEnd("ctx");
  3399. }; }),
  3400. $globals.HashedCollection);
  3401. $core.addMethod(
  3402. $core.method({
  3403. selector: "includesKey:",
  3404. protocol: "testing",
  3405. //>>excludeStart("ide", pragmas.excludeIdeData);
  3406. args: ["aKey"],
  3407. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3408. referencedClasses: [],
  3409. //>>excludeEnd("ide");
  3410. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3411. messageSends: []
  3412. }, function ($methodClass){ return function (aKey){
  3413. var self=this,$self=this;
  3414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3415. return $core.withContext(function($ctx1) {
  3416. //>>excludeEnd("ctx");
  3417. return self.hasOwnProperty(aKey);
  3418. return self;
  3419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3420. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3421. //>>excludeEnd("ctx");
  3422. }; }),
  3423. $globals.HashedCollection);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "keys",
  3427. protocol: "accessing",
  3428. //>>excludeStart("ide", pragmas.excludeIdeData);
  3429. args: [],
  3430. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3431. referencedClasses: [],
  3432. //>>excludeEnd("ide");
  3433. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3434. messageSends: []
  3435. }, function ($methodClass){ return function (){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. return Object.keys(self);
  3441. return self;
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3444. //>>excludeEnd("ctx");
  3445. }; }),
  3446. $globals.HashedCollection);
  3447. $core.addMethod(
  3448. $core.method({
  3449. selector: "keysDo:",
  3450. protocol: "enumerating",
  3451. //>>excludeStart("ide", pragmas.excludeIdeData);
  3452. args: ["aBlock"],
  3453. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3454. referencedClasses: [],
  3455. //>>excludeEnd("ide");
  3456. pragmas: [],
  3457. messageSends: ["do:", "keys"]
  3458. }, function ($methodClass){ return function (aBlock){
  3459. var self=this,$self=this;
  3460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3461. return $core.withContext(function($ctx1) {
  3462. //>>excludeEnd("ctx");
  3463. $recv($self._keys())._do_(aBlock);
  3464. return self;
  3465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3466. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3467. //>>excludeEnd("ctx");
  3468. }; }),
  3469. $globals.HashedCollection);
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "removeKey:ifAbsent:",
  3473. protocol: "adding/removing",
  3474. //>>excludeStart("ide", pragmas.excludeIdeData);
  3475. args: ["aKey", "aBlock"],
  3476. 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 ]",
  3477. referencedClasses: [],
  3478. //>>excludeEnd("ide");
  3479. pragmas: [],
  3480. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3481. }, function ($methodClass){ return function (aKey,aBlock){
  3482. var self=this,$self=this;
  3483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3484. return $core.withContext(function($ctx1) {
  3485. //>>excludeEnd("ctx");
  3486. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3488. return $core.withContext(function($ctx2) {
  3489. //>>excludeEnd("ctx");
  3490. $self._basicDelete_(aKey);
  3491. return removed;
  3492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3493. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3494. //>>excludeEnd("ctx");
  3495. }),(function(){
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. return $core.withContext(function($ctx2) {
  3498. //>>excludeEnd("ctx");
  3499. return $recv(aBlock)._value();
  3500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3502. //>>excludeEnd("ctx");
  3503. }));
  3504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3505. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3506. //>>excludeEnd("ctx");
  3507. }; }),
  3508. $globals.HashedCollection);
  3509. $core.addMethod(
  3510. $core.method({
  3511. selector: "values",
  3512. protocol: "accessing",
  3513. //>>excludeStart("ide", pragmas.excludeIdeData);
  3514. args: [],
  3515. 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'>",
  3516. referencedClasses: [],
  3517. //>>excludeEnd("ide");
  3518. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3519. messageSends: []
  3520. }, function ($methodClass){ return function (){
  3521. var self=this,$self=this;
  3522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3523. return $core.withContext(function($ctx1) {
  3524. //>>excludeEnd("ctx");
  3525. return $self._keys().map(function(key){
  3526. return $self._at_(key);
  3527. });
  3528. ;
  3529. return self;
  3530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3531. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3532. //>>excludeEnd("ctx");
  3533. }; }),
  3534. $globals.HashedCollection);
  3535. $core.addMethod(
  3536. $core.method({
  3537. selector: "valuesDo:",
  3538. protocol: "enumerating",
  3539. //>>excludeStart("ide", pragmas.excludeIdeData);
  3540. args: ["aBlock"],
  3541. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3542. referencedClasses: [],
  3543. //>>excludeEnd("ide");
  3544. pragmas: [],
  3545. messageSends: ["do:", "values"]
  3546. }, function ($methodClass){ return function (aBlock){
  3547. var self=this,$self=this;
  3548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3549. return $core.withContext(function($ctx1) {
  3550. //>>excludeEnd("ctx");
  3551. $recv($self._values())._do_(aBlock);
  3552. return self;
  3553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3554. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3555. //>>excludeEnd("ctx");
  3556. }; }),
  3557. $globals.HashedCollection);
  3558. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3559. //>>excludeStart("ide", pragmas.excludeIdeData);
  3560. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3561. //>>excludeEnd("ide");
  3562. $core.addMethod(
  3563. $core.method({
  3564. selector: "=",
  3565. protocol: "comparing",
  3566. //>>excludeStart("ide", pragmas.excludeIdeData);
  3567. args: ["aCollection"],
  3568. 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",
  3569. referencedClasses: [],
  3570. //>>excludeEnd("ide");
  3571. pragmas: [],
  3572. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3573. }, function ($methodClass){ return function (aCollection){
  3574. var self=this,$self=this;
  3575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3576. return $core.withContext(function($ctx1) {
  3577. //>>excludeEnd("ctx");
  3578. var $early={};
  3579. try {
  3580. if(!$core.assert($recv([$recv([$self._class()
  3581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3582. ,$ctx1.sendIdx["class"]=1
  3583. //>>excludeEnd("ctx");
  3584. ][0]).__eq($recv(aCollection)._class())
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. ,$ctx1.sendIdx["="]=1
  3587. //>>excludeEnd("ctx");
  3588. ][0])._and_((function(){
  3589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3590. return $core.withContext(function($ctx2) {
  3591. //>>excludeEnd("ctx");
  3592. return [$recv([$self._size()
  3593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3594. ,$ctx2.sendIdx["size"]=1
  3595. //>>excludeEnd("ctx");
  3596. ][0]).__eq($recv(aCollection)._size())
  3597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3598. ,$ctx2.sendIdx["="]=2
  3599. //>>excludeEnd("ctx");
  3600. ][0];
  3601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3603. //>>excludeEnd("ctx");
  3604. })))){
  3605. return false;
  3606. }
  3607. $self._withIndexDo_((function(each,i){
  3608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3609. return $core.withContext(function($ctx2) {
  3610. //>>excludeEnd("ctx");
  3611. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3612. throw $early=[false];
  3613. }
  3614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3615. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3616. //>>excludeEnd("ctx");
  3617. }));
  3618. return true;
  3619. }
  3620. catch(e) {if(e===$early)return e[0]; throw e}
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3623. //>>excludeEnd("ctx");
  3624. }; }),
  3625. $globals.SequenceableCollection);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "addLast:",
  3629. protocol: "adding/removing",
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: ["anObject"],
  3632. source: "addLast: anObject\x0a\x09self add: anObject",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. pragmas: [],
  3636. messageSends: ["add:"]
  3637. }, function ($methodClass){ return function (anObject){
  3638. var self=this,$self=this;
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx1) {
  3641. //>>excludeEnd("ctx");
  3642. $self._add_(anObject);
  3643. return self;
  3644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3645. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3646. //>>excludeEnd("ctx");
  3647. }; }),
  3648. $globals.SequenceableCollection);
  3649. $core.addMethod(
  3650. $core.method({
  3651. selector: "allButFirst",
  3652. protocol: "accessing",
  3653. //>>excludeStart("ide", pragmas.excludeIdeData);
  3654. args: [],
  3655. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3656. referencedClasses: [],
  3657. //>>excludeEnd("ide");
  3658. pragmas: [],
  3659. messageSends: ["copyFrom:to:", "size"]
  3660. }, function ($methodClass){ return function (){
  3661. var self=this,$self=this;
  3662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3663. return $core.withContext(function($ctx1) {
  3664. //>>excludeEnd("ctx");
  3665. return $self._copyFrom_to_((2),$self._size());
  3666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3667. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3668. //>>excludeEnd("ctx");
  3669. }; }),
  3670. $globals.SequenceableCollection);
  3671. $core.addMethod(
  3672. $core.method({
  3673. selector: "allButLast",
  3674. protocol: "accessing",
  3675. //>>excludeStart("ide", pragmas.excludeIdeData);
  3676. args: [],
  3677. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3678. referencedClasses: [],
  3679. //>>excludeEnd("ide");
  3680. pragmas: [],
  3681. messageSends: ["copyFrom:to:", "-", "size"]
  3682. }, function ($methodClass){ return function (){
  3683. var self=this,$self=this;
  3684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3685. return $core.withContext(function($ctx1) {
  3686. //>>excludeEnd("ctx");
  3687. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3689. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3690. //>>excludeEnd("ctx");
  3691. }; }),
  3692. $globals.SequenceableCollection);
  3693. $core.addMethod(
  3694. $core.method({
  3695. selector: "anyOne",
  3696. protocol: "accessing",
  3697. //>>excludeStart("ide", pragmas.excludeIdeData);
  3698. args: [],
  3699. source: "anyOne\x0a\x09^ self at: 1",
  3700. referencedClasses: [],
  3701. //>>excludeEnd("ide");
  3702. pragmas: [],
  3703. messageSends: ["at:"]
  3704. }, function ($methodClass){ return function (){
  3705. var self=this,$self=this;
  3706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3707. return $core.withContext(function($ctx1) {
  3708. //>>excludeEnd("ctx");
  3709. return $self._at_((1));
  3710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3711. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3712. //>>excludeEnd("ctx");
  3713. }; }),
  3714. $globals.SequenceableCollection);
  3715. $core.addMethod(
  3716. $core.method({
  3717. selector: "atRandom",
  3718. protocol: "accessing",
  3719. //>>excludeStart("ide", pragmas.excludeIdeData);
  3720. args: [],
  3721. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3722. referencedClasses: [],
  3723. //>>excludeEnd("ide");
  3724. pragmas: [],
  3725. messageSends: ["at:", "atRandom", "size"]
  3726. }, function ($methodClass){ return function (){
  3727. var self=this,$self=this;
  3728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3729. return $core.withContext(function($ctx1) {
  3730. //>>excludeEnd("ctx");
  3731. return $self._at_($recv($self._size())._atRandom());
  3732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3733. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3734. //>>excludeEnd("ctx");
  3735. }; }),
  3736. $globals.SequenceableCollection);
  3737. $core.addMethod(
  3738. $core.method({
  3739. selector: "beginsWith:",
  3740. protocol: "testing",
  3741. //>>excludeStart("ide", pragmas.excludeIdeData);
  3742. args: ["prefix"],
  3743. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3744. referencedClasses: [],
  3745. //>>excludeEnd("ide");
  3746. pragmas: [],
  3747. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3748. }, function ($methodClass){ return function (prefix){
  3749. var self=this,$self=this;
  3750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3751. return $core.withContext(function($ctx1) {
  3752. //>>excludeEnd("ctx");
  3753. if($core.assert($recv([$self._size()
  3754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3755. ,$ctx1.sendIdx["size"]=1
  3756. //>>excludeEnd("ctx");
  3757. ][0]).__lt([$recv(prefix)._size()
  3758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3759. ,$ctx1.sendIdx["size"]=2
  3760. //>>excludeEnd("ctx");
  3761. ][0]))){
  3762. return false;
  3763. }
  3764. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3766. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3767. //>>excludeEnd("ctx");
  3768. }; }),
  3769. $globals.SequenceableCollection);
  3770. $core.addMethod(
  3771. $core.method({
  3772. selector: "copyFrom:to:",
  3773. protocol: "copying",
  3774. //>>excludeStart("ide", pragmas.excludeIdeData);
  3775. args: ["anIndex", "anotherIndex"],
  3776. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3777. referencedClasses: [],
  3778. //>>excludeEnd("ide");
  3779. pragmas: [],
  3780. messageSends: ["subclassResponsibility"]
  3781. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3782. var self=this,$self=this;
  3783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3784. return $core.withContext(function($ctx1) {
  3785. //>>excludeEnd("ctx");
  3786. $self._subclassResponsibility();
  3787. return self;
  3788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3789. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3790. //>>excludeEnd("ctx");
  3791. }; }),
  3792. $globals.SequenceableCollection);
  3793. $core.addMethod(
  3794. $core.method({
  3795. selector: "copyWithFirst:",
  3796. protocol: "copying",
  3797. //>>excludeStart("ide", pragmas.excludeIdeData);
  3798. args: ["anObject"],
  3799. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3800. referencedClasses: [],
  3801. //>>excludeEnd("ide");
  3802. pragmas: [],
  3803. messageSends: ["addAll:", "with:", "class", "yourself"]
  3804. }, function ($methodClass){ return function (anObject){
  3805. var self=this,$self=this;
  3806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3807. return $core.withContext(function($ctx1) {
  3808. //>>excludeEnd("ctx");
  3809. var $1;
  3810. $1=$recv($self._class())._with_(anObject);
  3811. $recv($1)._addAll_(self);
  3812. return $recv($1)._yourself();
  3813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3814. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3815. //>>excludeEnd("ctx");
  3816. }; }),
  3817. $globals.SequenceableCollection);
  3818. $core.addMethod(
  3819. $core.method({
  3820. selector: "endsWith:",
  3821. protocol: "testing",
  3822. //>>excludeStart("ide", pragmas.excludeIdeData);
  3823. args: ["suffix"],
  3824. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3825. referencedClasses: [],
  3826. //>>excludeEnd("ide");
  3827. pragmas: [],
  3828. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3829. }, function ($methodClass){ return function (suffix){
  3830. var self=this,$self=this;
  3831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3832. return $core.withContext(function($ctx1) {
  3833. //>>excludeEnd("ctx");
  3834. if($core.assert($recv([$self._size()
  3835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3836. ,$ctx1.sendIdx["size"]=1
  3837. //>>excludeEnd("ctx");
  3838. ][0]).__lt([$recv(suffix)._size()
  3839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3840. ,$ctx1.sendIdx["size"]=2
  3841. //>>excludeEnd("ctx");
  3842. ][0]))){
  3843. return false;
  3844. }
  3845. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3847. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3848. //>>excludeEnd("ctx");
  3849. }; }),
  3850. $globals.SequenceableCollection);
  3851. $core.addMethod(
  3852. $core.method({
  3853. selector: "first",
  3854. protocol: "accessing",
  3855. //>>excludeStart("ide", pragmas.excludeIdeData);
  3856. args: [],
  3857. source: "first\x0a\x09^ self at: 1",
  3858. referencedClasses: [],
  3859. //>>excludeEnd("ide");
  3860. pragmas: [],
  3861. messageSends: ["at:"]
  3862. }, function ($methodClass){ return function (){
  3863. var self=this,$self=this;
  3864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3865. return $core.withContext(function($ctx1) {
  3866. //>>excludeEnd("ctx");
  3867. return $self._at_((1));
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3870. //>>excludeEnd("ctx");
  3871. }; }),
  3872. $globals.SequenceableCollection);
  3873. $core.addMethod(
  3874. $core.method({
  3875. selector: "first:",
  3876. protocol: "accessing",
  3877. //>>excludeStart("ide", pragmas.excludeIdeData);
  3878. args: ["aNumber"],
  3879. 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",
  3880. referencedClasses: [],
  3881. //>>excludeEnd("ide");
  3882. pragmas: [],
  3883. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3884. }, function ($methodClass){ return function (aNumber){
  3885. var self=this,$self=this;
  3886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3887. return $core.withContext(function($ctx1) {
  3888. //>>excludeEnd("ctx");
  3889. if($core.assert($recv($self._size()).__lt(aNumber))){
  3890. $self._error_("Invalid number of elements");
  3891. }
  3892. return $self._copyFrom_to_((1),aNumber);
  3893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3894. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3895. //>>excludeEnd("ctx");
  3896. }; }),
  3897. $globals.SequenceableCollection);
  3898. $core.addMethod(
  3899. $core.method({
  3900. selector: "fourth",
  3901. protocol: "accessing",
  3902. //>>excludeStart("ide", pragmas.excludeIdeData);
  3903. args: [],
  3904. source: "fourth\x0a\x09^ self at: 4",
  3905. referencedClasses: [],
  3906. //>>excludeEnd("ide");
  3907. pragmas: [],
  3908. messageSends: ["at:"]
  3909. }, function ($methodClass){ return function (){
  3910. var self=this,$self=this;
  3911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3912. return $core.withContext(function($ctx1) {
  3913. //>>excludeEnd("ctx");
  3914. return $self._at_((4));
  3915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3916. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3917. //>>excludeEnd("ctx");
  3918. }; }),
  3919. $globals.SequenceableCollection);
  3920. $core.addMethod(
  3921. $core.method({
  3922. selector: "includes:",
  3923. protocol: "testing",
  3924. //>>excludeStart("ide", pragmas.excludeIdeData);
  3925. args: ["anObject"],
  3926. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3927. referencedClasses: [],
  3928. //>>excludeEnd("ide");
  3929. pragmas: [],
  3930. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3931. }, function ($methodClass){ return function (anObject){
  3932. var self=this,$self=this;
  3933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3934. return $core.withContext(function($ctx1) {
  3935. //>>excludeEnd("ctx");
  3936. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3937. return nil;
  3938. })))._notNil();
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3941. //>>excludeEnd("ctx");
  3942. }; }),
  3943. $globals.SequenceableCollection);
  3944. $core.addMethod(
  3945. $core.method({
  3946. selector: "indexOf:startingAt:",
  3947. protocol: "accessing",
  3948. //>>excludeStart("ide", pragmas.excludeIdeData);
  3949. args: ["anObject", "start"],
  3950. 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 ]",
  3951. referencedClasses: [],
  3952. //>>excludeEnd("ide");
  3953. pragmas: [],
  3954. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3955. }, function ($methodClass){ return function (anObject,start){
  3956. var self=this,$self=this;
  3957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3958. return $core.withContext(function($ctx1) {
  3959. //>>excludeEnd("ctx");
  3960. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3961. return (0);
  3962. }));
  3963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3964. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3965. //>>excludeEnd("ctx");
  3966. }; }),
  3967. $globals.SequenceableCollection);
  3968. $core.addMethod(
  3969. $core.method({
  3970. selector: "indexOf:startingAt:ifAbsent:",
  3971. protocol: "accessing",
  3972. //>>excludeStart("ide", pragmas.excludeIdeData);
  3973. args: ["anObject", "start", "aBlock"],
  3974. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3975. referencedClasses: [],
  3976. //>>excludeEnd("ide");
  3977. pragmas: [],
  3978. messageSends: ["subclassResponsibility"]
  3979. }, function ($methodClass){ return function (anObject,start,aBlock){
  3980. var self=this,$self=this;
  3981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3982. return $core.withContext(function($ctx1) {
  3983. //>>excludeEnd("ctx");
  3984. $self._subclassResponsibility();
  3985. return self;
  3986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3987. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3988. //>>excludeEnd("ctx");
  3989. }; }),
  3990. $globals.SequenceableCollection);
  3991. $core.addMethod(
  3992. $core.method({
  3993. selector: "last",
  3994. protocol: "accessing",
  3995. //>>excludeStart("ide", pragmas.excludeIdeData);
  3996. args: [],
  3997. source: "last\x0a\x09^ self at: self size",
  3998. referencedClasses: [],
  3999. //>>excludeEnd("ide");
  4000. pragmas: [],
  4001. messageSends: ["at:", "size"]
  4002. }, function ($methodClass){ return function (){
  4003. var self=this,$self=this;
  4004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4005. return $core.withContext(function($ctx1) {
  4006. //>>excludeEnd("ctx");
  4007. return $self._at_($self._size());
  4008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4009. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  4010. //>>excludeEnd("ctx");
  4011. }; }),
  4012. $globals.SequenceableCollection);
  4013. $core.addMethod(
  4014. $core.method({
  4015. selector: "last:",
  4016. protocol: "accessing",
  4017. //>>excludeStart("ide", pragmas.excludeIdeData);
  4018. args: ["aNumber"],
  4019. 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",
  4020. referencedClasses: [],
  4021. //>>excludeEnd("ide");
  4022. pragmas: [],
  4023. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4024. }, function ($methodClass){ return function (aNumber){
  4025. var self=this,$self=this;
  4026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4027. return $core.withContext(function($ctx1) {
  4028. //>>excludeEnd("ctx");
  4029. if($core.assert($recv([$self._size()
  4030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4031. ,$ctx1.sendIdx["size"]=1
  4032. //>>excludeEnd("ctx");
  4033. ][0]).__lt(aNumber))){
  4034. $self._error_("Invalid number of elements");
  4035. }
  4036. return $self._copyFrom_to_($recv($recv([$self._size()
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. ,$ctx1.sendIdx["size"]=2
  4039. //>>excludeEnd("ctx");
  4040. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  4041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4042. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  4043. //>>excludeEnd("ctx");
  4044. }; }),
  4045. $globals.SequenceableCollection);
  4046. $core.addMethod(
  4047. $core.method({
  4048. selector: "newStream",
  4049. protocol: "streaming",
  4050. //>>excludeStart("ide", pragmas.excludeIdeData);
  4051. args: [],
  4052. source: "newStream\x0a\x09^ self streamClass on: self",
  4053. referencedClasses: [],
  4054. //>>excludeEnd("ide");
  4055. pragmas: [],
  4056. messageSends: ["on:", "streamClass"]
  4057. }, function ($methodClass){ return function (){
  4058. var self=this,$self=this;
  4059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4060. return $core.withContext(function($ctx1) {
  4061. //>>excludeEnd("ctx");
  4062. return $recv($self._streamClass())._on_(self);
  4063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4064. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  4065. //>>excludeEnd("ctx");
  4066. }; }),
  4067. $globals.SequenceableCollection);
  4068. $core.addMethod(
  4069. $core.method({
  4070. selector: "readStream",
  4071. protocol: "streaming",
  4072. //>>excludeStart("ide", pragmas.excludeIdeData);
  4073. args: [],
  4074. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4075. referencedClasses: [],
  4076. //>>excludeEnd("ide");
  4077. pragmas: [],
  4078. messageSends: ["stream"]
  4079. }, function ($methodClass){ return function (){
  4080. var self=this,$self=this;
  4081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4082. return $core.withContext(function($ctx1) {
  4083. //>>excludeEnd("ctx");
  4084. return $self._stream();
  4085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4086. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4087. //>>excludeEnd("ctx");
  4088. }; }),
  4089. $globals.SequenceableCollection);
  4090. $core.addMethod(
  4091. $core.method({
  4092. selector: "removeLast",
  4093. protocol: "adding/removing",
  4094. //>>excludeStart("ide", pragmas.excludeIdeData);
  4095. args: [],
  4096. source: "removeLast\x0a\x09^ self remove: self last",
  4097. referencedClasses: [],
  4098. //>>excludeEnd("ide");
  4099. pragmas: [],
  4100. messageSends: ["remove:", "last"]
  4101. }, function ($methodClass){ return function (){
  4102. var self=this,$self=this;
  4103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4104. return $core.withContext(function($ctx1) {
  4105. //>>excludeEnd("ctx");
  4106. return $self._remove_($self._last());
  4107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4108. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4109. //>>excludeEnd("ctx");
  4110. }; }),
  4111. $globals.SequenceableCollection);
  4112. $core.addMethod(
  4113. $core.method({
  4114. selector: "reverseDo:",
  4115. protocol: "enumerating",
  4116. //>>excludeStart("ide", pragmas.excludeIdeData);
  4117. args: ["aBlock"],
  4118. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4119. referencedClasses: [],
  4120. //>>excludeEnd("ide");
  4121. pragmas: [],
  4122. messageSends: ["do:", "reversed"]
  4123. }, function ($methodClass){ return function (aBlock){
  4124. var self=this,$self=this;
  4125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4126. return $core.withContext(function($ctx1) {
  4127. //>>excludeEnd("ctx");
  4128. $recv($self._reversed())._do_(aBlock);
  4129. return self;
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4132. //>>excludeEnd("ctx");
  4133. }; }),
  4134. $globals.SequenceableCollection);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "reversed",
  4138. protocol: "converting",
  4139. //>>excludeStart("ide", pragmas.excludeIdeData);
  4140. args: [],
  4141. source: "reversed\x0a\x09self subclassResponsibility",
  4142. referencedClasses: [],
  4143. //>>excludeEnd("ide");
  4144. pragmas: [],
  4145. messageSends: ["subclassResponsibility"]
  4146. }, function ($methodClass){ return function (){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. $self._subclassResponsibility();
  4152. return self;
  4153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4154. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4155. //>>excludeEnd("ctx");
  4156. }; }),
  4157. $globals.SequenceableCollection);
  4158. $core.addMethod(
  4159. $core.method({
  4160. selector: "second",
  4161. protocol: "accessing",
  4162. //>>excludeStart("ide", pragmas.excludeIdeData);
  4163. args: [],
  4164. source: "second\x0a\x09^ self at: 2",
  4165. referencedClasses: [],
  4166. //>>excludeEnd("ide");
  4167. pragmas: [],
  4168. messageSends: ["at:"]
  4169. }, function ($methodClass){ return function (){
  4170. var self=this,$self=this;
  4171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4172. return $core.withContext(function($ctx1) {
  4173. //>>excludeEnd("ctx");
  4174. return $self._at_((2));
  4175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4176. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4177. //>>excludeEnd("ctx");
  4178. }; }),
  4179. $globals.SequenceableCollection);
  4180. $core.addMethod(
  4181. $core.method({
  4182. selector: "stream",
  4183. protocol: "streaming",
  4184. //>>excludeStart("ide", pragmas.excludeIdeData);
  4185. args: [],
  4186. source: "stream\x0a\x09^ self newStream",
  4187. referencedClasses: [],
  4188. //>>excludeEnd("ide");
  4189. pragmas: [],
  4190. messageSends: ["newStream"]
  4191. }, function ($methodClass){ return function (){
  4192. var self=this,$self=this;
  4193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4194. return $core.withContext(function($ctx1) {
  4195. //>>excludeEnd("ctx");
  4196. return $self._newStream();
  4197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4198. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4199. //>>excludeEnd("ctx");
  4200. }; }),
  4201. $globals.SequenceableCollection);
  4202. $core.addMethod(
  4203. $core.method({
  4204. selector: "streamClass",
  4205. protocol: "streaming",
  4206. //>>excludeStart("ide", pragmas.excludeIdeData);
  4207. args: [],
  4208. source: "streamClass\x0a\x09^ self class streamClass",
  4209. referencedClasses: [],
  4210. //>>excludeEnd("ide");
  4211. pragmas: [],
  4212. messageSends: ["streamClass", "class"]
  4213. }, function ($methodClass){ return function (){
  4214. var self=this,$self=this;
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. return $core.withContext(function($ctx1) {
  4217. //>>excludeEnd("ctx");
  4218. return $recv($self._class())._streamClass();
  4219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4220. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4221. //>>excludeEnd("ctx");
  4222. }; }),
  4223. $globals.SequenceableCollection);
  4224. $core.addMethod(
  4225. $core.method({
  4226. selector: "third",
  4227. protocol: "accessing",
  4228. //>>excludeStart("ide", pragmas.excludeIdeData);
  4229. args: [],
  4230. source: "third\x0a\x09^ self at: 3",
  4231. referencedClasses: [],
  4232. //>>excludeEnd("ide");
  4233. pragmas: [],
  4234. messageSends: ["at:"]
  4235. }, function ($methodClass){ return function (){
  4236. var self=this,$self=this;
  4237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4238. return $core.withContext(function($ctx1) {
  4239. //>>excludeEnd("ctx");
  4240. return $self._at_((3));
  4241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4242. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4243. //>>excludeEnd("ctx");
  4244. }; }),
  4245. $globals.SequenceableCollection);
  4246. $core.addMethod(
  4247. $core.method({
  4248. selector: "writeStream",
  4249. protocol: "streaming",
  4250. //>>excludeStart("ide", pragmas.excludeIdeData);
  4251. args: [],
  4252. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4253. referencedClasses: [],
  4254. //>>excludeEnd("ide");
  4255. pragmas: [],
  4256. messageSends: ["stream"]
  4257. }, function ($methodClass){ return function (){
  4258. var self=this,$self=this;
  4259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4260. return $core.withContext(function($ctx1) {
  4261. //>>excludeEnd("ctx");
  4262. return $self._stream();
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4265. //>>excludeEnd("ctx");
  4266. }; }),
  4267. $globals.SequenceableCollection);
  4268. $core.addMethod(
  4269. $core.method({
  4270. selector: "streamClass",
  4271. protocol: "accessing",
  4272. //>>excludeStart("ide", pragmas.excludeIdeData);
  4273. args: [],
  4274. source: "streamClass\x0a\x09\x09^ Stream",
  4275. referencedClasses: ["Stream"],
  4276. //>>excludeEnd("ide");
  4277. pragmas: [],
  4278. messageSends: []
  4279. }, function ($methodClass){ return function (){
  4280. var self=this,$self=this;
  4281. return $globals.Stream;
  4282. }; }),
  4283. $globals.SequenceableCollection.a$cls);
  4284. $core.addMethod(
  4285. $core.method({
  4286. selector: "streamContents:",
  4287. protocol: "streaming",
  4288. //>>excludeStart("ide", pragmas.excludeIdeData);
  4289. args: ["aBlock"],
  4290. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4291. referencedClasses: [],
  4292. //>>excludeEnd("ide");
  4293. pragmas: [],
  4294. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4295. }, function ($methodClass){ return function (aBlock){
  4296. var self=this,$self=this;
  4297. var stream;
  4298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4299. return $core.withContext(function($ctx1) {
  4300. //>>excludeEnd("ctx");
  4301. stream=$recv($self._streamClass())._on_($self._new());
  4302. $recv(aBlock)._value_(stream);
  4303. return $recv(stream)._contents();
  4304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4305. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4306. //>>excludeEnd("ctx");
  4307. }; }),
  4308. $globals.SequenceableCollection.a$cls);
  4309. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4310. //>>excludeStart("ide", pragmas.excludeIdeData);
  4311. $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`.";
  4312. //>>excludeEnd("ide");
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: "add:",
  4316. protocol: "adding/removing",
  4317. //>>excludeStart("ide", pragmas.excludeIdeData);
  4318. args: ["anObject"],
  4319. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4320. referencedClasses: [],
  4321. //>>excludeEnd("ide");
  4322. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4323. messageSends: []
  4324. }, function ($methodClass){ return function (anObject){
  4325. var self=this,$self=this;
  4326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4327. return $core.withContext(function($ctx1) {
  4328. //>>excludeEnd("ctx");
  4329. self.push(anObject); return anObject;;
  4330. return self;
  4331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4332. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4333. //>>excludeEnd("ctx");
  4334. }; }),
  4335. $globals.Array);
  4336. $core.addMethod(
  4337. $core.method({
  4338. selector: "addAll:",
  4339. protocol: "adding/removing",
  4340. //>>excludeStart("ide", pragmas.excludeIdeData);
  4341. args: ["aCollection"],
  4342. 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'>",
  4343. referencedClasses: [],
  4344. //>>excludeEnd("ide");
  4345. 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;"]]],
  4346. messageSends: []
  4347. }, function ($methodClass){ return function (aCollection){
  4348. var self=this,$self=this;
  4349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4350. return $core.withContext(function($ctx1) {
  4351. //>>excludeEnd("ctx");
  4352. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4353. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4354. return aCollection;;
  4355. return self;
  4356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4357. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4358. //>>excludeEnd("ctx");
  4359. }; }),
  4360. $globals.Array);
  4361. $core.addMethod(
  4362. $core.method({
  4363. selector: "addFirst:",
  4364. protocol: "adding/removing",
  4365. //>>excludeStart("ide", pragmas.excludeIdeData);
  4366. args: ["anObject"],
  4367. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4368. referencedClasses: [],
  4369. //>>excludeEnd("ide");
  4370. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4371. messageSends: []
  4372. }, function ($methodClass){ return function (anObject){
  4373. var self=this,$self=this;
  4374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4375. return $core.withContext(function($ctx1) {
  4376. //>>excludeEnd("ctx");
  4377. self.unshift(anObject); return anObject;;
  4378. return self;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4381. //>>excludeEnd("ctx");
  4382. }; }),
  4383. $globals.Array);
  4384. $core.addMethod(
  4385. $core.method({
  4386. selector: "allIn:",
  4387. protocol: "enumerating",
  4388. //>>excludeStart("ide", pragmas.excludeIdeData);
  4389. args: ["aBlock"],
  4390. 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 ] ])",
  4391. referencedClasses: [],
  4392. //>>excludeEnd("ide");
  4393. pragmas: [],
  4394. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  4395. }, function ($methodClass){ return function (aBlock){
  4396. var self=this,$self=this;
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. return $core.withContext(function($ctx1) {
  4399. //>>excludeEnd("ctx");
  4400. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  4401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4402. return $core.withContext(function($ctx2) {
  4403. //>>excludeEnd("ctx");
  4404. return $recv(each)._in_((function(x){
  4405. return x;
  4406. }));
  4407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4409. //>>excludeEnd("ctx");
  4410. })));
  4411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4412. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  4413. //>>excludeEnd("ctx");
  4414. }; }),
  4415. $globals.Array);
  4416. $core.addMethod(
  4417. $core.method({
  4418. selector: "asJavaScriptSource",
  4419. protocol: "converting",
  4420. //>>excludeStart("ide", pragmas.excludeIdeData);
  4421. args: [],
  4422. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4423. referencedClasses: [],
  4424. //>>excludeEnd("ide");
  4425. pragmas: [],
  4426. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4427. }, function ($methodClass){ return function (){
  4428. var self=this,$self=this;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. return $core.withContext(function($ctx1) {
  4431. //>>excludeEnd("ctx");
  4432. return [$recv("[".__comma($recv($self._collect_((function(each){
  4433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4434. return $core.withContext(function($ctx2) {
  4435. //>>excludeEnd("ctx");
  4436. return $recv(each)._asJavaScriptSource();
  4437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4439. //>>excludeEnd("ctx");
  4440. })))._join_(", "))).__comma("]")
  4441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4442. ,$ctx1.sendIdx[","]=1
  4443. //>>excludeEnd("ctx");
  4444. ][0];
  4445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4446. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4447. //>>excludeEnd("ctx");
  4448. }; }),
  4449. $globals.Array);
  4450. $core.addMethod(
  4451. $core.method({
  4452. selector: "at:put:",
  4453. protocol: "accessing",
  4454. //>>excludeStart("ide", pragmas.excludeIdeData);
  4455. args: ["anIndex", "anObject"],
  4456. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4457. referencedClasses: [],
  4458. //>>excludeEnd("ide");
  4459. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4460. messageSends: []
  4461. }, function ($methodClass){ return function (anIndex,anObject){
  4462. var self=this,$self=this;
  4463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4464. return $core.withContext(function($ctx1) {
  4465. //>>excludeEnd("ctx");
  4466. return self[anIndex - 1] = anObject;
  4467. return self;
  4468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4469. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4470. //>>excludeEnd("ctx");
  4471. }; }),
  4472. $globals.Array);
  4473. $core.addMethod(
  4474. $core.method({
  4475. selector: "collect:",
  4476. protocol: "enumerating",
  4477. //>>excludeStart("ide", pragmas.excludeIdeData);
  4478. args: ["aBlock"],
  4479. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4480. referencedClasses: [],
  4481. //>>excludeEnd("ide");
  4482. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4483. messageSends: []
  4484. }, function ($methodClass){ return function (aBlock){
  4485. var self=this,$self=this;
  4486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4487. return $core.withContext(function($ctx1) {
  4488. //>>excludeEnd("ctx");
  4489. return self.map(function(each) {return aBlock._value_(each)});
  4490. return self;
  4491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4492. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4493. //>>excludeEnd("ctx");
  4494. }; }),
  4495. $globals.Array);
  4496. $core.addMethod(
  4497. $core.method({
  4498. selector: "copyFrom:to:",
  4499. protocol: "copying",
  4500. //>>excludeStart("ide", pragmas.excludeIdeData);
  4501. args: ["anIndex", "anotherIndex"],
  4502. 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'>",
  4503. referencedClasses: [],
  4504. //>>excludeEnd("ide");
  4505. 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}"]]],
  4506. messageSends: []
  4507. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4508. var self=this,$self=this;
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. return $core.withContext(function($ctx1) {
  4511. //>>excludeEnd("ctx");
  4512. if (anIndex >= 1 && anotherIndex <= self.length) {
  4513. return self.slice(anIndex - 1, anotherIndex);
  4514. } else {
  4515. self._at_(anIndex);
  4516. self._at_(self.length + 1);
  4517. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4518. };
  4519. return self;
  4520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4521. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4522. //>>excludeEnd("ctx");
  4523. }; }),
  4524. $globals.Array);
  4525. $core.addMethod(
  4526. $core.method({
  4527. selector: "join:",
  4528. protocol: "enumerating",
  4529. //>>excludeStart("ide", pragmas.excludeIdeData);
  4530. args: ["aString"],
  4531. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4532. referencedClasses: [],
  4533. //>>excludeEnd("ide");
  4534. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4535. messageSends: []
  4536. }, function ($methodClass){ return function (aString){
  4537. var self=this,$self=this;
  4538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4539. return $core.withContext(function($ctx1) {
  4540. //>>excludeEnd("ctx");
  4541. return self.join(aString);
  4542. return self;
  4543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4544. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4545. //>>excludeEnd("ctx");
  4546. }; }),
  4547. $globals.Array);
  4548. $core.addMethod(
  4549. $core.method({
  4550. selector: "printOn:",
  4551. protocol: "printing",
  4552. //>>excludeStart("ide", pragmas.excludeIdeData);
  4553. args: ["aStream"],
  4554. 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: ')'",
  4555. referencedClasses: [],
  4556. //>>excludeEnd("ide");
  4557. pragmas: [],
  4558. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4559. }, function ($methodClass){ return function (aStream){
  4560. var self=this,$self=this;
  4561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4562. return $core.withContext(function($ctx1) {
  4563. //>>excludeEnd("ctx");
  4564. [(
  4565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4566. $ctx1.supercall = true,
  4567. //>>excludeEnd("ctx");
  4568. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4570. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4571. //>>excludeEnd("ctx");
  4572. ][0];
  4573. [$recv(aStream)._nextPutAll_(" (")
  4574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4575. ,$ctx1.sendIdx["nextPutAll:"]=1
  4576. //>>excludeEnd("ctx");
  4577. ][0];
  4578. $self._do_separatedBy_((function(each){
  4579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4580. return $core.withContext(function($ctx2) {
  4581. //>>excludeEnd("ctx");
  4582. return $recv(each)._printOn_(aStream);
  4583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4584. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4585. //>>excludeEnd("ctx");
  4586. }),(function(){
  4587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4588. return $core.withContext(function($ctx2) {
  4589. //>>excludeEnd("ctx");
  4590. return [$recv(aStream)._nextPutAll_(" ")
  4591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4592. ,$ctx2.sendIdx["nextPutAll:"]=2
  4593. //>>excludeEnd("ctx");
  4594. ][0];
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4597. //>>excludeEnd("ctx");
  4598. }));
  4599. $recv(aStream)._nextPutAll_(")");
  4600. return self;
  4601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4602. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4603. //>>excludeEnd("ctx");
  4604. }; }),
  4605. $globals.Array);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "remove:ifAbsent:",
  4609. protocol: "adding/removing",
  4610. //>>excludeStart("ide", pragmas.excludeIdeData);
  4611. args: ["anObject", "aBlock"],
  4612. 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 ]",
  4613. referencedClasses: [],
  4614. //>>excludeEnd("ide");
  4615. pragmas: [],
  4616. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4617. }, function ($methodClass){ return function (anObject,aBlock){
  4618. var self=this,$self=this;
  4619. var index;
  4620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4621. return $core.withContext(function($ctx1) {
  4622. //>>excludeEnd("ctx");
  4623. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4624. return (0);
  4625. }));
  4626. if($core.assert($recv(index).__eq((0)))){
  4627. return $recv(aBlock)._value();
  4628. } else {
  4629. $self._removeIndex_(index);
  4630. return anObject;
  4631. }
  4632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4633. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4634. //>>excludeEnd("ctx");
  4635. }; }),
  4636. $globals.Array);
  4637. $core.addMethod(
  4638. $core.method({
  4639. selector: "removeAll",
  4640. protocol: "adding/removing",
  4641. //>>excludeStart("ide", pragmas.excludeIdeData);
  4642. args: [],
  4643. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4644. referencedClasses: [],
  4645. //>>excludeEnd("ide");
  4646. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4647. messageSends: []
  4648. }, function ($methodClass){ return function (){
  4649. var self=this,$self=this;
  4650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4651. return $core.withContext(function($ctx1) {
  4652. //>>excludeEnd("ctx");
  4653. self.length = 0;
  4654. return self;
  4655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4656. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4657. //>>excludeEnd("ctx");
  4658. }; }),
  4659. $globals.Array);
  4660. $core.addMethod(
  4661. $core.method({
  4662. selector: "removeFrom:to:",
  4663. protocol: "adding/removing",
  4664. //>>excludeStart("ide", pragmas.excludeIdeData);
  4665. args: ["aNumber", "anotherNumber"],
  4666. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4667. referencedClasses: [],
  4668. //>>excludeEnd("ide");
  4669. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4670. messageSends: []
  4671. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4672. var self=this,$self=this;
  4673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4674. return $core.withContext(function($ctx1) {
  4675. //>>excludeEnd("ctx");
  4676. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4677. return self;
  4678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4679. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4680. //>>excludeEnd("ctx");
  4681. }; }),
  4682. $globals.Array);
  4683. $core.addMethod(
  4684. $core.method({
  4685. selector: "removeIndex:",
  4686. protocol: "adding/removing",
  4687. //>>excludeStart("ide", pragmas.excludeIdeData);
  4688. args: ["anInteger"],
  4689. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4690. referencedClasses: [],
  4691. //>>excludeEnd("ide");
  4692. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4693. messageSends: []
  4694. }, function ($methodClass){ return function (anInteger){
  4695. var self=this,$self=this;
  4696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4697. return $core.withContext(function($ctx1) {
  4698. //>>excludeEnd("ctx");
  4699. self.splice(anInteger - 1, 1);
  4700. return self;
  4701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4702. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4703. //>>excludeEnd("ctx");
  4704. }; }),
  4705. $globals.Array);
  4706. $core.addMethod(
  4707. $core.method({
  4708. selector: "removeLast",
  4709. protocol: "adding/removing",
  4710. //>>excludeStart("ide", pragmas.excludeIdeData);
  4711. args: [],
  4712. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4713. referencedClasses: [],
  4714. //>>excludeEnd("ide");
  4715. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4716. messageSends: []
  4717. }, function ($methodClass){ return function (){
  4718. var self=this,$self=this;
  4719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4720. return $core.withContext(function($ctx1) {
  4721. //>>excludeEnd("ctx");
  4722. return self.pop();;
  4723. return self;
  4724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4725. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4726. //>>excludeEnd("ctx");
  4727. }; }),
  4728. $globals.Array);
  4729. $core.addMethod(
  4730. $core.method({
  4731. selector: "reversed",
  4732. protocol: "converting",
  4733. //>>excludeStart("ide", pragmas.excludeIdeData);
  4734. args: [],
  4735. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4736. referencedClasses: [],
  4737. //>>excludeEnd("ide");
  4738. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4739. messageSends: []
  4740. }, function ($methodClass){ return function (){
  4741. var self=this,$self=this;
  4742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4743. return $core.withContext(function($ctx1) {
  4744. //>>excludeEnd("ctx");
  4745. return self.slice().reverse();
  4746. return self;
  4747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4748. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4749. //>>excludeEnd("ctx");
  4750. }; }),
  4751. $globals.Array);
  4752. $core.addMethod(
  4753. $core.method({
  4754. selector: "select:",
  4755. protocol: "enumerating",
  4756. //>>excludeStart("ide", pragmas.excludeIdeData);
  4757. args: ["aBlock"],
  4758. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4759. referencedClasses: [],
  4760. //>>excludeEnd("ide");
  4761. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4762. messageSends: []
  4763. }, function ($methodClass){ return function (aBlock){
  4764. var self=this,$self=this;
  4765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4766. return $core.withContext(function($ctx1) {
  4767. //>>excludeEnd("ctx");
  4768. return self.filter(function(each) {return aBlock._value_(each)});
  4769. return self;
  4770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4771. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4772. //>>excludeEnd("ctx");
  4773. }; }),
  4774. $globals.Array);
  4775. $core.addMethod(
  4776. $core.method({
  4777. selector: "shallowCopy",
  4778. protocol: "copying",
  4779. //>>excludeStart("ide", pragmas.excludeIdeData);
  4780. args: [],
  4781. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4782. referencedClasses: [],
  4783. //>>excludeEnd("ide");
  4784. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4785. messageSends: []
  4786. }, function ($methodClass){ return function (){
  4787. var self=this,$self=this;
  4788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4789. return $core.withContext(function($ctx1) {
  4790. //>>excludeEnd("ctx");
  4791. return self.slice();
  4792. return self;
  4793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4794. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4795. //>>excludeEnd("ctx");
  4796. }; }),
  4797. $globals.Array);
  4798. $core.addMethod(
  4799. $core.method({
  4800. selector: "sort",
  4801. protocol: "enumerating",
  4802. //>>excludeStart("ide", pragmas.excludeIdeData);
  4803. args: [],
  4804. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4805. referencedClasses: [],
  4806. //>>excludeEnd("ide");
  4807. pragmas: [],
  4808. messageSends: ["sort:", "<"]
  4809. }, function ($methodClass){ return function (){
  4810. var self=this,$self=this;
  4811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4812. return $core.withContext(function($ctx1) {
  4813. //>>excludeEnd("ctx");
  4814. return $self._sort_((function(a,b){
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. return $core.withContext(function($ctx2) {
  4817. //>>excludeEnd("ctx");
  4818. return $recv(a).__lt(b);
  4819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4820. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4821. //>>excludeEnd("ctx");
  4822. }));
  4823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4824. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4825. //>>excludeEnd("ctx");
  4826. }; }),
  4827. $globals.Array);
  4828. $core.addMethod(
  4829. $core.method({
  4830. selector: "sort:",
  4831. protocol: "enumerating",
  4832. //>>excludeStart("ide", pragmas.excludeIdeData);
  4833. args: ["aBlock"],
  4834. 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'>",
  4835. referencedClasses: [],
  4836. //>>excludeEnd("ide");
  4837. 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"]]],
  4838. messageSends: []
  4839. }, function ($methodClass){ return function (aBlock){
  4840. var self=this,$self=this;
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. return $core.withContext(function($ctx1) {
  4843. //>>excludeEnd("ctx");
  4844. return self.sort(function(a, b) {
  4845. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4846. })
  4847. ;
  4848. return self;
  4849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4850. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4851. //>>excludeEnd("ctx");
  4852. }; }),
  4853. $globals.Array);
  4854. $core.addMethod(
  4855. $core.method({
  4856. selector: "sorted",
  4857. protocol: "enumerating",
  4858. //>>excludeStart("ide", pragmas.excludeIdeData);
  4859. args: [],
  4860. source: "sorted\x0a\x09^ self copy sort",
  4861. referencedClasses: [],
  4862. //>>excludeEnd("ide");
  4863. pragmas: [],
  4864. messageSends: ["sort", "copy"]
  4865. }, function ($methodClass){ return function (){
  4866. var self=this,$self=this;
  4867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4868. return $core.withContext(function($ctx1) {
  4869. //>>excludeEnd("ctx");
  4870. return $recv($self._copy())._sort();
  4871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4872. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4873. //>>excludeEnd("ctx");
  4874. }; }),
  4875. $globals.Array);
  4876. $core.addMethod(
  4877. $core.method({
  4878. selector: "sorted:",
  4879. protocol: "enumerating",
  4880. //>>excludeStart("ide", pragmas.excludeIdeData);
  4881. args: ["aBlock"],
  4882. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4883. referencedClasses: [],
  4884. //>>excludeEnd("ide");
  4885. pragmas: [],
  4886. messageSends: ["sort:", "copy"]
  4887. }, function ($methodClass){ return function (aBlock){
  4888. var self=this,$self=this;
  4889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4890. return $core.withContext(function($ctx1) {
  4891. //>>excludeEnd("ctx");
  4892. return $recv($self._copy())._sort_(aBlock);
  4893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4894. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4895. //>>excludeEnd("ctx");
  4896. }; }),
  4897. $globals.Array);
  4898. $core.addMethod(
  4899. $core.method({
  4900. selector: "new:",
  4901. protocol: "instance creation",
  4902. //>>excludeStart("ide", pragmas.excludeIdeData);
  4903. args: ["anInteger"],
  4904. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4905. referencedClasses: [],
  4906. //>>excludeEnd("ide");
  4907. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4908. messageSends: []
  4909. }, function ($methodClass){ return function (anInteger){
  4910. var self=this,$self=this;
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. return $core.withContext(function($ctx1) {
  4913. //>>excludeEnd("ctx");
  4914. return new Array(anInteger);
  4915. return self;
  4916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4917. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4918. //>>excludeEnd("ctx");
  4919. }; }),
  4920. $globals.Array.a$cls);
  4921. $core.addMethod(
  4922. $core.method({
  4923. selector: "with:",
  4924. protocol: "instance creation",
  4925. //>>excludeStart("ide", pragmas.excludeIdeData);
  4926. args: ["anObject"],
  4927. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4928. referencedClasses: [],
  4929. //>>excludeEnd("ide");
  4930. pragmas: [],
  4931. messageSends: ["at:put:", "new:", "yourself"]
  4932. }, function ($methodClass){ return function (anObject){
  4933. var self=this,$self=this;
  4934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4935. return $core.withContext(function($ctx1) {
  4936. //>>excludeEnd("ctx");
  4937. var $1;
  4938. $1=$self._new_((1));
  4939. $recv($1)._at_put_((1),anObject);
  4940. return $recv($1)._yourself();
  4941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4942. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4943. //>>excludeEnd("ctx");
  4944. }; }),
  4945. $globals.Array.a$cls);
  4946. $core.addMethod(
  4947. $core.method({
  4948. selector: "with:with:",
  4949. protocol: "instance creation",
  4950. //>>excludeStart("ide", pragmas.excludeIdeData);
  4951. args: ["anObject", "anObject2"],
  4952. 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",
  4953. referencedClasses: [],
  4954. //>>excludeEnd("ide");
  4955. pragmas: [],
  4956. messageSends: ["at:put:", "new:", "yourself"]
  4957. }, function ($methodClass){ return function (anObject,anObject2){
  4958. var self=this,$self=this;
  4959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4960. return $core.withContext(function($ctx1) {
  4961. //>>excludeEnd("ctx");
  4962. var $1;
  4963. $1=$self._new_((2));
  4964. [$recv($1)._at_put_((1),anObject)
  4965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4966. ,$ctx1.sendIdx["at:put:"]=1
  4967. //>>excludeEnd("ctx");
  4968. ][0];
  4969. $recv($1)._at_put_((2),anObject2);
  4970. return $recv($1)._yourself();
  4971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4972. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4973. //>>excludeEnd("ctx");
  4974. }; }),
  4975. $globals.Array.a$cls);
  4976. $core.addMethod(
  4977. $core.method({
  4978. selector: "with:with:with:",
  4979. protocol: "instance creation",
  4980. //>>excludeStart("ide", pragmas.excludeIdeData);
  4981. args: ["anObject", "anObject2", "anObject3"],
  4982. 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",
  4983. referencedClasses: [],
  4984. //>>excludeEnd("ide");
  4985. pragmas: [],
  4986. messageSends: ["at:put:", "new:", "yourself"]
  4987. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4988. var self=this,$self=this;
  4989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4990. return $core.withContext(function($ctx1) {
  4991. //>>excludeEnd("ctx");
  4992. var $1;
  4993. $1=$self._new_((3));
  4994. [$recv($1)._at_put_((1),anObject)
  4995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4996. ,$ctx1.sendIdx["at:put:"]=1
  4997. //>>excludeEnd("ctx");
  4998. ][0];
  4999. [$recv($1)._at_put_((2),anObject2)
  5000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5001. ,$ctx1.sendIdx["at:put:"]=2
  5002. //>>excludeEnd("ctx");
  5003. ][0];
  5004. $recv($1)._at_put_((3),anObject3);
  5005. return $recv($1)._yourself();
  5006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5007. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  5008. //>>excludeEnd("ctx");
  5009. }; }),
  5010. $globals.Array.a$cls);
  5011. $core.addMethod(
  5012. $core.method({
  5013. selector: "withAll:",
  5014. protocol: "instance creation",
  5015. //>>excludeStart("ide", pragmas.excludeIdeData);
  5016. args: ["aCollection"],
  5017. 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",
  5018. referencedClasses: [],
  5019. //>>excludeEnd("ide");
  5020. pragmas: [],
  5021. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5022. }, function ($methodClass){ return function (aCollection){
  5023. var self=this,$self=this;
  5024. var instance,index;
  5025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5026. return $core.withContext(function($ctx1) {
  5027. //>>excludeEnd("ctx");
  5028. index=(1);
  5029. instance=$self._new_($recv(aCollection)._size());
  5030. $recv(aCollection)._do_((function(each){
  5031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5032. return $core.withContext(function($ctx2) {
  5033. //>>excludeEnd("ctx");
  5034. $recv(instance)._at_put_(index,each);
  5035. index=$recv(index).__plus((1));
  5036. return index;
  5037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5038. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5039. //>>excludeEnd("ctx");
  5040. }));
  5041. return instance;
  5042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5043. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  5044. //>>excludeEnd("ctx");
  5045. }; }),
  5046. $globals.Array.a$cls);
  5047. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5048. //>>excludeStart("ide", pragmas.excludeIdeData);
  5049. $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 >> #,`";
  5050. //>>excludeEnd("ide");
  5051. $core.addMethod(
  5052. $core.method({
  5053. selector: ",",
  5054. protocol: "copying",
  5055. //>>excludeStart("ide", pragmas.excludeIdeData);
  5056. args: ["aString"],
  5057. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5058. referencedClasses: [],
  5059. //>>excludeEnd("ide");
  5060. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  5061. messageSends: []
  5062. }, function ($methodClass){ return function (aString){
  5063. var self=this,$self=this;
  5064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5065. return $core.withContext(function($ctx1) {
  5066. //>>excludeEnd("ctx");
  5067. return String(self) + aString;
  5068. return self;
  5069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5070. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  5071. //>>excludeEnd("ctx");
  5072. }; }),
  5073. $globals.String);
  5074. $core.addMethod(
  5075. $core.method({
  5076. selector: "<",
  5077. protocol: "comparing",
  5078. //>>excludeStart("ide", pragmas.excludeIdeData);
  5079. args: ["aString"],
  5080. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5081. referencedClasses: [],
  5082. //>>excludeEnd("ide");
  5083. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  5084. messageSends: []
  5085. }, function ($methodClass){ return function (aString){
  5086. var self=this,$self=this;
  5087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5088. return $core.withContext(function($ctx1) {
  5089. //>>excludeEnd("ctx");
  5090. return String(self) < aString._asString();
  5091. return self;
  5092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5093. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5094. //>>excludeEnd("ctx");
  5095. }; }),
  5096. $globals.String);
  5097. $core.addMethod(
  5098. $core.method({
  5099. selector: "<=",
  5100. protocol: "comparing",
  5101. //>>excludeStart("ide", pragmas.excludeIdeData);
  5102. args: ["aString"],
  5103. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5104. referencedClasses: [],
  5105. //>>excludeEnd("ide");
  5106. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5107. messageSends: []
  5108. }, function ($methodClass){ return function (aString){
  5109. var self=this,$self=this;
  5110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5111. return $core.withContext(function($ctx1) {
  5112. //>>excludeEnd("ctx");
  5113. return String(self) <= aString._asString();
  5114. return self;
  5115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5116. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5117. //>>excludeEnd("ctx");
  5118. }; }),
  5119. $globals.String);
  5120. $core.addMethod(
  5121. $core.method({
  5122. selector: "=",
  5123. protocol: "comparing",
  5124. //>>excludeStart("ide", pragmas.excludeIdeData);
  5125. args: ["aString"],
  5126. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5127. referencedClasses: [],
  5128. //>>excludeEnd("ide");
  5129. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5130. messageSends: []
  5131. }, function ($methodClass){ return function (aString){
  5132. var self=this,$self=this;
  5133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5134. return $core.withContext(function($ctx1) {
  5135. //>>excludeEnd("ctx");
  5136. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5137. return self;
  5138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5139. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5140. //>>excludeEnd("ctx");
  5141. }; }),
  5142. $globals.String);
  5143. $core.addMethod(
  5144. $core.method({
  5145. selector: "==",
  5146. protocol: "comparing",
  5147. //>>excludeStart("ide", pragmas.excludeIdeData);
  5148. args: ["aString"],
  5149. 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'>",
  5150. referencedClasses: [],
  5151. //>>excludeEnd("ide");
  5152. 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;"]]],
  5153. messageSends: []
  5154. }, function ($methodClass){ return function (aString){
  5155. var self=this,$self=this;
  5156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5157. return $core.withContext(function($ctx1) {
  5158. //>>excludeEnd("ctx");
  5159. if (typeof aString === "string") return String(self) === aString;
  5160. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5161. else return false;;
  5162. return self;
  5163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5164. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5165. //>>excludeEnd("ctx");
  5166. }; }),
  5167. $globals.String);
  5168. $core.addMethod(
  5169. $core.method({
  5170. selector: ">",
  5171. protocol: "comparing",
  5172. //>>excludeStart("ide", pragmas.excludeIdeData);
  5173. args: ["aString"],
  5174. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5175. referencedClasses: [],
  5176. //>>excludeEnd("ide");
  5177. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5178. messageSends: []
  5179. }, function ($methodClass){ return function (aString){
  5180. var self=this,$self=this;
  5181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5182. return $core.withContext(function($ctx1) {
  5183. //>>excludeEnd("ctx");
  5184. return String(self) > aString._asString();
  5185. return self;
  5186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5187. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5188. //>>excludeEnd("ctx");
  5189. }; }),
  5190. $globals.String);
  5191. $core.addMethod(
  5192. $core.method({
  5193. selector: ">=",
  5194. protocol: "comparing",
  5195. //>>excludeStart("ide", pragmas.excludeIdeData);
  5196. args: ["aString"],
  5197. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5198. referencedClasses: [],
  5199. //>>excludeEnd("ide");
  5200. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5201. messageSends: []
  5202. }, function ($methodClass){ return function (aString){
  5203. var self=this,$self=this;
  5204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5205. return $core.withContext(function($ctx1) {
  5206. //>>excludeEnd("ctx");
  5207. return String(self) >= aString._asString();
  5208. return self;
  5209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5210. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5211. //>>excludeEnd("ctx");
  5212. }; }),
  5213. $globals.String);
  5214. $core.addMethod(
  5215. $core.method({
  5216. selector: "add:",
  5217. protocol: "adding/removing",
  5218. //>>excludeStart("ide", pragmas.excludeIdeData);
  5219. args: ["anObject"],
  5220. source: "add: anObject\x0a\x09self errorReadOnly",
  5221. referencedClasses: [],
  5222. //>>excludeEnd("ide");
  5223. pragmas: [],
  5224. messageSends: ["errorReadOnly"]
  5225. }, function ($methodClass){ return function (anObject){
  5226. var self=this,$self=this;
  5227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5228. return $core.withContext(function($ctx1) {
  5229. //>>excludeEnd("ctx");
  5230. $self._errorReadOnly();
  5231. return self;
  5232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5233. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5234. //>>excludeEnd("ctx");
  5235. }; }),
  5236. $globals.String);
  5237. $core.addMethod(
  5238. $core.method({
  5239. selector: "asJavaScriptMethodName",
  5240. protocol: "converting",
  5241. //>>excludeStart("ide", pragmas.excludeIdeData);
  5242. args: [],
  5243. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5244. referencedClasses: [],
  5245. //>>excludeEnd("ide");
  5246. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5247. messageSends: []
  5248. }, function ($methodClass){ return function (){
  5249. var self=this,$self=this;
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. return $core.withContext(function($ctx1) {
  5252. //>>excludeEnd("ctx");
  5253. return $core.st2js(self);
  5254. return self;
  5255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5256. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5257. //>>excludeEnd("ctx");
  5258. }; }),
  5259. $globals.String);
  5260. $core.addMethod(
  5261. $core.method({
  5262. selector: "asJavaScriptObject",
  5263. protocol: "converting",
  5264. //>>excludeStart("ide", pragmas.excludeIdeData);
  5265. args: [],
  5266. source: "asJavaScriptObject\x0a\x09^ self",
  5267. referencedClasses: [],
  5268. //>>excludeEnd("ide");
  5269. pragmas: [],
  5270. messageSends: []
  5271. }, function ($methodClass){ return function (){
  5272. var self=this,$self=this;
  5273. return self;
  5274. }; }),
  5275. $globals.String);
  5276. $core.addMethod(
  5277. $core.method({
  5278. selector: "asJavaScriptSource",
  5279. protocol: "converting",
  5280. //>>excludeStart("ide", pragmas.excludeIdeData);
  5281. args: [],
  5282. 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'>",
  5283. referencedClasses: [],
  5284. //>>excludeEnd("ide");
  5285. 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"]]],
  5286. messageSends: []
  5287. }, function ($methodClass){ return function (){
  5288. var self=this,$self=this;
  5289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5290. return $core.withContext(function($ctx1) {
  5291. //>>excludeEnd("ctx");
  5292. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5293. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5294. else
  5295. return "\"" + self + "\"";
  5296. ;
  5297. return self;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5300. //>>excludeEnd("ctx");
  5301. }; }),
  5302. $globals.String);
  5303. $core.addMethod(
  5304. $core.method({
  5305. selector: "asLowercase",
  5306. protocol: "converting",
  5307. //>>excludeStart("ide", pragmas.excludeIdeData);
  5308. args: [],
  5309. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5310. referencedClasses: [],
  5311. //>>excludeEnd("ide");
  5312. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5313. messageSends: []
  5314. }, function ($methodClass){ return function (){
  5315. var self=this,$self=this;
  5316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5317. return $core.withContext(function($ctx1) {
  5318. //>>excludeEnd("ctx");
  5319. return self.toLowerCase();
  5320. return self;
  5321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5322. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5323. //>>excludeEnd("ctx");
  5324. }; }),
  5325. $globals.String);
  5326. $core.addMethod(
  5327. $core.method({
  5328. selector: "asMutator",
  5329. protocol: "converting",
  5330. //>>excludeStart("ide", pragmas.excludeIdeData);
  5331. args: [],
  5332. 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",
  5333. referencedClasses: [],
  5334. //>>excludeEnd("ide");
  5335. pragmas: [],
  5336. messageSends: ["ifFalse:", "=", "last", ","]
  5337. }, function ($methodClass){ return function (){
  5338. var self=this,$self=this;
  5339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5340. return $core.withContext(function($ctx1) {
  5341. //>>excludeEnd("ctx");
  5342. if(!$core.assert($recv($self._last()).__eq(":"))){
  5343. return $self.__comma(":");
  5344. }
  5345. return self;
  5346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5347. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5348. //>>excludeEnd("ctx");
  5349. }; }),
  5350. $globals.String);
  5351. $core.addMethod(
  5352. $core.method({
  5353. selector: "asNumber",
  5354. protocol: "converting",
  5355. //>>excludeStart("ide", pragmas.excludeIdeData);
  5356. args: [],
  5357. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5358. referencedClasses: [],
  5359. //>>excludeEnd("ide");
  5360. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5361. messageSends: []
  5362. }, function ($methodClass){ return function (){
  5363. var self=this,$self=this;
  5364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5365. return $core.withContext(function($ctx1) {
  5366. //>>excludeEnd("ctx");
  5367. return Number(self);
  5368. return self;
  5369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5370. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5371. //>>excludeEnd("ctx");
  5372. }; }),
  5373. $globals.String);
  5374. $core.addMethod(
  5375. $core.method({
  5376. selector: "asRegexp",
  5377. protocol: "converting",
  5378. //>>excludeStart("ide", pragmas.excludeIdeData);
  5379. args: [],
  5380. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5381. referencedClasses: ["RegularExpression"],
  5382. //>>excludeEnd("ide");
  5383. pragmas: [],
  5384. messageSends: ["fromString:"]
  5385. }, function ($methodClass){ return function (){
  5386. var self=this,$self=this;
  5387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5388. return $core.withContext(function($ctx1) {
  5389. //>>excludeEnd("ctx");
  5390. return $recv($globals.RegularExpression)._fromString_(self);
  5391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5392. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5393. //>>excludeEnd("ctx");
  5394. }; }),
  5395. $globals.String);
  5396. $core.addMethod(
  5397. $core.method({
  5398. selector: "asString",
  5399. protocol: "converting",
  5400. //>>excludeStart("ide", pragmas.excludeIdeData);
  5401. args: [],
  5402. source: "asString\x0a\x09^ self",
  5403. referencedClasses: [],
  5404. //>>excludeEnd("ide");
  5405. pragmas: [],
  5406. messageSends: []
  5407. }, function ($methodClass){ return function (){
  5408. var self=this,$self=this;
  5409. return self;
  5410. }; }),
  5411. $globals.String);
  5412. $core.addMethod(
  5413. $core.method({
  5414. selector: "asSymbol",
  5415. protocol: "converting",
  5416. //>>excludeStart("ide", pragmas.excludeIdeData);
  5417. args: [],
  5418. source: "asSymbol\x0a\x09^ self",
  5419. referencedClasses: [],
  5420. //>>excludeEnd("ide");
  5421. pragmas: [],
  5422. messageSends: []
  5423. }, function ($methodClass){ return function (){
  5424. var self=this,$self=this;
  5425. return self;
  5426. }; }),
  5427. $globals.String);
  5428. $core.addMethod(
  5429. $core.method({
  5430. selector: "asSymbolPrintOn:",
  5431. protocol: "printing",
  5432. //>>excludeStart("ide", pragmas.excludeIdeData);
  5433. args: ["aStream"],
  5434. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5435. referencedClasses: [],
  5436. //>>excludeEnd("ide");
  5437. pragmas: [],
  5438. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5439. }, function ($methodClass){ return function (aStream){
  5440. var self=this,$self=this;
  5441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5442. return $core.withContext(function($ctx1) {
  5443. //>>excludeEnd("ctx");
  5444. $recv(aStream)._nextPutAll_("#");
  5445. if($core.assert($recv($self._asString())._isSelector())){
  5446. $recv(aStream)._nextPut_(self);
  5447. } else {
  5448. $self._printOn_(aStream);
  5449. }
  5450. return self;
  5451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5452. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5453. //>>excludeEnd("ctx");
  5454. }; }),
  5455. $globals.String);
  5456. $core.addMethod(
  5457. $core.method({
  5458. selector: "asUppercase",
  5459. protocol: "converting",
  5460. //>>excludeStart("ide", pragmas.excludeIdeData);
  5461. args: [],
  5462. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5463. referencedClasses: [],
  5464. //>>excludeEnd("ide");
  5465. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5466. messageSends: []
  5467. }, function ($methodClass){ return function (){
  5468. var self=this,$self=this;
  5469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5470. return $core.withContext(function($ctx1) {
  5471. //>>excludeEnd("ctx");
  5472. return self.toUpperCase();
  5473. return self;
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5476. //>>excludeEnd("ctx");
  5477. }; }),
  5478. $globals.String);
  5479. $core.addMethod(
  5480. $core.method({
  5481. selector: "asciiValue",
  5482. protocol: "accessing",
  5483. //>>excludeStart("ide", pragmas.excludeIdeData);
  5484. args: [],
  5485. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5486. referencedClasses: [],
  5487. //>>excludeEnd("ide");
  5488. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5489. messageSends: []
  5490. }, function ($methodClass){ return function (){
  5491. var self=this,$self=this;
  5492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5493. return $core.withContext(function($ctx1) {
  5494. //>>excludeEnd("ctx");
  5495. return self.charCodeAt(0);;
  5496. return self;
  5497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5498. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5499. //>>excludeEnd("ctx");
  5500. }; }),
  5501. $globals.String);
  5502. $core.addMethod(
  5503. $core.method({
  5504. selector: "at:ifAbsent:",
  5505. protocol: "accessing",
  5506. //>>excludeStart("ide", pragmas.excludeIdeData);
  5507. args: ["anIndex", "aBlock"],
  5508. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5509. referencedClasses: [],
  5510. //>>excludeEnd("ide");
  5511. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5512. messageSends: []
  5513. }, function ($methodClass){ return function (anIndex,aBlock){
  5514. var self=this,$self=this;
  5515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5516. return $core.withContext(function($ctx1) {
  5517. //>>excludeEnd("ctx");
  5518. return String(self)[anIndex - 1] || aBlock._value();
  5519. return self;
  5520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5521. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5522. //>>excludeEnd("ctx");
  5523. }; }),
  5524. $globals.String);
  5525. $core.addMethod(
  5526. $core.method({
  5527. selector: "at:ifPresent:ifAbsent:",
  5528. protocol: "accessing",
  5529. //>>excludeStart("ide", pragmas.excludeIdeData);
  5530. args: ["anIndex", "aBlock", "anotherBlock"],
  5531. 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'>",
  5532. referencedClasses: [],
  5533. //>>excludeEnd("ide");
  5534. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5535. messageSends: []
  5536. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5537. var self=this,$self=this;
  5538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5539. return $core.withContext(function($ctx1) {
  5540. //>>excludeEnd("ctx");
  5541. var result = String(self)[anIndex - 1];
  5542. return result ? aBlock._value_(result) : anotherBlock._value();
  5543. ;
  5544. return self;
  5545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5546. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5547. //>>excludeEnd("ctx");
  5548. }; }),
  5549. $globals.String);
  5550. $core.addMethod(
  5551. $core.method({
  5552. selector: "at:put:",
  5553. protocol: "accessing",
  5554. //>>excludeStart("ide", pragmas.excludeIdeData);
  5555. args: ["anIndex", "anObject"],
  5556. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5557. referencedClasses: [],
  5558. //>>excludeEnd("ide");
  5559. pragmas: [],
  5560. messageSends: ["errorReadOnly"]
  5561. }, function ($methodClass){ return function (anIndex,anObject){
  5562. var self=this,$self=this;
  5563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5564. return $core.withContext(function($ctx1) {
  5565. //>>excludeEnd("ctx");
  5566. $self._errorReadOnly();
  5567. return self;
  5568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5569. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5570. //>>excludeEnd("ctx");
  5571. }; }),
  5572. $globals.String);
  5573. $core.addMethod(
  5574. $core.method({
  5575. selector: "capitalized",
  5576. protocol: "converting",
  5577. //>>excludeStart("ide", pragmas.excludeIdeData);
  5578. args: [],
  5579. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5580. referencedClasses: [],
  5581. //>>excludeEnd("ide");
  5582. pragmas: [],
  5583. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5584. }, function ($methodClass){ return function (){
  5585. var self=this,$self=this;
  5586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5587. return $core.withContext(function($ctx1) {
  5588. //>>excludeEnd("ctx");
  5589. return $self._ifNotEmpty_((function(){
  5590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5591. return $core.withContext(function($ctx2) {
  5592. //>>excludeEnd("ctx");
  5593. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5595. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5596. //>>excludeEnd("ctx");
  5597. }));
  5598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5599. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5600. //>>excludeEnd("ctx");
  5601. }; }),
  5602. $globals.String);
  5603. $core.addMethod(
  5604. $core.method({
  5605. selector: "charCodeAt:",
  5606. protocol: "accessing",
  5607. //>>excludeStart("ide", pragmas.excludeIdeData);
  5608. args: ["anInteger"],
  5609. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5610. referencedClasses: [],
  5611. //>>excludeEnd("ide");
  5612. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5613. messageSends: []
  5614. }, function ($methodClass){ return function (anInteger){
  5615. var self=this,$self=this;
  5616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5617. return $core.withContext(function($ctx1) {
  5618. //>>excludeEnd("ctx");
  5619. return self.charCodeAt(anInteger - 1);
  5620. return self;
  5621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5622. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5623. //>>excludeEnd("ctx");
  5624. }; }),
  5625. $globals.String);
  5626. $core.addMethod(
  5627. $core.method({
  5628. selector: "copyFrom:to:",
  5629. protocol: "copying",
  5630. //>>excludeStart("ide", pragmas.excludeIdeData);
  5631. args: ["anIndex", "anotherIndex"],
  5632. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5633. referencedClasses: [],
  5634. //>>excludeEnd("ide");
  5635. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5636. messageSends: []
  5637. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5638. var self=this,$self=this;
  5639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5640. return $core.withContext(function($ctx1) {
  5641. //>>excludeEnd("ctx");
  5642. return self.substring(anIndex - 1, anotherIndex);
  5643. return self;
  5644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5645. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5646. //>>excludeEnd("ctx");
  5647. }; }),
  5648. $globals.String);
  5649. $core.addMethod(
  5650. $core.method({
  5651. selector: "copyWithFirst:",
  5652. protocol: "copying",
  5653. //>>excludeStart("ide", pragmas.excludeIdeData);
  5654. args: ["anObject"],
  5655. 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",
  5656. referencedClasses: [],
  5657. //>>excludeEnd("ide");
  5658. pragmas: [],
  5659. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5660. }, function ($methodClass){ return function (anObject){
  5661. var self=this,$self=this;
  5662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5663. return $core.withContext(function($ctx1) {
  5664. //>>excludeEnd("ctx");
  5665. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5667. return $core.withContext(function($ctx2) {
  5668. //>>excludeEnd("ctx");
  5669. return $recv($recv(anObject)._size()).__eq((1));
  5670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5672. //>>excludeEnd("ctx");
  5673. })))){
  5674. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5676. ,$ctx1.sendIdx[","]=2
  5677. //>>excludeEnd("ctx");
  5678. ][0]).__comma(" in a String")
  5679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5680. ,$ctx1.sendIdx[","]=1
  5681. //>>excludeEnd("ctx");
  5682. ][0]);
  5683. }
  5684. return $recv(anObject).__comma(self);
  5685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5686. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5687. //>>excludeEnd("ctx");
  5688. }; }),
  5689. $globals.String);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "crlfSanitized",
  5693. protocol: "converting",
  5694. //>>excludeStart("ide", pragmas.excludeIdeData);
  5695. args: [],
  5696. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5697. referencedClasses: ["String"],
  5698. //>>excludeEnd("ide");
  5699. pragmas: [],
  5700. messageSends: ["join:", "lines", "lf"]
  5701. }, function ($methodClass){ return function (){
  5702. var self=this,$self=this;
  5703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5704. return $core.withContext(function($ctx1) {
  5705. //>>excludeEnd("ctx");
  5706. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5709. //>>excludeEnd("ctx");
  5710. }; }),
  5711. $globals.String);
  5712. $core.addMethod(
  5713. $core.method({
  5714. selector: "deepCopy",
  5715. protocol: "copying",
  5716. //>>excludeStart("ide", pragmas.excludeIdeData);
  5717. args: [],
  5718. source: "deepCopy\x0a\x09^ self shallowCopy",
  5719. referencedClasses: [],
  5720. //>>excludeEnd("ide");
  5721. pragmas: [],
  5722. messageSends: ["shallowCopy"]
  5723. }, function ($methodClass){ return function (){
  5724. var self=this,$self=this;
  5725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5726. return $core.withContext(function($ctx1) {
  5727. //>>excludeEnd("ctx");
  5728. return $self._shallowCopy();
  5729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5730. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5731. //>>excludeEnd("ctx");
  5732. }; }),
  5733. $globals.String);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "errorReadOnly",
  5737. protocol: "error handling",
  5738. //>>excludeStart("ide", pragmas.excludeIdeData);
  5739. args: [],
  5740. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5741. referencedClasses: [],
  5742. //>>excludeEnd("ide");
  5743. pragmas: [],
  5744. messageSends: ["error:"]
  5745. }, function ($methodClass){ return function (){
  5746. var self=this,$self=this;
  5747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5748. return $core.withContext(function($ctx1) {
  5749. //>>excludeEnd("ctx");
  5750. $self._error_("Object is read-only");
  5751. return self;
  5752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5753. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5754. //>>excludeEnd("ctx");
  5755. }; }),
  5756. $globals.String);
  5757. $core.addMethod(
  5758. $core.method({
  5759. selector: "escaped",
  5760. protocol: "converting",
  5761. //>>excludeStart("ide", pragmas.excludeIdeData);
  5762. args: [],
  5763. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5764. referencedClasses: [],
  5765. //>>excludeEnd("ide");
  5766. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5767. messageSends: []
  5768. }, function ($methodClass){ return function (){
  5769. var self=this,$self=this;
  5770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5771. return $core.withContext(function($ctx1) {
  5772. //>>excludeEnd("ctx");
  5773. return escape(self);
  5774. return self;
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5777. //>>excludeEnd("ctx");
  5778. }; }),
  5779. $globals.String);
  5780. $core.addMethod(
  5781. $core.method({
  5782. selector: "includesSubString:",
  5783. protocol: "testing",
  5784. //>>excludeStart("ide", pragmas.excludeIdeData);
  5785. args: ["subString"],
  5786. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5787. referencedClasses: [],
  5788. //>>excludeEnd("ide");
  5789. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5790. messageSends: []
  5791. }, function ($methodClass){ return function (subString){
  5792. var self=this,$self=this;
  5793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5794. return $core.withContext(function($ctx1) {
  5795. //>>excludeEnd("ctx");
  5796. return self.indexOf(subString) != -1;
  5797. return self;
  5798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5799. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5800. //>>excludeEnd("ctx");
  5801. }; }),
  5802. $globals.String);
  5803. $core.addMethod(
  5804. $core.method({
  5805. selector: "isCapitalized",
  5806. protocol: "testing",
  5807. //>>excludeStart("ide", pragmas.excludeIdeData);
  5808. args: [],
  5809. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5810. referencedClasses: [],
  5811. //>>excludeEnd("ide");
  5812. pragmas: [],
  5813. messageSends: ["==", "asUppercase", "first"]
  5814. }, function ($methodClass){ return function (){
  5815. var self=this,$self=this;
  5816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5817. return $core.withContext(function($ctx1) {
  5818. //>>excludeEnd("ctx");
  5819. return $recv($recv([$self._first()
  5820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5821. ,$ctx1.sendIdx["first"]=1
  5822. //>>excludeEnd("ctx");
  5823. ][0])._asUppercase()).__eq_eq($self._first());
  5824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5825. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5826. //>>excludeEnd("ctx");
  5827. }; }),
  5828. $globals.String);
  5829. $core.addMethod(
  5830. $core.method({
  5831. selector: "isImmutable",
  5832. protocol: "testing",
  5833. //>>excludeStart("ide", pragmas.excludeIdeData);
  5834. args: [],
  5835. source: "isImmutable\x0a\x09^ true",
  5836. referencedClasses: [],
  5837. //>>excludeEnd("ide");
  5838. pragmas: [],
  5839. messageSends: []
  5840. }, function ($methodClass){ return function (){
  5841. var self=this,$self=this;
  5842. return true;
  5843. }; }),
  5844. $globals.String);
  5845. $core.addMethod(
  5846. $core.method({
  5847. selector: "isSelector",
  5848. protocol: "testing",
  5849. //>>excludeStart("ide", pragmas.excludeIdeData);
  5850. args: [],
  5851. 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>",
  5852. referencedClasses: [],
  5853. //>>excludeEnd("ide");
  5854. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5855. messageSends: []
  5856. }, function ($methodClass){ return function (){
  5857. var self=this,$self=this;
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. return $core.withContext(function($ctx1) {
  5860. //>>excludeEnd("ctx");
  5861. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5862. return self;
  5863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5864. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5865. //>>excludeEnd("ctx");
  5866. }; }),
  5867. $globals.String);
  5868. $core.addMethod(
  5869. $core.method({
  5870. selector: "isString",
  5871. protocol: "testing",
  5872. //>>excludeStart("ide", pragmas.excludeIdeData);
  5873. args: [],
  5874. source: "isString\x0a\x09^ true",
  5875. referencedClasses: [],
  5876. //>>excludeEnd("ide");
  5877. pragmas: [],
  5878. messageSends: []
  5879. }, function ($methodClass){ return function (){
  5880. var self=this,$self=this;
  5881. return true;
  5882. }; }),
  5883. $globals.String);
  5884. $core.addMethod(
  5885. $core.method({
  5886. selector: "isVowel",
  5887. protocol: "testing",
  5888. //>>excludeStart("ide", pragmas.excludeIdeData);
  5889. args: [],
  5890. 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 ]",
  5891. referencedClasses: [],
  5892. //>>excludeEnd("ide");
  5893. pragmas: [],
  5894. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5895. }, function ($methodClass){ return function (){
  5896. var self=this,$self=this;
  5897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5898. return $core.withContext(function($ctx1) {
  5899. //>>excludeEnd("ctx");
  5900. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5902. return $core.withContext(function($ctx2) {
  5903. //>>excludeEnd("ctx");
  5904. return "aeiou"._includes_($self._asLowercase());
  5905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5907. //>>excludeEnd("ctx");
  5908. }));
  5909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5910. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5911. //>>excludeEnd("ctx");
  5912. }; }),
  5913. $globals.String);
  5914. $core.addMethod(
  5915. $core.method({
  5916. selector: "join:",
  5917. protocol: "split join",
  5918. //>>excludeStart("ide", pragmas.excludeIdeData);
  5919. args: ["aCollection"],
  5920. 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 ]]",
  5921. referencedClasses: ["String"],
  5922. //>>excludeEnd("ide");
  5923. pragmas: [],
  5924. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5925. }, function ($methodClass){ return function (aCollection){
  5926. var self=this,$self=this;
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. return $core.withContext(function($ctx1) {
  5929. //>>excludeEnd("ctx");
  5930. return $recv($globals.String)._streamContents_((function(stream){
  5931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5932. return $core.withContext(function($ctx2) {
  5933. //>>excludeEnd("ctx");
  5934. return $recv(aCollection)._do_separatedBy_((function(each){
  5935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5936. return $core.withContext(function($ctx3) {
  5937. //>>excludeEnd("ctx");
  5938. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5940. ,$ctx3.sendIdx["nextPutAll:"]=1
  5941. //>>excludeEnd("ctx");
  5942. ][0];
  5943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5944. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5945. //>>excludeEnd("ctx");
  5946. }),(function(){
  5947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5948. return $core.withContext(function($ctx3) {
  5949. //>>excludeEnd("ctx");
  5950. return $recv(stream)._nextPutAll_(self);
  5951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5953. //>>excludeEnd("ctx");
  5954. }));
  5955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5956. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5957. //>>excludeEnd("ctx");
  5958. }));
  5959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5960. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5961. //>>excludeEnd("ctx");
  5962. }; }),
  5963. $globals.String);
  5964. $core.addMethod(
  5965. $core.method({
  5966. selector: "lineIndicesDo:",
  5967. protocol: "split join",
  5968. //>>excludeStart("ide", pragmas.excludeIdeData);
  5969. args: ["aBlock"],
  5970. 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 ] ]]",
  5971. referencedClasses: ["String"],
  5972. //>>excludeEnd("ide");
  5973. pragmas: [],
  5974. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5975. }, function ($methodClass){ return function (aBlock){
  5976. var self=this,$self=this;
  5977. var cr,lf,start,sz,nextLF,nextCR;
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. return $core.withContext(function($ctx1) {
  5980. //>>excludeEnd("ctx");
  5981. var $early={};
  5982. try {
  5983. start=(1);
  5984. sz=$self._size();
  5985. cr=$recv($globals.String)._cr();
  5986. nextCR=[$self._indexOf_startingAt_(cr,(1))
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  5989. //>>excludeEnd("ctx");
  5990. ][0];
  5991. lf=$recv($globals.String)._lf();
  5992. nextLF=[$self._indexOf_startingAt_(lf,(1))
  5993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5994. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  5995. //>>excludeEnd("ctx");
  5996. ][0];
  5997. $recv((function(){
  5998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5999. return $core.withContext(function($ctx2) {
  6000. //>>excludeEnd("ctx");
  6001. return $recv(start).__lt_eq(sz);
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6004. //>>excludeEnd("ctx");
  6005. }))._whileTrue_((function(){
  6006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6007. return $core.withContext(function($ctx2) {
  6008. //>>excludeEnd("ctx");
  6009. if($core.assert([$recv([$recv(nextLF).__eq((0))
  6010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6011. ,$ctx2.sendIdx["="]=1
  6012. //>>excludeEnd("ctx");
  6013. ][0])._and_((function(){
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. return $core.withContext(function($ctx3) {
  6016. //>>excludeEnd("ctx");
  6017. return [$recv(nextCR).__eq((0))
  6018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6019. ,$ctx3.sendIdx["="]=2
  6020. //>>excludeEnd("ctx");
  6021. ][0];
  6022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6023. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6024. //>>excludeEnd("ctx");
  6025. }))
  6026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6027. ,$ctx2.sendIdx["and:"]=1
  6028. //>>excludeEnd("ctx");
  6029. ][0])){
  6030. [$recv(aBlock)._value_value_value_(start,sz,sz)
  6031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6032. ,$ctx2.sendIdx["value:value:value:"]=1
  6033. //>>excludeEnd("ctx");
  6034. ][0];
  6035. throw $early=[self];
  6036. }
  6037. if($core.assert($recv([$recv(nextCR).__eq((0))
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. ,$ctx2.sendIdx["="]=3
  6040. //>>excludeEnd("ctx");
  6041. ][0])._or_((function(){
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. return $core.withContext(function($ctx3) {
  6044. //>>excludeEnd("ctx");
  6045. return $recv([(0).__lt(nextLF)
  6046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6047. ,$ctx3.sendIdx["<"]=1
  6048. //>>excludeEnd("ctx");
  6049. ][0])._and_((function(){
  6050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6051. return $core.withContext(function($ctx4) {
  6052. //>>excludeEnd("ctx");
  6053. return $recv(nextLF).__lt(nextCR);
  6054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6055. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6056. //>>excludeEnd("ctx");
  6057. }));
  6058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6059. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6060. //>>excludeEnd("ctx");
  6061. })))){
  6062. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  6063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6064. ,$ctx2.sendIdx["-"]=1
  6065. //>>excludeEnd("ctx");
  6066. ][0],nextLF)
  6067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6068. ,$ctx2.sendIdx["value:value:value:"]=2
  6069. //>>excludeEnd("ctx");
  6070. ][0];
  6071. start=[(1).__plus(nextLF)
  6072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6073. ,$ctx2.sendIdx["+"]=1
  6074. //>>excludeEnd("ctx");
  6075. ][0];
  6076. nextLF=[$self._indexOf_startingAt_(lf,start)
  6077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6078. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  6079. //>>excludeEnd("ctx");
  6080. ][0];
  6081. return nextLF;
  6082. } else {
  6083. if($core.assert($recv([(1).__plus(nextCR)
  6084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6085. ,$ctx2.sendIdx["+"]=2
  6086. //>>excludeEnd("ctx");
  6087. ][0]).__eq(nextLF))){
  6088. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6090. ,$ctx2.sendIdx["-"]=2
  6091. //>>excludeEnd("ctx");
  6092. ][0],nextLF)
  6093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6094. ,$ctx2.sendIdx["value:value:value:"]=3
  6095. //>>excludeEnd("ctx");
  6096. ][0];
  6097. start=[(1).__plus(nextLF)
  6098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6099. ,$ctx2.sendIdx["+"]=3
  6100. //>>excludeEnd("ctx");
  6101. ][0];
  6102. nextCR=[$self._indexOf_startingAt_(cr,start)
  6103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6104. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6105. //>>excludeEnd("ctx");
  6106. ][0];
  6107. nextLF=[$self._indexOf_startingAt_(lf,start)
  6108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6109. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6110. //>>excludeEnd("ctx");
  6111. ][0];
  6112. return nextLF;
  6113. } else {
  6114. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6115. start=(1).__plus(nextCR);
  6116. nextCR=$self._indexOf_startingAt_(cr,start);
  6117. return nextCR;
  6118. }
  6119. }
  6120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6121. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6122. //>>excludeEnd("ctx");
  6123. }));
  6124. return self;
  6125. }
  6126. catch(e) {if(e===$early)return e[0]; throw e}
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6129. //>>excludeEnd("ctx");
  6130. }; }),
  6131. $globals.String);
  6132. $core.addMethod(
  6133. $core.method({
  6134. selector: "lineNumber:",
  6135. protocol: "split join",
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["anIndex"],
  6138. 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",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. pragmas: [],
  6142. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6143. }, function ($methodClass){ return function (anIndex){
  6144. var self=this,$self=this;
  6145. var lineCount;
  6146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6147. return $core.withContext(function($ctx1) {
  6148. //>>excludeEnd("ctx");
  6149. var $early={};
  6150. try {
  6151. lineCount=(0);
  6152. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6154. return $core.withContext(function($ctx2) {
  6155. //>>excludeEnd("ctx");
  6156. lineCount=$recv(lineCount).__plus((1));
  6157. if($core.assert($recv(lineCount).__eq(anIndex))){
  6158. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6159. }
  6160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6161. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6162. //>>excludeEnd("ctx");
  6163. }));
  6164. return nil;
  6165. }
  6166. catch(e) {if(e===$early)return e[0]; throw e}
  6167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6168. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6169. //>>excludeEnd("ctx");
  6170. }; }),
  6171. $globals.String);
  6172. $core.addMethod(
  6173. $core.method({
  6174. selector: "lines",
  6175. protocol: "split join",
  6176. //>>excludeStart("ide", pragmas.excludeIdeData);
  6177. args: [],
  6178. 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'>",
  6179. referencedClasses: [],
  6180. //>>excludeEnd("ide");
  6181. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6182. messageSends: []
  6183. }, function ($methodClass){ return function (){
  6184. var self=this,$self=this;
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. return $core.withContext(function($ctx1) {
  6187. //>>excludeEnd("ctx");
  6188. var result = self.split(/\r\n|\r|\n/);
  6189. if (!result[result.length-1]) result.pop();
  6190. return result;;
  6191. return self;
  6192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6193. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6194. //>>excludeEnd("ctx");
  6195. }; }),
  6196. $globals.String);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "linesDo:",
  6200. protocol: "split join",
  6201. //>>excludeStart("ide", pragmas.excludeIdeData);
  6202. args: ["aBlock"],
  6203. 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",
  6204. referencedClasses: [],
  6205. //>>excludeEnd("ide");
  6206. pragmas: [],
  6207. messageSends: ["do:", "lines"]
  6208. }, function ($methodClass){ return function (aBlock){
  6209. var self=this,$self=this;
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. return $core.withContext(function($ctx1) {
  6212. //>>excludeEnd("ctx");
  6213. $recv($self._lines())._do_(aBlock);
  6214. return self;
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6217. //>>excludeEnd("ctx");
  6218. }; }),
  6219. $globals.String);
  6220. $core.addMethod(
  6221. $core.method({
  6222. selector: "match:",
  6223. protocol: "regular expressions",
  6224. //>>excludeStart("ide", pragmas.excludeIdeData);
  6225. args: ["aRegexp"],
  6226. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6227. referencedClasses: [],
  6228. //>>excludeEnd("ide");
  6229. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6230. messageSends: []
  6231. }, function ($methodClass){ return function (aRegexp){
  6232. var self=this,$self=this;
  6233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6234. return $core.withContext(function($ctx1) {
  6235. //>>excludeEnd("ctx");
  6236. return self.search(aRegexp) != -1;
  6237. return self;
  6238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6239. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6240. //>>excludeEnd("ctx");
  6241. }; }),
  6242. $globals.String);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "matchesOf:",
  6246. protocol: "regular expressions",
  6247. //>>excludeStart("ide", pragmas.excludeIdeData);
  6248. args: ["aRegularExpression"],
  6249. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6250. referencedClasses: [],
  6251. //>>excludeEnd("ide");
  6252. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6253. messageSends: []
  6254. }, function ($methodClass){ return function (aRegularExpression){
  6255. var self=this,$self=this;
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. return $core.withContext(function($ctx1) {
  6258. //>>excludeEnd("ctx");
  6259. return self.match(aRegularExpression);
  6260. return self;
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6263. //>>excludeEnd("ctx");
  6264. }; }),
  6265. $globals.String);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "printNl",
  6269. protocol: "printing",
  6270. //>>excludeStart("ide", pragmas.excludeIdeData);
  6271. args: [],
  6272. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6273. referencedClasses: [],
  6274. //>>excludeEnd("ide");
  6275. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6276. messageSends: []
  6277. }, function ($methodClass){ return function (){
  6278. var self=this,$self=this;
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. return $core.withContext(function($ctx1) {
  6281. //>>excludeEnd("ctx");
  6282. console.log(self);
  6283. return self;
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6286. //>>excludeEnd("ctx");
  6287. }; }),
  6288. $globals.String);
  6289. $core.addMethod(
  6290. $core.method({
  6291. selector: "printOn:",
  6292. protocol: "printing",
  6293. //>>excludeStart("ide", pragmas.excludeIdeData);
  6294. args: ["aStream"],
  6295. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6296. referencedClasses: [],
  6297. //>>excludeEnd("ide");
  6298. pragmas: [],
  6299. messageSends: ["nextPutAll:", "replace:with:"]
  6300. }, function ($methodClass){ return function (aStream){
  6301. var self=this,$self=this;
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. return $core.withContext(function($ctx1) {
  6304. //>>excludeEnd("ctx");
  6305. [$recv(aStream)._nextPutAll_("'")
  6306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6307. ,$ctx1.sendIdx["nextPutAll:"]=1
  6308. //>>excludeEnd("ctx");
  6309. ][0];
  6310. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. ,$ctx1.sendIdx["nextPutAll:"]=2
  6313. //>>excludeEnd("ctx");
  6314. ][0];
  6315. $recv(aStream)._nextPutAll_("'");
  6316. return self;
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6319. //>>excludeEnd("ctx");
  6320. }; }),
  6321. $globals.String);
  6322. $core.addMethod(
  6323. $core.method({
  6324. selector: "putOn:",
  6325. protocol: "streaming",
  6326. //>>excludeStart("ide", pragmas.excludeIdeData);
  6327. args: ["aStream"],
  6328. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6329. referencedClasses: [],
  6330. //>>excludeEnd("ide");
  6331. pragmas: [],
  6332. messageSends: ["nextPutString:"]
  6333. }, function ($methodClass){ return function (aStream){
  6334. var self=this,$self=this;
  6335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6336. return $core.withContext(function($ctx1) {
  6337. //>>excludeEnd("ctx");
  6338. $recv(aStream)._nextPutString_(self);
  6339. return self;
  6340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6341. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6342. //>>excludeEnd("ctx");
  6343. }; }),
  6344. $globals.String);
  6345. $core.addMethod(
  6346. $core.method({
  6347. selector: "remove:",
  6348. protocol: "adding/removing",
  6349. //>>excludeStart("ide", pragmas.excludeIdeData);
  6350. args: ["anObject"],
  6351. source: "remove: anObject\x0a\x09self errorReadOnly",
  6352. referencedClasses: [],
  6353. //>>excludeEnd("ide");
  6354. pragmas: [],
  6355. messageSends: ["errorReadOnly"]
  6356. }, function ($methodClass){ return function (anObject){
  6357. var self=this,$self=this;
  6358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6359. return $core.withContext(function($ctx1) {
  6360. //>>excludeEnd("ctx");
  6361. $self._errorReadOnly();
  6362. return self;
  6363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6364. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6365. //>>excludeEnd("ctx");
  6366. }; }),
  6367. $globals.String);
  6368. $core.addMethod(
  6369. $core.method({
  6370. selector: "remove:ifAbsent:",
  6371. protocol: "adding/removing",
  6372. //>>excludeStart("ide", pragmas.excludeIdeData);
  6373. args: ["anObject", "aBlock"],
  6374. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6375. referencedClasses: [],
  6376. //>>excludeEnd("ide");
  6377. pragmas: [],
  6378. messageSends: ["errorReadOnly"]
  6379. }, function ($methodClass){ return function (anObject,aBlock){
  6380. var self=this,$self=this;
  6381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6382. return $core.withContext(function($ctx1) {
  6383. //>>excludeEnd("ctx");
  6384. $self._errorReadOnly();
  6385. return self;
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6388. //>>excludeEnd("ctx");
  6389. }; }),
  6390. $globals.String);
  6391. $core.addMethod(
  6392. $core.method({
  6393. selector: "replace:with:",
  6394. protocol: "regular expressions",
  6395. //>>excludeStart("ide", pragmas.excludeIdeData);
  6396. args: ["aString", "anotherString"],
  6397. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6398. referencedClasses: ["RegularExpression"],
  6399. //>>excludeEnd("ide");
  6400. pragmas: [],
  6401. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6402. }, function ($methodClass){ return function (aString,anotherString){
  6403. var self=this,$self=this;
  6404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6405. return $core.withContext(function($ctx1) {
  6406. //>>excludeEnd("ctx");
  6407. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6410. //>>excludeEnd("ctx");
  6411. }; }),
  6412. $globals.String);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "replaceRegexp:with:",
  6416. protocol: "regular expressions",
  6417. //>>excludeStart("ide", pragmas.excludeIdeData);
  6418. args: ["aRegexp", "aString"],
  6419. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6420. referencedClasses: [],
  6421. //>>excludeEnd("ide");
  6422. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6423. messageSends: []
  6424. }, function ($methodClass){ return function (aRegexp,aString){
  6425. var self=this,$self=this;
  6426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6427. return $core.withContext(function($ctx1) {
  6428. //>>excludeEnd("ctx");
  6429. return self.replace(aRegexp, aString);
  6430. return self;
  6431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6432. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6433. //>>excludeEnd("ctx");
  6434. }; }),
  6435. $globals.String);
  6436. $core.addMethod(
  6437. $core.method({
  6438. selector: "reversed",
  6439. protocol: "converting",
  6440. //>>excludeStart("ide", pragmas.excludeIdeData);
  6441. args: [],
  6442. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6443. referencedClasses: [],
  6444. //>>excludeEnd("ide");
  6445. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6446. messageSends: []
  6447. }, function ($methodClass){ return function (){
  6448. var self=this,$self=this;
  6449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6450. return $core.withContext(function($ctx1) {
  6451. //>>excludeEnd("ctx");
  6452. return self.split("").reverse().join("");
  6453. return self;
  6454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6455. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6456. //>>excludeEnd("ctx");
  6457. }; }),
  6458. $globals.String);
  6459. $core.addMethod(
  6460. $core.method({
  6461. selector: "shallowCopy",
  6462. protocol: "copying",
  6463. //>>excludeStart("ide", pragmas.excludeIdeData);
  6464. args: [],
  6465. source: "shallowCopy\x0a\x09^ self",
  6466. referencedClasses: [],
  6467. //>>excludeEnd("ide");
  6468. pragmas: [],
  6469. messageSends: []
  6470. }, function ($methodClass){ return function (){
  6471. var self=this,$self=this;
  6472. return self;
  6473. }; }),
  6474. $globals.String);
  6475. $core.addMethod(
  6476. $core.method({
  6477. selector: "shortenedPrintString",
  6478. protocol: "printing",
  6479. //>>excludeStart("ide", pragmas.excludeIdeData);
  6480. args: [],
  6481. source: "shortenedPrintString\x0a\x09^ self printString size > 30\x0a\x09\x09ifTrue: [ (self printString copyFrom: 1 to: 30), '...''' ]\x0a\x09\x09ifFalse: [ self printString ]",
  6482. referencedClasses: [],
  6483. //>>excludeEnd("ide");
  6484. pragmas: [],
  6485. messageSends: ["ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:"]
  6486. }, function ($methodClass){ return function (){
  6487. var self=this,$self=this;
  6488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6489. return $core.withContext(function($ctx1) {
  6490. //>>excludeEnd("ctx");
  6491. if($core.assert($recv($recv([$self._printString()
  6492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6493. ,$ctx1.sendIdx["printString"]=1
  6494. //>>excludeEnd("ctx");
  6495. ][0])._size()).__gt((30)))){
  6496. return $recv($recv([$self._printString()
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. ,$ctx1.sendIdx["printString"]=2
  6499. //>>excludeEnd("ctx");
  6500. ][0])._copyFrom_to_((1),(30))).__comma("...'");
  6501. } else {
  6502. return $self._printString();
  6503. }
  6504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6505. }, function($ctx1) {$ctx1.fill(self,"shortenedPrintString",{})});
  6506. //>>excludeEnd("ctx");
  6507. }; }),
  6508. $globals.String);
  6509. $core.addMethod(
  6510. $core.method({
  6511. selector: "subStrings:",
  6512. protocol: "split join",
  6513. //>>excludeStart("ide", pragmas.excludeIdeData);
  6514. args: ["aString"],
  6515. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6516. referencedClasses: [],
  6517. //>>excludeEnd("ide");
  6518. pragmas: [],
  6519. messageSends: ["tokenize:"]
  6520. }, function ($methodClass){ return function (aString){
  6521. var self=this,$self=this;
  6522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6523. return $core.withContext(function($ctx1) {
  6524. //>>excludeEnd("ctx");
  6525. return $self._tokenize_(aString);
  6526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6527. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6528. //>>excludeEnd("ctx");
  6529. }; }),
  6530. $globals.String);
  6531. $core.addMethod(
  6532. $core.method({
  6533. selector: "symbolPrintString",
  6534. protocol: "printing",
  6535. //>>excludeStart("ide", pragmas.excludeIdeData);
  6536. args: [],
  6537. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6538. referencedClasses: ["String"],
  6539. //>>excludeEnd("ide");
  6540. pragmas: [],
  6541. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6542. }, function ($methodClass){ return function (){
  6543. var self=this,$self=this;
  6544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6545. return $core.withContext(function($ctx1) {
  6546. //>>excludeEnd("ctx");
  6547. return $recv($globals.String)._streamContents_((function(str){
  6548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6549. return $core.withContext(function($ctx2) {
  6550. //>>excludeEnd("ctx");
  6551. return $self._asSymbolPrintOn_(str);
  6552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6553. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6554. //>>excludeEnd("ctx");
  6555. }));
  6556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6557. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6558. //>>excludeEnd("ctx");
  6559. }; }),
  6560. $globals.String);
  6561. $core.addMethod(
  6562. $core.method({
  6563. selector: "tokenize:",
  6564. protocol: "split join",
  6565. //>>excludeStart("ide", pragmas.excludeIdeData);
  6566. args: ["aString"],
  6567. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6568. referencedClasses: [],
  6569. //>>excludeEnd("ide");
  6570. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6571. messageSends: []
  6572. }, function ($methodClass){ return function (aString){
  6573. var self=this,$self=this;
  6574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6575. return $core.withContext(function($ctx1) {
  6576. //>>excludeEnd("ctx");
  6577. return self.split(aString);
  6578. return self;
  6579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6580. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6581. //>>excludeEnd("ctx");
  6582. }; }),
  6583. $globals.String);
  6584. $core.addMethod(
  6585. $core.method({
  6586. selector: "trimBoth",
  6587. protocol: "regular expressions",
  6588. //>>excludeStart("ide", pragmas.excludeIdeData);
  6589. args: [],
  6590. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6591. referencedClasses: [],
  6592. //>>excludeEnd("ide");
  6593. pragmas: [],
  6594. messageSends: ["trimBoth:"]
  6595. }, function ($methodClass){ return function (){
  6596. var self=this,$self=this;
  6597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6598. return $core.withContext(function($ctx1) {
  6599. //>>excludeEnd("ctx");
  6600. return $self._trimBoth_("\x5cs");
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6603. //>>excludeEnd("ctx");
  6604. }; }),
  6605. $globals.String);
  6606. $core.addMethod(
  6607. $core.method({
  6608. selector: "trimBoth:",
  6609. protocol: "regular expressions",
  6610. //>>excludeStart("ide", pragmas.excludeIdeData);
  6611. args: ["separators"],
  6612. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6613. referencedClasses: [],
  6614. //>>excludeEnd("ide");
  6615. pragmas: [],
  6616. messageSends: ["trimRight:", "trimLeft:"]
  6617. }, function ($methodClass){ return function (separators){
  6618. var self=this,$self=this;
  6619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6620. return $core.withContext(function($ctx1) {
  6621. //>>excludeEnd("ctx");
  6622. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6624. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6625. //>>excludeEnd("ctx");
  6626. }; }),
  6627. $globals.String);
  6628. $core.addMethod(
  6629. $core.method({
  6630. selector: "trimLeft",
  6631. protocol: "regular expressions",
  6632. //>>excludeStart("ide", pragmas.excludeIdeData);
  6633. args: [],
  6634. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6635. referencedClasses: [],
  6636. //>>excludeEnd("ide");
  6637. pragmas: [],
  6638. messageSends: ["trimLeft:"]
  6639. }, function ($methodClass){ return function (){
  6640. var self=this,$self=this;
  6641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6642. return $core.withContext(function($ctx1) {
  6643. //>>excludeEnd("ctx");
  6644. return $self._trimLeft_("\x5cs");
  6645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6646. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6647. //>>excludeEnd("ctx");
  6648. }; }),
  6649. $globals.String);
  6650. $core.addMethod(
  6651. $core.method({
  6652. selector: "trimLeft:",
  6653. protocol: "regular expressions",
  6654. //>>excludeStart("ide", pragmas.excludeIdeData);
  6655. args: ["separators"],
  6656. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6657. referencedClasses: ["RegularExpression"],
  6658. //>>excludeEnd("ide");
  6659. pragmas: [],
  6660. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6661. }, function ($methodClass){ return function (separators){
  6662. var self=this,$self=this;
  6663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6664. return $core.withContext(function($ctx1) {
  6665. //>>excludeEnd("ctx");
  6666. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6668. ,$ctx1.sendIdx[","]=1
  6669. //>>excludeEnd("ctx");
  6670. ][0],"g"),"");
  6671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6672. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6673. //>>excludeEnd("ctx");
  6674. }; }),
  6675. $globals.String);
  6676. $core.addMethod(
  6677. $core.method({
  6678. selector: "trimRight",
  6679. protocol: "regular expressions",
  6680. //>>excludeStart("ide", pragmas.excludeIdeData);
  6681. args: [],
  6682. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6683. referencedClasses: [],
  6684. //>>excludeEnd("ide");
  6685. pragmas: [],
  6686. messageSends: ["trimRight:"]
  6687. }, function ($methodClass){ return function (){
  6688. var self=this,$self=this;
  6689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6690. return $core.withContext(function($ctx1) {
  6691. //>>excludeEnd("ctx");
  6692. return $self._trimRight_("\x5cs");
  6693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6694. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6695. //>>excludeEnd("ctx");
  6696. }; }),
  6697. $globals.String);
  6698. $core.addMethod(
  6699. $core.method({
  6700. selector: "trimRight:",
  6701. protocol: "regular expressions",
  6702. //>>excludeStart("ide", pragmas.excludeIdeData);
  6703. args: ["separators"],
  6704. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6705. referencedClasses: ["RegularExpression"],
  6706. //>>excludeEnd("ide");
  6707. pragmas: [],
  6708. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6709. }, function ($methodClass){ return function (separators){
  6710. var self=this,$self=this;
  6711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6712. return $core.withContext(function($ctx1) {
  6713. //>>excludeEnd("ctx");
  6714. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6716. ,$ctx1.sendIdx[","]=1
  6717. //>>excludeEnd("ctx");
  6718. ][0],"g"),"");
  6719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6720. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6721. //>>excludeEnd("ctx");
  6722. }; }),
  6723. $globals.String);
  6724. $core.addMethod(
  6725. $core.method({
  6726. selector: "unescaped",
  6727. protocol: "converting",
  6728. //>>excludeStart("ide", pragmas.excludeIdeData);
  6729. args: [],
  6730. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6731. referencedClasses: [],
  6732. //>>excludeEnd("ide");
  6733. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6734. messageSends: []
  6735. }, function ($methodClass){ return function (){
  6736. var self=this,$self=this;
  6737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6738. return $core.withContext(function($ctx1) {
  6739. //>>excludeEnd("ctx");
  6740. return unescape(self);
  6741. return self;
  6742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6743. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6744. //>>excludeEnd("ctx");
  6745. }; }),
  6746. $globals.String);
  6747. $core.addMethod(
  6748. $core.method({
  6749. selector: "uriComponentDecoded",
  6750. protocol: "converting",
  6751. //>>excludeStart("ide", pragmas.excludeIdeData);
  6752. args: [],
  6753. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6754. referencedClasses: [],
  6755. //>>excludeEnd("ide");
  6756. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6757. messageSends: []
  6758. }, function ($methodClass){ return function (){
  6759. var self=this,$self=this;
  6760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6761. return $core.withContext(function($ctx1) {
  6762. //>>excludeEnd("ctx");
  6763. return decodeURIComponent(self);
  6764. return self;
  6765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6766. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6767. //>>excludeEnd("ctx");
  6768. }; }),
  6769. $globals.String);
  6770. $core.addMethod(
  6771. $core.method({
  6772. selector: "uriComponentEncoded",
  6773. protocol: "converting",
  6774. //>>excludeStart("ide", pragmas.excludeIdeData);
  6775. args: [],
  6776. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6777. referencedClasses: [],
  6778. //>>excludeEnd("ide");
  6779. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6780. messageSends: []
  6781. }, function ($methodClass){ return function (){
  6782. var self=this,$self=this;
  6783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6784. return $core.withContext(function($ctx1) {
  6785. //>>excludeEnd("ctx");
  6786. return encodeURIComponent(self);
  6787. return self;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6790. //>>excludeEnd("ctx");
  6791. }; }),
  6792. $globals.String);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "uriDecoded",
  6796. protocol: "converting",
  6797. //>>excludeStart("ide", pragmas.excludeIdeData);
  6798. args: [],
  6799. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6800. referencedClasses: [],
  6801. //>>excludeEnd("ide");
  6802. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6803. messageSends: []
  6804. }, function ($methodClass){ return function (){
  6805. var self=this,$self=this;
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. return $core.withContext(function($ctx1) {
  6808. //>>excludeEnd("ctx");
  6809. return decodeURI(self);
  6810. return self;
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6813. //>>excludeEnd("ctx");
  6814. }; }),
  6815. $globals.String);
  6816. $core.addMethod(
  6817. $core.method({
  6818. selector: "uriEncoded",
  6819. protocol: "converting",
  6820. //>>excludeStart("ide", pragmas.excludeIdeData);
  6821. args: [],
  6822. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6823. referencedClasses: [],
  6824. //>>excludeEnd("ide");
  6825. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6826. messageSends: []
  6827. }, function ($methodClass){ return function (){
  6828. var self=this,$self=this;
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. return $core.withContext(function($ctx1) {
  6831. //>>excludeEnd("ctx");
  6832. return encodeURI(self);
  6833. return self;
  6834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6835. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6836. //>>excludeEnd("ctx");
  6837. }; }),
  6838. $globals.String);
  6839. $core.addMethod(
  6840. $core.method({
  6841. selector: "value:",
  6842. protocol: "evaluating",
  6843. //>>excludeStart("ide", pragmas.excludeIdeData);
  6844. args: ["anObject"],
  6845. source: "value: anObject \x0a\x09^ anObject perform: self",
  6846. referencedClasses: [],
  6847. //>>excludeEnd("ide");
  6848. pragmas: [],
  6849. messageSends: ["perform:"]
  6850. }, function ($methodClass){ return function (anObject){
  6851. var self=this,$self=this;
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. return $core.withContext(function($ctx1) {
  6854. //>>excludeEnd("ctx");
  6855. return $recv(anObject)._perform_(self);
  6856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6857. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6858. //>>excludeEnd("ctx");
  6859. }; }),
  6860. $globals.String);
  6861. $core.addMethod(
  6862. $core.method({
  6863. selector: "cr",
  6864. protocol: "accessing",
  6865. //>>excludeStart("ide", pragmas.excludeIdeData);
  6866. args: [],
  6867. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6868. referencedClasses: [],
  6869. //>>excludeEnd("ide");
  6870. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6871. messageSends: []
  6872. }, function ($methodClass){ return function (){
  6873. var self=this,$self=this;
  6874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6875. return $core.withContext(function($ctx1) {
  6876. //>>excludeEnd("ctx");
  6877. return "\r";
  6878. return self;
  6879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6880. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6881. //>>excludeEnd("ctx");
  6882. }; }),
  6883. $globals.String.a$cls);
  6884. $core.addMethod(
  6885. $core.method({
  6886. selector: "crlf",
  6887. protocol: "accessing",
  6888. //>>excludeStart("ide", pragmas.excludeIdeData);
  6889. args: [],
  6890. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6891. referencedClasses: [],
  6892. //>>excludeEnd("ide");
  6893. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6894. messageSends: []
  6895. }, function ($methodClass){ return function (){
  6896. var self=this,$self=this;
  6897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6898. return $core.withContext(function($ctx1) {
  6899. //>>excludeEnd("ctx");
  6900. return "\r\n";
  6901. return self;
  6902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6903. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6904. //>>excludeEnd("ctx");
  6905. }; }),
  6906. $globals.String.a$cls);
  6907. $core.addMethod(
  6908. $core.method({
  6909. selector: "esc",
  6910. protocol: "accessing",
  6911. //>>excludeStart("ide", pragmas.excludeIdeData);
  6912. args: [],
  6913. source: "esc\x0a\x09^ self fromCharCode: 27",
  6914. referencedClasses: [],
  6915. //>>excludeEnd("ide");
  6916. pragmas: [],
  6917. messageSends: ["fromCharCode:"]
  6918. }, function ($methodClass){ return function (){
  6919. var self=this,$self=this;
  6920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6921. return $core.withContext(function($ctx1) {
  6922. //>>excludeEnd("ctx");
  6923. return $self._fromCharCode_((27));
  6924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6925. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6926. //>>excludeEnd("ctx");
  6927. }; }),
  6928. $globals.String.a$cls);
  6929. $core.addMethod(
  6930. $core.method({
  6931. selector: "fromCharCode:",
  6932. protocol: "instance creation",
  6933. //>>excludeStart("ide", pragmas.excludeIdeData);
  6934. args: ["anInteger"],
  6935. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6936. referencedClasses: [],
  6937. //>>excludeEnd("ide");
  6938. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6939. messageSends: []
  6940. }, function ($methodClass){ return function (anInteger){
  6941. var self=this,$self=this;
  6942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6943. return $core.withContext(function($ctx1) {
  6944. //>>excludeEnd("ctx");
  6945. return String.fromCharCode(anInteger);
  6946. return self;
  6947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6948. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6949. //>>excludeEnd("ctx");
  6950. }; }),
  6951. $globals.String.a$cls);
  6952. $core.addMethod(
  6953. $core.method({
  6954. selector: "fromString:",
  6955. protocol: "instance creation",
  6956. //>>excludeStart("ide", pragmas.excludeIdeData);
  6957. args: ["aString"],
  6958. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6959. referencedClasses: [],
  6960. //>>excludeEnd("ide");
  6961. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6962. messageSends: []
  6963. }, function ($methodClass){ return function (aString){
  6964. var self=this,$self=this;
  6965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6966. return $core.withContext(function($ctx1) {
  6967. //>>excludeEnd("ctx");
  6968. return String(aString);
  6969. return self;
  6970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6971. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6972. //>>excludeEnd("ctx");
  6973. }; }),
  6974. $globals.String.a$cls);
  6975. $core.addMethod(
  6976. $core.method({
  6977. selector: "lf",
  6978. protocol: "accessing",
  6979. //>>excludeStart("ide", pragmas.excludeIdeData);
  6980. args: [],
  6981. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6982. referencedClasses: [],
  6983. //>>excludeEnd("ide");
  6984. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6985. messageSends: []
  6986. }, function ($methodClass){ return function (){
  6987. var self=this,$self=this;
  6988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6989. return $core.withContext(function($ctx1) {
  6990. //>>excludeEnd("ctx");
  6991. return "\n";
  6992. return self;
  6993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6994. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6995. //>>excludeEnd("ctx");
  6996. }; }),
  6997. $globals.String.a$cls);
  6998. $core.addMethod(
  6999. $core.method({
  7000. selector: "random",
  7001. protocol: "random",
  7002. //>>excludeStart("ide", pragmas.excludeIdeData);
  7003. args: [],
  7004. 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);'>",
  7005. referencedClasses: [],
  7006. //>>excludeEnd("ide");
  7007. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  7008. messageSends: []
  7009. }, function ($methodClass){ return function (){
  7010. var self=this,$self=this;
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. return $core.withContext(function($ctx1) {
  7013. //>>excludeEnd("ctx");
  7014. return ((10+22*Math.random())/32).toString(32).slice(2);;
  7015. return self;
  7016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7017. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  7018. //>>excludeEnd("ctx");
  7019. }; }),
  7020. $globals.String.a$cls);
  7021. $core.addMethod(
  7022. $core.method({
  7023. selector: "randomNotIn:",
  7024. protocol: "random",
  7025. //>>excludeStart("ide", pragmas.excludeIdeData);
  7026. args: ["aString"],
  7027. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7028. referencedClasses: [],
  7029. //>>excludeEnd("ide");
  7030. pragmas: [],
  7031. messageSends: ["whileTrue", "random", "includesSubString:"]
  7032. }, function ($methodClass){ return function (aString){
  7033. var self=this,$self=this;
  7034. var result;
  7035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7036. return $core.withContext(function($ctx1) {
  7037. //>>excludeEnd("ctx");
  7038. $recv((function(){
  7039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7040. return $core.withContext(function($ctx2) {
  7041. //>>excludeEnd("ctx");
  7042. result=$self._random();
  7043. return $recv(aString)._includesSubString_(result);
  7044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7046. //>>excludeEnd("ctx");
  7047. }))._whileTrue();
  7048. return result;
  7049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7050. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  7051. //>>excludeEnd("ctx");
  7052. }; }),
  7053. $globals.String.a$cls);
  7054. $core.addMethod(
  7055. $core.method({
  7056. selector: "space",
  7057. protocol: "accessing",
  7058. //>>excludeStart("ide", pragmas.excludeIdeData);
  7059. args: [],
  7060. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7061. referencedClasses: [],
  7062. //>>excludeEnd("ide");
  7063. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  7064. messageSends: []
  7065. }, function ($methodClass){ return function (){
  7066. var self=this,$self=this;
  7067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7068. return $core.withContext(function($ctx1) {
  7069. //>>excludeEnd("ctx");
  7070. return " ";
  7071. return self;
  7072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7073. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  7074. //>>excludeEnd("ctx");
  7075. }; }),
  7076. $globals.String.a$cls);
  7077. $core.addMethod(
  7078. $core.method({
  7079. selector: "streamClass",
  7080. protocol: "accessing",
  7081. //>>excludeStart("ide", pragmas.excludeIdeData);
  7082. args: [],
  7083. source: "streamClass\x0a\x09\x09^ StringStream",
  7084. referencedClasses: ["StringStream"],
  7085. //>>excludeEnd("ide");
  7086. pragmas: [],
  7087. messageSends: []
  7088. }, function ($methodClass){ return function (){
  7089. var self=this,$self=this;
  7090. return $globals.StringStream;
  7091. }; }),
  7092. $globals.String.a$cls);
  7093. $core.addMethod(
  7094. $core.method({
  7095. selector: "tab",
  7096. protocol: "accessing",
  7097. //>>excludeStart("ide", pragmas.excludeIdeData);
  7098. args: [],
  7099. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7100. referencedClasses: [],
  7101. //>>excludeEnd("ide");
  7102. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  7103. messageSends: []
  7104. }, function ($methodClass){ return function (){
  7105. var self=this,$self=this;
  7106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7107. return $core.withContext(function($ctx1) {
  7108. //>>excludeEnd("ctx");
  7109. return "\t";
  7110. return self;
  7111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7112. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7113. //>>excludeEnd("ctx");
  7114. }; }),
  7115. $globals.String.a$cls);
  7116. $core.addMethod(
  7117. $core.method({
  7118. selector: "value:",
  7119. protocol: "instance creation",
  7120. //>>excludeStart("ide", pragmas.excludeIdeData);
  7121. args: ["aUTFCharCode"],
  7122. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7123. referencedClasses: [],
  7124. //>>excludeEnd("ide");
  7125. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7126. messageSends: []
  7127. }, function ($methodClass){ return function (aUTFCharCode){
  7128. var self=this,$self=this;
  7129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7130. return $core.withContext(function($ctx1) {
  7131. //>>excludeEnd("ctx");
  7132. return String.fromCharCode(aUTFCharCode);;
  7133. return self;
  7134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7135. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7136. //>>excludeEnd("ctx");
  7137. }; }),
  7138. $globals.String.a$cls);
  7139. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7140. //>>excludeStart("ide", pragmas.excludeIdeData);
  7141. $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`.";
  7142. //>>excludeEnd("ide");
  7143. $core.addMethod(
  7144. $core.method({
  7145. selector: "=",
  7146. protocol: "comparing",
  7147. //>>excludeStart("ide", pragmas.excludeIdeData);
  7148. args: ["aCollection"],
  7149. 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",
  7150. referencedClasses: [],
  7151. //>>excludeEnd("ide");
  7152. pragmas: [],
  7153. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7154. }, function ($methodClass){ return function (aCollection){
  7155. var self=this,$self=this;
  7156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7157. return $core.withContext(function($ctx1) {
  7158. //>>excludeEnd("ctx");
  7159. var $early={};
  7160. try {
  7161. if(!$core.assert([$recv([$self._class()
  7162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7163. ,$ctx1.sendIdx["class"]=1
  7164. //>>excludeEnd("ctx");
  7165. ][0]).__eq($recv(aCollection)._class())
  7166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7167. ,$ctx1.sendIdx["="]=1
  7168. //>>excludeEnd("ctx");
  7169. ][0])){
  7170. return false;
  7171. }
  7172. if(!$core.assert($recv([$self._size()
  7173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7174. ,$ctx1.sendIdx["size"]=1
  7175. //>>excludeEnd("ctx");
  7176. ][0]).__eq($recv(aCollection)._size()))){
  7177. return false;
  7178. }
  7179. $self._do_((function(each){
  7180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7181. return $core.withContext(function($ctx2) {
  7182. //>>excludeEnd("ctx");
  7183. if(!$core.assert($recv(aCollection)._includes_(each))){
  7184. throw $early=[false];
  7185. }
  7186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7187. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7188. //>>excludeEnd("ctx");
  7189. }));
  7190. return true;
  7191. }
  7192. catch(e) {if(e===$early)return e[0]; throw e}
  7193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7194. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7195. //>>excludeEnd("ctx");
  7196. }; }),
  7197. $globals.Set);
  7198. $core.addMethod(
  7199. $core.method({
  7200. selector: "add:",
  7201. protocol: "adding/removing",
  7202. //>>excludeStart("ide", pragmas.excludeIdeData);
  7203. args: ["anObject"],
  7204. 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 ]",
  7205. referencedClasses: [],
  7206. //>>excludeEnd("ide");
  7207. pragmas: [],
  7208. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7209. }, function ($methodClass){ return function (anObject){
  7210. var self=this,$self=this;
  7211. var bucket;
  7212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7213. return $core.withContext(function($ctx1) {
  7214. //>>excludeEnd("ctx");
  7215. var $1;
  7216. bucket=$self._bucketsOfElement_(anObject);
  7217. $1=$recv(bucket)._second();
  7218. if($1 == null || $1.a$nil){
  7219. var object,slowBucket;
  7220. object=[$recv(bucket)._first()
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. ,$ctx1.sendIdx["first"]=1
  7223. //>>excludeEnd("ctx");
  7224. ][0];
  7225. slowBucket=$recv(bucket)._third();
  7226. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7228. return $core.withContext(function($ctx2) {
  7229. //>>excludeEnd("ctx");
  7230. $recv(slowBucket)._add_(object);
  7231. $self.size=$recv($self.size).__plus((1));
  7232. return $self.size;
  7233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7235. //>>excludeEnd("ctx");
  7236. }));
  7237. return object;
  7238. } else {
  7239. var primitiveBucket;
  7240. primitiveBucket=$1;
  7241. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7242. }
  7243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7244. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7245. //>>excludeEnd("ctx");
  7246. }; }),
  7247. $globals.Set);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "add:in:",
  7251. protocol: "private",
  7252. //>>excludeStart("ide", pragmas.excludeIdeData);
  7253. args: ["anObject", "anotherObject"],
  7254. 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'>",
  7255. referencedClasses: [],
  7256. //>>excludeEnd("ide");
  7257. 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"]]],
  7258. messageSends: []
  7259. }, function ($methodClass){ return function (anObject,anotherObject){
  7260. var self=this,$self=this;
  7261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7262. return $core.withContext(function($ctx1) {
  7263. //>>excludeEnd("ctx");
  7264. if (anObject in anotherObject.store) { return anObject; }
  7265. $self.size++;
  7266. anotherObject.store[anObject] = true;
  7267. return anObject;
  7268. ;
  7269. return self;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7272. //>>excludeEnd("ctx");
  7273. }; }),
  7274. $globals.Set);
  7275. $core.addMethod(
  7276. $core.method({
  7277. selector: "bucketsOfElement:",
  7278. protocol: "private",
  7279. //>>excludeStart("ide", pragmas.excludeIdeData);
  7280. args: ["anObject"],
  7281. 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'>",
  7282. referencedClasses: [],
  7283. //>>excludeEnd("ide");
  7284. 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"]]],
  7285. messageSends: []
  7286. }, function ($methodClass){ return function (anObject){
  7287. var self=this,$self=this;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. return $core.withContext(function($ctx1) {
  7290. //>>excludeEnd("ctx");
  7291. // include nil to well-known objects under "boolean" fastBucket
  7292. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7293. var prim = anObject.valueOf();
  7294. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7295. var bucket = null;
  7296. $self.slowBucketStores.some(function (store) {
  7297. return bucket = store._bucketOfElement_(anObject);
  7298. });
  7299. return [ anObject, null, bucket || $self.defaultBucket ];
  7300. }
  7301. return [ prim, $self.fastBuckets[typeof prim] ];
  7302. ;
  7303. return self;
  7304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7305. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7306. //>>excludeEnd("ctx");
  7307. }; }),
  7308. $globals.Set);
  7309. $core.addMethod(
  7310. $core.method({
  7311. selector: "classNameOf:",
  7312. protocol: "private",
  7313. //>>excludeStart("ide", pragmas.excludeIdeData);
  7314. args: ["anObject"],
  7315. 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'>",
  7316. referencedClasses: [],
  7317. //>>excludeEnd("ide");
  7318. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7319. messageSends: []
  7320. }, function ($methodClass){ return function (anObject){
  7321. var self=this,$self=this;
  7322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7323. return $core.withContext(function($ctx1) {
  7324. //>>excludeEnd("ctx");
  7325. return anObject.a$cls != null && anObject.a$cls.name;
  7326. return self;
  7327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7328. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7329. //>>excludeEnd("ctx");
  7330. }; }),
  7331. $globals.Set);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "collect:",
  7335. protocol: "enumerating",
  7336. //>>excludeStart("ide", pragmas.excludeIdeData);
  7337. args: ["aBlock"],
  7338. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7339. referencedClasses: [],
  7340. //>>excludeEnd("ide");
  7341. pragmas: [],
  7342. messageSends: ["new", "class", "do:", "add:", "value:"]
  7343. }, function ($methodClass){ return function (aBlock){
  7344. var self=this,$self=this;
  7345. var collection;
  7346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7347. return $core.withContext(function($ctx1) {
  7348. //>>excludeEnd("ctx");
  7349. collection=$recv($self._class())._new();
  7350. $self._do_((function(each){
  7351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7352. return $core.withContext(function($ctx2) {
  7353. //>>excludeEnd("ctx");
  7354. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7356. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7357. //>>excludeEnd("ctx");
  7358. }));
  7359. return collection;
  7360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7361. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7362. //>>excludeEnd("ctx");
  7363. }; }),
  7364. $globals.Set);
  7365. $core.addMethod(
  7366. $core.method({
  7367. selector: "do:",
  7368. protocol: "enumerating",
  7369. //>>excludeStart("ide", pragmas.excludeIdeData);
  7370. args: ["aBlock"],
  7371. 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'>",
  7372. referencedClasses: [],
  7373. //>>excludeEnd("ide");
  7374. 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"]]],
  7375. messageSends: []
  7376. }, function ($methodClass){ return function (aBlock){
  7377. var self=this,$self=this;
  7378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7379. return $core.withContext(function($ctx1) {
  7380. //>>excludeEnd("ctx");
  7381. var el, keys, i;
  7382. el = $self.fastBuckets;
  7383. keys = Object.keys(el);
  7384. for (i = 0; i < keys.length; ++i) {
  7385. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7386. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7387. else { store._do_(aBlock); }
  7388. }
  7389. el = $self.slowBucketStores;
  7390. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7391. $self.defaultBucket._do_(aBlock);
  7392. ;
  7393. return self;
  7394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7395. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7396. //>>excludeEnd("ctx");
  7397. }; }),
  7398. $globals.Set);
  7399. $core.addMethod(
  7400. $core.method({
  7401. selector: "includes:",
  7402. protocol: "testing",
  7403. //>>excludeStart("ide", pragmas.excludeIdeData);
  7404. args: ["anObject"],
  7405. 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 ]",
  7406. referencedClasses: [],
  7407. //>>excludeEnd("ide");
  7408. pragmas: [],
  7409. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7410. }, function ($methodClass){ return function (anObject){
  7411. var self=this,$self=this;
  7412. var bucket;
  7413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7414. return $core.withContext(function($ctx1) {
  7415. //>>excludeEnd("ctx");
  7416. var $1;
  7417. bucket=$self._bucketsOfElement_(anObject);
  7418. $1=$recv(bucket)._second();
  7419. if($1 == null || $1.a$nil){
  7420. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7422. ,$ctx1.sendIdx["first"]=1
  7423. //>>excludeEnd("ctx");
  7424. ][0]);
  7425. } else {
  7426. var primitiveBucket;
  7427. primitiveBucket=$1;
  7428. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7429. }
  7430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7431. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7432. //>>excludeEnd("ctx");
  7433. }; }),
  7434. $globals.Set);
  7435. $core.addMethod(
  7436. $core.method({
  7437. selector: "includes:in:",
  7438. protocol: "private",
  7439. //>>excludeStart("ide", pragmas.excludeIdeData);
  7440. args: ["anObject", "anotherObject"],
  7441. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7442. referencedClasses: [],
  7443. //>>excludeEnd("ide");
  7444. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7445. messageSends: []
  7446. }, function ($methodClass){ return function (anObject,anotherObject){
  7447. var self=this,$self=this;
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. return $core.withContext(function($ctx1) {
  7450. //>>excludeEnd("ctx");
  7451. return anObject in anotherObject.store;
  7452. return self;
  7453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7454. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7455. //>>excludeEnd("ctx");
  7456. }; }),
  7457. $globals.Set);
  7458. $core.addMethod(
  7459. $core.method({
  7460. selector: "initialize",
  7461. protocol: "initialization",
  7462. //>>excludeStart("ide", pragmas.excludeIdeData);
  7463. args: [],
  7464. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7465. referencedClasses: [],
  7466. //>>excludeEnd("ide");
  7467. pragmas: [],
  7468. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7469. }, function ($methodClass){ return function (){
  7470. var self=this,$self=this;
  7471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7472. return $core.withContext(function($ctx1) {
  7473. //>>excludeEnd("ctx");
  7474. [(
  7475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7476. $ctx1.supercall = true,
  7477. //>>excludeEnd("ctx");
  7478. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7480. ,$ctx1.supercall = false
  7481. //>>excludeEnd("ctx");
  7482. ][0];
  7483. $self.defaultBucket=[];
  7484. $self._initializeSlowBucketStores();
  7485. $self._removeAll();
  7486. return self;
  7487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7488. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7489. //>>excludeEnd("ctx");
  7490. }; }),
  7491. $globals.Set);
  7492. $core.addMethod(
  7493. $core.method({
  7494. selector: "initializeSlowBucketStores",
  7495. protocol: "initialization",
  7496. //>>excludeStart("ide", pragmas.excludeIdeData);
  7497. args: [],
  7498. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7499. referencedClasses: ["ArrayBucketStore"],
  7500. //>>excludeEnd("ide");
  7501. pragmas: [],
  7502. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7503. }, function ($methodClass){ return function (){
  7504. var self=this,$self=this;
  7505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7506. return $core.withContext(function($ctx1) {
  7507. //>>excludeEnd("ctx");
  7508. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7510. return $core.withContext(function($ctx2) {
  7511. //>>excludeEnd("ctx");
  7512. return $self._classNameOf_(x);
  7513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7514. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7515. //>>excludeEnd("ctx");
  7516. }))
  7517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7518. ,$ctx1.sendIdx["hashBlock:"]=1
  7519. //>>excludeEnd("ctx");
  7520. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7522. return $core.withContext(function($ctx2) {
  7523. //>>excludeEnd("ctx");
  7524. return $self._jsConstructorNameOf_(x);
  7525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7526. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7527. //>>excludeEnd("ctx");
  7528. }))];
  7529. return self;
  7530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7531. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7532. //>>excludeEnd("ctx");
  7533. }; }),
  7534. $globals.Set);
  7535. $core.addMethod(
  7536. $core.method({
  7537. selector: "jsConstructorNameOf:",
  7538. protocol: "private",
  7539. //>>excludeStart("ide", pragmas.excludeIdeData);
  7540. args: ["anObject"],
  7541. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7542. referencedClasses: [],
  7543. //>>excludeEnd("ide");
  7544. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7545. messageSends: []
  7546. }, function ($methodClass){ return function (anObject){
  7547. var self=this,$self=this;
  7548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7549. return $core.withContext(function($ctx1) {
  7550. //>>excludeEnd("ctx");
  7551. return anObject.constructor && anObject.constructor.name;
  7552. return self;
  7553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7554. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7555. //>>excludeEnd("ctx");
  7556. }; }),
  7557. $globals.Set);
  7558. $core.addMethod(
  7559. $core.method({
  7560. selector: "printOn:",
  7561. protocol: "printing",
  7562. //>>excludeStart("ide", pragmas.excludeIdeData);
  7563. args: ["aStream"],
  7564. 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: ')'",
  7565. referencedClasses: [],
  7566. //>>excludeEnd("ide");
  7567. pragmas: [],
  7568. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7569. }, function ($methodClass){ return function (aStream){
  7570. var self=this,$self=this;
  7571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7572. return $core.withContext(function($ctx1) {
  7573. //>>excludeEnd("ctx");
  7574. [(
  7575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7576. $ctx1.supercall = true,
  7577. //>>excludeEnd("ctx");
  7578. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7580. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7581. //>>excludeEnd("ctx");
  7582. ][0];
  7583. [$recv(aStream)._nextPutAll_(" (")
  7584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7585. ,$ctx1.sendIdx["nextPutAll:"]=1
  7586. //>>excludeEnd("ctx");
  7587. ][0];
  7588. $self._do_separatedBy_((function(each){
  7589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7590. return $core.withContext(function($ctx2) {
  7591. //>>excludeEnd("ctx");
  7592. return $recv(each)._printOn_(aStream);
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7595. //>>excludeEnd("ctx");
  7596. }),(function(){
  7597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7598. return $core.withContext(function($ctx2) {
  7599. //>>excludeEnd("ctx");
  7600. return [$recv(aStream)._nextPutAll_(" ")
  7601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7602. ,$ctx2.sendIdx["nextPutAll:"]=2
  7603. //>>excludeEnd("ctx");
  7604. ][0];
  7605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7607. //>>excludeEnd("ctx");
  7608. }));
  7609. $recv(aStream)._nextPutAll_(")");
  7610. return self;
  7611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7612. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7613. //>>excludeEnd("ctx");
  7614. }; }),
  7615. $globals.Set);
  7616. $core.addMethod(
  7617. $core.method({
  7618. selector: "remove:ifAbsent:",
  7619. protocol: "adding/removing",
  7620. //>>excludeStart("ide", pragmas.excludeIdeData);
  7621. args: ["anObject", "aBlock"],
  7622. 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 ]",
  7623. referencedClasses: [],
  7624. //>>excludeEnd("ide");
  7625. pragmas: [],
  7626. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7627. }, function ($methodClass){ return function (anObject,aBlock){
  7628. var self=this,$self=this;
  7629. var bucket;
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. return $core.withContext(function($ctx1) {
  7632. //>>excludeEnd("ctx");
  7633. var $1;
  7634. var $early={};
  7635. try {
  7636. bucket=$self._bucketsOfElement_(anObject);
  7637. $1=$recv(bucket)._second();
  7638. if($1 == null || $1.a$nil){
  7639. var obj;
  7640. obj=[$recv(bucket)._first()
  7641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7642. ,$ctx1.sendIdx["first"]=1
  7643. //>>excludeEnd("ctx");
  7644. ][0];
  7645. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7647. return $core.withContext(function($ctx2) {
  7648. //>>excludeEnd("ctx");
  7649. throw $early=[$recv(aBlock)._value()];
  7650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7652. //>>excludeEnd("ctx");
  7653. }));
  7654. $self.size=$recv($self.size).__minus((1));
  7655. return obj;
  7656. } else {
  7657. var primitiveBucket;
  7658. primitiveBucket=$1;
  7659. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7660. }
  7661. }
  7662. catch(e) {if(e===$early)return e[0]; throw e}
  7663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7664. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7665. //>>excludeEnd("ctx");
  7666. }; }),
  7667. $globals.Set);
  7668. $core.addMethod(
  7669. $core.method({
  7670. selector: "remove:in:ifAbsent:",
  7671. protocol: "private",
  7672. //>>excludeStart("ide", pragmas.excludeIdeData);
  7673. args: ["anObject", "anotherObject", "aBlock"],
  7674. 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}'>",
  7675. referencedClasses: [],
  7676. //>>excludeEnd("ide");
  7677. 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}"]]],
  7678. messageSends: []
  7679. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7680. var self=this,$self=this;
  7681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7682. return $core.withContext(function($ctx1) {
  7683. //>>excludeEnd("ctx");
  7684. if (anObject in anotherObject.store) {
  7685. delete anotherObject.store[anObject];
  7686. $self.size--;
  7687. return anObject;
  7688. } else {
  7689. return aBlock._value();
  7690. };
  7691. return self;
  7692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7693. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7694. //>>excludeEnd("ctx");
  7695. }; }),
  7696. $globals.Set);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "removeAll",
  7700. protocol: "adding/removing",
  7701. //>>excludeStart("ide", pragmas.excludeIdeData);
  7702. args: [],
  7703. 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'>",
  7704. referencedClasses: [],
  7705. //>>excludeEnd("ide");
  7706. 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"]]],
  7707. messageSends: []
  7708. }, function ($methodClass){ return function (){
  7709. var self=this,$self=this;
  7710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7711. return $core.withContext(function($ctx1) {
  7712. //>>excludeEnd("ctx");
  7713. $self.fastBuckets = {
  7714. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7715. "number": { store: Object.create(null), fn: Number },
  7716. "string": { store: Object.create(null) }
  7717. };
  7718. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7719. $self.defaultBucket._removeAll();
  7720. $self.size = 0;
  7721. ;
  7722. return self;
  7723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7724. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7725. //>>excludeEnd("ctx");
  7726. }; }),
  7727. $globals.Set);
  7728. $core.addMethod(
  7729. $core.method({
  7730. selector: "select:",
  7731. protocol: "enumerating",
  7732. //>>excludeStart("ide", pragmas.excludeIdeData);
  7733. args: ["aBlock"],
  7734. 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",
  7735. referencedClasses: [],
  7736. //>>excludeEnd("ide");
  7737. pragmas: [],
  7738. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7739. }, function ($methodClass){ return function (aBlock){
  7740. var self=this,$self=this;
  7741. var collection;
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. return $core.withContext(function($ctx1) {
  7744. //>>excludeEnd("ctx");
  7745. collection=$recv($self._class())._new();
  7746. $self._do_((function(each){
  7747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7748. return $core.withContext(function($ctx2) {
  7749. //>>excludeEnd("ctx");
  7750. if($core.assert($recv(aBlock)._value_(each))){
  7751. return $recv(collection)._add_(each);
  7752. }
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7755. //>>excludeEnd("ctx");
  7756. }));
  7757. return collection;
  7758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7759. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7760. //>>excludeEnd("ctx");
  7761. }; }),
  7762. $globals.Set);
  7763. $core.addMethod(
  7764. $core.method({
  7765. selector: "select:thenCollect:",
  7766. protocol: "enumerating",
  7767. //>>excludeStart("ide", pragmas.excludeIdeData);
  7768. args: ["selectBlock", "collectBlock"],
  7769. 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",
  7770. referencedClasses: [],
  7771. //>>excludeEnd("ide");
  7772. pragmas: [],
  7773. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7774. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7775. var self=this,$self=this;
  7776. var collection;
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. return $core.withContext(function($ctx1) {
  7779. //>>excludeEnd("ctx");
  7780. collection=$recv($self._class())._new();
  7781. $self._do_((function(each){
  7782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7783. return $core.withContext(function($ctx2) {
  7784. //>>excludeEnd("ctx");
  7785. if($core.assert([$recv(selectBlock)._value_(each)
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. ,$ctx2.sendIdx["value:"]=1
  7788. //>>excludeEnd("ctx");
  7789. ][0])){
  7790. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7791. }
  7792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7793. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7794. //>>excludeEnd("ctx");
  7795. }));
  7796. return collection;
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7799. //>>excludeEnd("ctx");
  7800. }; }),
  7801. $globals.Set);
  7802. $core.addMethod(
  7803. $core.method({
  7804. selector: "size",
  7805. protocol: "accessing",
  7806. //>>excludeStart("ide", pragmas.excludeIdeData);
  7807. args: [],
  7808. source: "size\x0a\x09^ size",
  7809. referencedClasses: [],
  7810. //>>excludeEnd("ide");
  7811. pragmas: [],
  7812. messageSends: []
  7813. }, function ($methodClass){ return function (){
  7814. var self=this,$self=this;
  7815. return $self.size;
  7816. }; }),
  7817. $globals.Set);
  7818. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7819. //>>excludeStart("ide", pragmas.excludeIdeData);
  7820. $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.";
  7821. //>>excludeEnd("ide");
  7822. $core.addMethod(
  7823. $core.method({
  7824. selector: "<<",
  7825. protocol: "writing",
  7826. //>>excludeStart("ide", pragmas.excludeIdeData);
  7827. args: ["anObject"],
  7828. source: "<< anObject\x0a\x09self write: anObject",
  7829. referencedClasses: [],
  7830. //>>excludeEnd("ide");
  7831. pragmas: [],
  7832. messageSends: ["write:"]
  7833. }, function ($methodClass){ return function (anObject){
  7834. var self=this,$self=this;
  7835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7836. return $core.withContext(function($ctx1) {
  7837. //>>excludeEnd("ctx");
  7838. $self._write_(anObject);
  7839. return self;
  7840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7841. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7842. //>>excludeEnd("ctx");
  7843. }; }),
  7844. $globals.ProtoStream);
  7845. $core.addMethod(
  7846. $core.method({
  7847. selector: "atEnd",
  7848. protocol: "testing",
  7849. //>>excludeStart("ide", pragmas.excludeIdeData);
  7850. args: [],
  7851. source: "atEnd\x0a\x09self subclassResponsibility",
  7852. referencedClasses: [],
  7853. //>>excludeEnd("ide");
  7854. pragmas: [],
  7855. messageSends: ["subclassResponsibility"]
  7856. }, function ($methodClass){ return function (){
  7857. var self=this,$self=this;
  7858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7859. return $core.withContext(function($ctx1) {
  7860. //>>excludeEnd("ctx");
  7861. $self._subclassResponsibility();
  7862. return self;
  7863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7864. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7865. //>>excludeEnd("ctx");
  7866. }; }),
  7867. $globals.ProtoStream);
  7868. $core.addMethod(
  7869. $core.method({
  7870. selector: "atStart",
  7871. protocol: "testing",
  7872. //>>excludeStart("ide", pragmas.excludeIdeData);
  7873. args: [],
  7874. source: "atStart\x0a\x09self subclassResponsibility",
  7875. referencedClasses: [],
  7876. //>>excludeEnd("ide");
  7877. pragmas: [],
  7878. messageSends: ["subclassResponsibility"]
  7879. }, function ($methodClass){ return function (){
  7880. var self=this,$self=this;
  7881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7882. return $core.withContext(function($ctx1) {
  7883. //>>excludeEnd("ctx");
  7884. $self._subclassResponsibility();
  7885. return self;
  7886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7887. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7888. //>>excludeEnd("ctx");
  7889. }; }),
  7890. $globals.ProtoStream);
  7891. $core.addMethod(
  7892. $core.method({
  7893. selector: "contents",
  7894. protocol: "accessing",
  7895. //>>excludeStart("ide", pragmas.excludeIdeData);
  7896. args: [],
  7897. source: "contents\x0a\x09self subclassResponsibility",
  7898. referencedClasses: [],
  7899. //>>excludeEnd("ide");
  7900. pragmas: [],
  7901. messageSends: ["subclassResponsibility"]
  7902. }, function ($methodClass){ return function (){
  7903. var self=this,$self=this;
  7904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7905. return $core.withContext(function($ctx1) {
  7906. //>>excludeEnd("ctx");
  7907. $self._subclassResponsibility();
  7908. return self;
  7909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7910. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7911. //>>excludeEnd("ctx");
  7912. }; }),
  7913. $globals.ProtoStream);
  7914. $core.addMethod(
  7915. $core.method({
  7916. selector: "do:",
  7917. protocol: "enumerating",
  7918. //>>excludeStart("ide", pragmas.excludeIdeData);
  7919. args: ["aBlock"],
  7920. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7921. referencedClasses: [],
  7922. //>>excludeEnd("ide");
  7923. pragmas: [],
  7924. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7925. }, function ($methodClass){ return function (aBlock){
  7926. var self=this,$self=this;
  7927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7928. return $core.withContext(function($ctx1) {
  7929. //>>excludeEnd("ctx");
  7930. $recv((function(){
  7931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7932. return $core.withContext(function($ctx2) {
  7933. //>>excludeEnd("ctx");
  7934. return $self._atEnd();
  7935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7937. //>>excludeEnd("ctx");
  7938. }))._whileFalse_((function(){
  7939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7940. return $core.withContext(function($ctx2) {
  7941. //>>excludeEnd("ctx");
  7942. return $recv(aBlock)._value_($self._next());
  7943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7945. //>>excludeEnd("ctx");
  7946. }));
  7947. return self;
  7948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7949. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7950. //>>excludeEnd("ctx");
  7951. }; }),
  7952. $globals.ProtoStream);
  7953. $core.addMethod(
  7954. $core.method({
  7955. selector: "isEmpty",
  7956. protocol: "testing",
  7957. //>>excludeStart("ide", pragmas.excludeIdeData);
  7958. args: [],
  7959. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7960. referencedClasses: [],
  7961. //>>excludeEnd("ide");
  7962. pragmas: [],
  7963. messageSends: ["and:", "atStart", "atEnd"]
  7964. }, function ($methodClass){ return function (){
  7965. var self=this,$self=this;
  7966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7967. return $core.withContext(function($ctx1) {
  7968. //>>excludeEnd("ctx");
  7969. return $recv($self._atStart())._and_((function(){
  7970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7971. return $core.withContext(function($ctx2) {
  7972. //>>excludeEnd("ctx");
  7973. return $self._atEnd();
  7974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7976. //>>excludeEnd("ctx");
  7977. }));
  7978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7979. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7980. //>>excludeEnd("ctx");
  7981. }; }),
  7982. $globals.ProtoStream);
  7983. $core.addMethod(
  7984. $core.method({
  7985. selector: "next",
  7986. protocol: "reading",
  7987. //>>excludeStart("ide", pragmas.excludeIdeData);
  7988. args: [],
  7989. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7990. referencedClasses: [],
  7991. //>>excludeEnd("ide");
  7992. pragmas: [],
  7993. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7994. }, function ($methodClass){ return function (){
  7995. var self=this,$self=this;
  7996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7997. return $core.withContext(function($ctx1) {
  7998. //>>excludeEnd("ctx");
  7999. if($core.assert($self._atEnd())){
  8000. return nil;
  8001. } else {
  8002. return $self._subclassResponsibility();
  8003. }
  8004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8005. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8006. //>>excludeEnd("ctx");
  8007. }; }),
  8008. $globals.ProtoStream);
  8009. $core.addMethod(
  8010. $core.method({
  8011. selector: "nextPut:",
  8012. protocol: "writing",
  8013. //>>excludeStart("ide", pragmas.excludeIdeData);
  8014. args: ["anObject"],
  8015. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8016. referencedClasses: [],
  8017. //>>excludeEnd("ide");
  8018. pragmas: [],
  8019. messageSends: ["subclassResponsibility"]
  8020. }, function ($methodClass){ return function (anObject){
  8021. var self=this,$self=this;
  8022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8023. return $core.withContext(function($ctx1) {
  8024. //>>excludeEnd("ctx");
  8025. $self._subclassResponsibility();
  8026. return self;
  8027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8028. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8029. //>>excludeEnd("ctx");
  8030. }; }),
  8031. $globals.ProtoStream);
  8032. $core.addMethod(
  8033. $core.method({
  8034. selector: "nextPutAll:",
  8035. protocol: "writing",
  8036. //>>excludeStart("ide", pragmas.excludeIdeData);
  8037. args: ["aCollection"],
  8038. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8039. referencedClasses: [],
  8040. //>>excludeEnd("ide");
  8041. pragmas: [],
  8042. messageSends: ["do:", "nextPut:"]
  8043. }, function ($methodClass){ return function (aCollection){
  8044. var self=this,$self=this;
  8045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8046. return $core.withContext(function($ctx1) {
  8047. //>>excludeEnd("ctx");
  8048. $recv(aCollection)._do_((function(each){
  8049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8050. return $core.withContext(function($ctx2) {
  8051. //>>excludeEnd("ctx");
  8052. return $self._nextPut_(each);
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8055. //>>excludeEnd("ctx");
  8056. }));
  8057. return self;
  8058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8059. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  8060. //>>excludeEnd("ctx");
  8061. }; }),
  8062. $globals.ProtoStream);
  8063. $core.addMethod(
  8064. $core.method({
  8065. selector: "nextPutString:",
  8066. protocol: "writing",
  8067. //>>excludeStart("ide", pragmas.excludeIdeData);
  8068. args: ["aString"],
  8069. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8070. referencedClasses: [],
  8071. //>>excludeEnd("ide");
  8072. pragmas: [],
  8073. messageSends: ["nextPut:"]
  8074. }, function ($methodClass){ return function (aString){
  8075. var self=this,$self=this;
  8076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8077. return $core.withContext(function($ctx1) {
  8078. //>>excludeEnd("ctx");
  8079. $self._nextPut_(aString);
  8080. return self;
  8081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8082. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8083. //>>excludeEnd("ctx");
  8084. }; }),
  8085. $globals.ProtoStream);
  8086. $core.addMethod(
  8087. $core.method({
  8088. selector: "peek",
  8089. protocol: "reading",
  8090. //>>excludeStart("ide", pragmas.excludeIdeData);
  8091. args: [],
  8092. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8093. referencedClasses: [],
  8094. //>>excludeEnd("ide");
  8095. pragmas: [],
  8096. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8097. }, function ($methodClass){ return function (){
  8098. var self=this,$self=this;
  8099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8100. return $core.withContext(function($ctx1) {
  8101. //>>excludeEnd("ctx");
  8102. if($core.assert($self._atEnd())){
  8103. return nil;
  8104. } else {
  8105. return $self._subclassResponsibility();
  8106. }
  8107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8108. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8109. //>>excludeEnd("ctx");
  8110. }; }),
  8111. $globals.ProtoStream);
  8112. $core.addMethod(
  8113. $core.method({
  8114. selector: "reset",
  8115. protocol: "actions",
  8116. //>>excludeStart("ide", pragmas.excludeIdeData);
  8117. args: [],
  8118. source: "reset\x0a\x09self subclassResponsibility",
  8119. referencedClasses: [],
  8120. //>>excludeEnd("ide");
  8121. pragmas: [],
  8122. messageSends: ["subclassResponsibility"]
  8123. }, function ($methodClass){ return function (){
  8124. var self=this,$self=this;
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. return $core.withContext(function($ctx1) {
  8127. //>>excludeEnd("ctx");
  8128. $self._subclassResponsibility();
  8129. return self;
  8130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8131. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8132. //>>excludeEnd("ctx");
  8133. }; }),
  8134. $globals.ProtoStream);
  8135. $core.addMethod(
  8136. $core.method({
  8137. selector: "resetContents",
  8138. protocol: "actions",
  8139. //>>excludeStart("ide", pragmas.excludeIdeData);
  8140. args: [],
  8141. source: "resetContents\x0a\x09self subclassResponsibility",
  8142. referencedClasses: [],
  8143. //>>excludeEnd("ide");
  8144. pragmas: [],
  8145. messageSends: ["subclassResponsibility"]
  8146. }, function ($methodClass){ return function (){
  8147. var self=this,$self=this;
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. return $core.withContext(function($ctx1) {
  8150. //>>excludeEnd("ctx");
  8151. $self._subclassResponsibility();
  8152. return self;
  8153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8154. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8155. //>>excludeEnd("ctx");
  8156. }; }),
  8157. $globals.ProtoStream);
  8158. $core.addMethod(
  8159. $core.method({
  8160. selector: "setToEnd",
  8161. protocol: "positioning",
  8162. //>>excludeStart("ide", pragmas.excludeIdeData);
  8163. args: [],
  8164. source: "setToEnd\x0a\x09self subclassResponsibility",
  8165. referencedClasses: [],
  8166. //>>excludeEnd("ide");
  8167. pragmas: [],
  8168. messageSends: ["subclassResponsibility"]
  8169. }, function ($methodClass){ return function (){
  8170. var self=this,$self=this;
  8171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8172. return $core.withContext(function($ctx1) {
  8173. //>>excludeEnd("ctx");
  8174. $self._subclassResponsibility();
  8175. return self;
  8176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8177. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8178. //>>excludeEnd("ctx");
  8179. }; }),
  8180. $globals.ProtoStream);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "setToStart",
  8184. protocol: "positioning",
  8185. //>>excludeStart("ide", pragmas.excludeIdeData);
  8186. args: [],
  8187. source: "setToStart\x0a\x09self reset",
  8188. referencedClasses: [],
  8189. //>>excludeEnd("ide");
  8190. pragmas: [],
  8191. messageSends: ["reset"]
  8192. }, function ($methodClass){ return function (){
  8193. var self=this,$self=this;
  8194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8195. return $core.withContext(function($ctx1) {
  8196. //>>excludeEnd("ctx");
  8197. $self._reset();
  8198. return self;
  8199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8200. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8201. //>>excludeEnd("ctx");
  8202. }; }),
  8203. $globals.ProtoStream);
  8204. $core.addMethod(
  8205. $core.method({
  8206. selector: "write:",
  8207. protocol: "writing",
  8208. //>>excludeStart("ide", pragmas.excludeIdeData);
  8209. args: ["anObject"],
  8210. source: "write: anObject\x0a\x09anObject putOn: self",
  8211. referencedClasses: [],
  8212. //>>excludeEnd("ide");
  8213. pragmas: [],
  8214. messageSends: ["putOn:"]
  8215. }, function ($methodClass){ return function (anObject){
  8216. var self=this,$self=this;
  8217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8218. return $core.withContext(function($ctx1) {
  8219. //>>excludeEnd("ctx");
  8220. $recv(anObject)._putOn_(self);
  8221. return self;
  8222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8223. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8224. //>>excludeEnd("ctx");
  8225. }; }),
  8226. $globals.ProtoStream);
  8227. $core.addMethod(
  8228. $core.method({
  8229. selector: "on:",
  8230. protocol: "instance creation",
  8231. //>>excludeStart("ide", pragmas.excludeIdeData);
  8232. args: ["aCollection"],
  8233. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8234. referencedClasses: [],
  8235. //>>excludeEnd("ide");
  8236. pragmas: [],
  8237. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8238. }, function ($methodClass){ return function (aCollection){
  8239. var self=this,$self=this;
  8240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8241. return $core.withContext(function($ctx1) {
  8242. //>>excludeEnd("ctx");
  8243. var $1;
  8244. $1=$self._new();
  8245. $recv($1)._setCollection_(aCollection);
  8246. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8247. return $recv($1)._yourself();
  8248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8249. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8250. //>>excludeEnd("ctx");
  8251. }; }),
  8252. $globals.ProtoStream.a$cls);
  8253. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8254. //>>excludeStart("ide", pragmas.excludeIdeData);
  8255. $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.";
  8256. //>>excludeEnd("ide");
  8257. $core.addMethod(
  8258. $core.method({
  8259. selector: "atEnd",
  8260. protocol: "testing",
  8261. //>>excludeStart("ide", pragmas.excludeIdeData);
  8262. args: [],
  8263. source: "atEnd\x0a\x09^ self position = self size",
  8264. referencedClasses: [],
  8265. //>>excludeEnd("ide");
  8266. pragmas: [],
  8267. messageSends: ["=", "position", "size"]
  8268. }, function ($methodClass){ return function (){
  8269. var self=this,$self=this;
  8270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8271. return $core.withContext(function($ctx1) {
  8272. //>>excludeEnd("ctx");
  8273. return $recv($self._position()).__eq($self._size());
  8274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8275. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8276. //>>excludeEnd("ctx");
  8277. }; }),
  8278. $globals.Stream);
  8279. $core.addMethod(
  8280. $core.method({
  8281. selector: "atStart",
  8282. protocol: "testing",
  8283. //>>excludeStart("ide", pragmas.excludeIdeData);
  8284. args: [],
  8285. source: "atStart\x0a\x09^ self position = 0",
  8286. referencedClasses: [],
  8287. //>>excludeEnd("ide");
  8288. pragmas: [],
  8289. messageSends: ["=", "position"]
  8290. }, function ($methodClass){ return function (){
  8291. var self=this,$self=this;
  8292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8293. return $core.withContext(function($ctx1) {
  8294. //>>excludeEnd("ctx");
  8295. return $recv($self._position()).__eq((0));
  8296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8297. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8298. //>>excludeEnd("ctx");
  8299. }; }),
  8300. $globals.Stream);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "close",
  8304. protocol: "actions",
  8305. //>>excludeStart("ide", pragmas.excludeIdeData);
  8306. args: [],
  8307. source: "close",
  8308. referencedClasses: [],
  8309. //>>excludeEnd("ide");
  8310. pragmas: [],
  8311. messageSends: []
  8312. }, function ($methodClass){ return function (){
  8313. var self=this,$self=this;
  8314. return self;
  8315. }; }),
  8316. $globals.Stream);
  8317. $core.addMethod(
  8318. $core.method({
  8319. selector: "collection",
  8320. protocol: "accessing",
  8321. //>>excludeStart("ide", pragmas.excludeIdeData);
  8322. args: [],
  8323. source: "collection\x0a\x09^ collection",
  8324. referencedClasses: [],
  8325. //>>excludeEnd("ide");
  8326. pragmas: [],
  8327. messageSends: []
  8328. }, function ($methodClass){ return function (){
  8329. var self=this,$self=this;
  8330. return $self.collection;
  8331. }; }),
  8332. $globals.Stream);
  8333. $core.addMethod(
  8334. $core.method({
  8335. selector: "contents",
  8336. protocol: "accessing",
  8337. //>>excludeStart("ide", pragmas.excludeIdeData);
  8338. args: [],
  8339. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8340. referencedClasses: [],
  8341. //>>excludeEnd("ide");
  8342. pragmas: [],
  8343. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8344. }, function ($methodClass){ return function (){
  8345. var self=this,$self=this;
  8346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8347. return $core.withContext(function($ctx1) {
  8348. //>>excludeEnd("ctx");
  8349. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8351. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8352. //>>excludeEnd("ctx");
  8353. }; }),
  8354. $globals.Stream);
  8355. $core.addMethod(
  8356. $core.method({
  8357. selector: "flush",
  8358. protocol: "actions",
  8359. //>>excludeStart("ide", pragmas.excludeIdeData);
  8360. args: [],
  8361. source: "flush",
  8362. referencedClasses: [],
  8363. //>>excludeEnd("ide");
  8364. pragmas: [],
  8365. messageSends: []
  8366. }, function ($methodClass){ return function (){
  8367. var self=this,$self=this;
  8368. return self;
  8369. }; }),
  8370. $globals.Stream);
  8371. $core.addMethod(
  8372. $core.method({
  8373. selector: "isEmpty",
  8374. protocol: "testing",
  8375. //>>excludeStart("ide", pragmas.excludeIdeData);
  8376. args: [],
  8377. source: "isEmpty\x0a\x09^ self size = 0",
  8378. referencedClasses: [],
  8379. //>>excludeEnd("ide");
  8380. pragmas: [],
  8381. messageSends: ["=", "size"]
  8382. }, function ($methodClass){ return function (){
  8383. var self=this,$self=this;
  8384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8385. return $core.withContext(function($ctx1) {
  8386. //>>excludeEnd("ctx");
  8387. return $recv($self._size()).__eq((0));
  8388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8389. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8390. //>>excludeEnd("ctx");
  8391. }; }),
  8392. $globals.Stream);
  8393. $core.addMethod(
  8394. $core.method({
  8395. selector: "next",
  8396. protocol: "reading",
  8397. //>>excludeStart("ide", pragmas.excludeIdeData);
  8398. args: [],
  8399. 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 ]",
  8400. referencedClasses: [],
  8401. //>>excludeEnd("ide");
  8402. pragmas: [],
  8403. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8404. }, function ($methodClass){ return function (){
  8405. var self=this,$self=this;
  8406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8407. return $core.withContext(function($ctx1) {
  8408. //>>excludeEnd("ctx");
  8409. if($core.assert($self._atEnd())){
  8410. return nil;
  8411. } else {
  8412. $self._position_($recv([$self._position()
  8413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8414. ,$ctx1.sendIdx["position"]=1
  8415. //>>excludeEnd("ctx");
  8416. ][0]).__plus((1)));
  8417. return $recv($self.collection)._at_($self._position());
  8418. }
  8419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8420. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8421. //>>excludeEnd("ctx");
  8422. }; }),
  8423. $globals.Stream);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "next:",
  8427. protocol: "reading",
  8428. //>>excludeStart("ide", pragmas.excludeIdeData);
  8429. args: ["anInteger"],
  8430. 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",
  8431. referencedClasses: [],
  8432. //>>excludeEnd("ide");
  8433. pragmas: [],
  8434. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8435. }, function ($methodClass){ return function (anInteger){
  8436. var self=this,$self=this;
  8437. var tempCollection;
  8438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8439. return $core.withContext(function($ctx1) {
  8440. //>>excludeEnd("ctx");
  8441. tempCollection=$recv($recv($self._collection())._class())._new();
  8442. $recv(anInteger)._timesRepeat_((function(){
  8443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8444. return $core.withContext(function($ctx2) {
  8445. //>>excludeEnd("ctx");
  8446. if(!$core.assert($self._atEnd())){
  8447. return $recv(tempCollection)._add_($self._next());
  8448. }
  8449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8451. //>>excludeEnd("ctx");
  8452. }));
  8453. return tempCollection;
  8454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8455. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8456. //>>excludeEnd("ctx");
  8457. }; }),
  8458. $globals.Stream);
  8459. $core.addMethod(
  8460. $core.method({
  8461. selector: "nextPut:",
  8462. protocol: "writing",
  8463. //>>excludeStart("ide", pragmas.excludeIdeData);
  8464. args: ["anObject"],
  8465. 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)",
  8466. referencedClasses: [],
  8467. //>>excludeEnd("ide");
  8468. pragmas: [],
  8469. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8470. }, function ($methodClass){ return function (anObject){
  8471. var self=this,$self=this;
  8472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8473. return $core.withContext(function($ctx1) {
  8474. //>>excludeEnd("ctx");
  8475. $self._position_($recv([$self._position()
  8476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8477. ,$ctx1.sendIdx["position"]=1
  8478. //>>excludeEnd("ctx");
  8479. ][0]).__plus((1)));
  8480. $recv($self._collection())._at_put_([$self._position()
  8481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8482. ,$ctx1.sendIdx["position"]=2
  8483. //>>excludeEnd("ctx");
  8484. ][0],anObject);
  8485. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8486. return self;
  8487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8488. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8489. //>>excludeEnd("ctx");
  8490. }; }),
  8491. $globals.Stream);
  8492. $core.addMethod(
  8493. $core.method({
  8494. selector: "peek",
  8495. protocol: "reading",
  8496. //>>excludeStart("ide", pragmas.excludeIdeData);
  8497. args: [],
  8498. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8499. referencedClasses: [],
  8500. //>>excludeEnd("ide");
  8501. pragmas: [],
  8502. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8503. }, function ($methodClass){ return function (){
  8504. var self=this,$self=this;
  8505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8506. return $core.withContext(function($ctx1) {
  8507. //>>excludeEnd("ctx");
  8508. if(!$core.assert($self._atEnd())){
  8509. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8510. }
  8511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8512. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8513. //>>excludeEnd("ctx");
  8514. }; }),
  8515. $globals.Stream);
  8516. $core.addMethod(
  8517. $core.method({
  8518. selector: "position",
  8519. protocol: "accessing",
  8520. //>>excludeStart("ide", pragmas.excludeIdeData);
  8521. args: [],
  8522. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8523. referencedClasses: [],
  8524. //>>excludeEnd("ide");
  8525. pragmas: [],
  8526. messageSends: ["ifNil:"]
  8527. }, function ($methodClass){ return function (){
  8528. var self=this,$self=this;
  8529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8530. return $core.withContext(function($ctx1) {
  8531. //>>excludeEnd("ctx");
  8532. var $1;
  8533. $1=$self.position;
  8534. if($1 == null || $1.a$nil){
  8535. $self.position=(0);
  8536. return $self.position;
  8537. } else {
  8538. return $1;
  8539. }
  8540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8541. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8542. //>>excludeEnd("ctx");
  8543. }; }),
  8544. $globals.Stream);
  8545. $core.addMethod(
  8546. $core.method({
  8547. selector: "position:",
  8548. protocol: "accessing",
  8549. //>>excludeStart("ide", pragmas.excludeIdeData);
  8550. args: ["anInteger"],
  8551. source: "position: anInteger\x0a\x09position := anInteger",
  8552. referencedClasses: [],
  8553. //>>excludeEnd("ide");
  8554. pragmas: [],
  8555. messageSends: []
  8556. }, function ($methodClass){ return function (anInteger){
  8557. var self=this,$self=this;
  8558. $self.position=anInteger;
  8559. return self;
  8560. }; }),
  8561. $globals.Stream);
  8562. $core.addMethod(
  8563. $core.method({
  8564. selector: "reset",
  8565. protocol: "actions",
  8566. //>>excludeStart("ide", pragmas.excludeIdeData);
  8567. args: [],
  8568. source: "reset\x0a\x09self position: 0",
  8569. referencedClasses: [],
  8570. //>>excludeEnd("ide");
  8571. pragmas: [],
  8572. messageSends: ["position:"]
  8573. }, function ($methodClass){ return function (){
  8574. var self=this,$self=this;
  8575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8576. return $core.withContext(function($ctx1) {
  8577. //>>excludeEnd("ctx");
  8578. $self._position_((0));
  8579. return self;
  8580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8581. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8582. //>>excludeEnd("ctx");
  8583. }; }),
  8584. $globals.Stream);
  8585. $core.addMethod(
  8586. $core.method({
  8587. selector: "resetContents",
  8588. protocol: "actions",
  8589. //>>excludeStart("ide", pragmas.excludeIdeData);
  8590. args: [],
  8591. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8592. referencedClasses: [],
  8593. //>>excludeEnd("ide");
  8594. pragmas: [],
  8595. messageSends: ["reset", "setStreamSize:"]
  8596. }, function ($methodClass){ return function (){
  8597. var self=this,$self=this;
  8598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8599. return $core.withContext(function($ctx1) {
  8600. //>>excludeEnd("ctx");
  8601. $self._reset();
  8602. $self._setStreamSize_((0));
  8603. return self;
  8604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8605. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8606. //>>excludeEnd("ctx");
  8607. }; }),
  8608. $globals.Stream);
  8609. $core.addMethod(
  8610. $core.method({
  8611. selector: "setCollection:",
  8612. protocol: "accessing",
  8613. //>>excludeStart("ide", pragmas.excludeIdeData);
  8614. args: ["aCollection"],
  8615. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8616. referencedClasses: [],
  8617. //>>excludeEnd("ide");
  8618. pragmas: [],
  8619. messageSends: []
  8620. }, function ($methodClass){ return function (aCollection){
  8621. var self=this,$self=this;
  8622. $self.collection=aCollection;
  8623. return self;
  8624. }; }),
  8625. $globals.Stream);
  8626. $core.addMethod(
  8627. $core.method({
  8628. selector: "setStreamSize:",
  8629. protocol: "accessing",
  8630. //>>excludeStart("ide", pragmas.excludeIdeData);
  8631. args: ["anInteger"],
  8632. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8633. referencedClasses: [],
  8634. //>>excludeEnd("ide");
  8635. pragmas: [],
  8636. messageSends: []
  8637. }, function ($methodClass){ return function (anInteger){
  8638. var self=this,$self=this;
  8639. $self.streamSize=anInteger;
  8640. return self;
  8641. }; }),
  8642. $globals.Stream);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "setToEnd",
  8646. protocol: "positioning",
  8647. //>>excludeStart("ide", pragmas.excludeIdeData);
  8648. args: [],
  8649. source: "setToEnd\x0a\x09self position: self size",
  8650. referencedClasses: [],
  8651. //>>excludeEnd("ide");
  8652. pragmas: [],
  8653. messageSends: ["position:", "size"]
  8654. }, function ($methodClass){ return function (){
  8655. var self=this,$self=this;
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. return $core.withContext(function($ctx1) {
  8658. //>>excludeEnd("ctx");
  8659. $self._position_($self._size());
  8660. return self;
  8661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8662. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8663. //>>excludeEnd("ctx");
  8664. }; }),
  8665. $globals.Stream);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "size",
  8669. protocol: "accessing",
  8670. //>>excludeStart("ide", pragmas.excludeIdeData);
  8671. args: [],
  8672. source: "size\x0a\x09^ self streamSize",
  8673. referencedClasses: [],
  8674. //>>excludeEnd("ide");
  8675. pragmas: [],
  8676. messageSends: ["streamSize"]
  8677. }, function ($methodClass){ return function (){
  8678. var self=this,$self=this;
  8679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8680. return $core.withContext(function($ctx1) {
  8681. //>>excludeEnd("ctx");
  8682. return $self._streamSize();
  8683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8684. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8685. //>>excludeEnd("ctx");
  8686. }; }),
  8687. $globals.Stream);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "skip:",
  8691. protocol: "positioning",
  8692. //>>excludeStart("ide", pragmas.excludeIdeData);
  8693. args: ["anInteger"],
  8694. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8695. referencedClasses: [],
  8696. //>>excludeEnd("ide");
  8697. pragmas: [],
  8698. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8699. }, function ($methodClass){ return function (anInteger){
  8700. var self=this,$self=this;
  8701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8702. return $core.withContext(function($ctx1) {
  8703. //>>excludeEnd("ctx");
  8704. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8705. return self;
  8706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8707. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8708. //>>excludeEnd("ctx");
  8709. }; }),
  8710. $globals.Stream);
  8711. $core.addMethod(
  8712. $core.method({
  8713. selector: "streamSize",
  8714. protocol: "accessing",
  8715. //>>excludeStart("ide", pragmas.excludeIdeData);
  8716. args: [],
  8717. source: "streamSize\x0a\x09^ streamSize",
  8718. referencedClasses: [],
  8719. //>>excludeEnd("ide");
  8720. pragmas: [],
  8721. messageSends: []
  8722. }, function ($methodClass){ return function (){
  8723. var self=this,$self=this;
  8724. return $self.streamSize;
  8725. }; }),
  8726. $globals.Stream);
  8727. $core.addMethod(
  8728. $core.method({
  8729. selector: "on:",
  8730. protocol: "instance creation",
  8731. //>>excludeStart("ide", pragmas.excludeIdeData);
  8732. args: ["aCollection"],
  8733. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8734. referencedClasses: [],
  8735. //>>excludeEnd("ide");
  8736. pragmas: [],
  8737. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8738. }, function ($methodClass){ return function (aCollection){
  8739. var self=this,$self=this;
  8740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8741. return $core.withContext(function($ctx1) {
  8742. //>>excludeEnd("ctx");
  8743. var $1;
  8744. $1=$self._new();
  8745. $recv($1)._setCollection_(aCollection);
  8746. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8747. return $recv($1)._yourself();
  8748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8749. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8750. //>>excludeEnd("ctx");
  8751. }; }),
  8752. $globals.Stream.a$cls);
  8753. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8754. //>>excludeStart("ide", pragmas.excludeIdeData);
  8755. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8756. //>>excludeEnd("ide");
  8757. $core.addMethod(
  8758. $core.method({
  8759. selector: "cr",
  8760. protocol: "writing",
  8761. //>>excludeStart("ide", pragmas.excludeIdeData);
  8762. args: [],
  8763. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8764. referencedClasses: ["String"],
  8765. //>>excludeEnd("ide");
  8766. pragmas: [],
  8767. messageSends: ["nextPutAll:", "cr"]
  8768. }, function ($methodClass){ return function (){
  8769. var self=this,$self=this;
  8770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8771. return $core.withContext(function($ctx1) {
  8772. //>>excludeEnd("ctx");
  8773. return $self._nextPutAll_($recv($globals.String)._cr());
  8774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8775. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8776. //>>excludeEnd("ctx");
  8777. }; }),
  8778. $globals.StringStream);
  8779. $core.addMethod(
  8780. $core.method({
  8781. selector: "crlf",
  8782. protocol: "writing",
  8783. //>>excludeStart("ide", pragmas.excludeIdeData);
  8784. args: [],
  8785. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8786. referencedClasses: ["String"],
  8787. //>>excludeEnd("ide");
  8788. pragmas: [],
  8789. messageSends: ["nextPutAll:", "crlf"]
  8790. }, function ($methodClass){ return function (){
  8791. var self=this,$self=this;
  8792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8793. return $core.withContext(function($ctx1) {
  8794. //>>excludeEnd("ctx");
  8795. return $self._nextPutAll_($recv($globals.String)._crlf());
  8796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8797. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8798. //>>excludeEnd("ctx");
  8799. }; }),
  8800. $globals.StringStream);
  8801. $core.addMethod(
  8802. $core.method({
  8803. selector: "lf",
  8804. protocol: "writing",
  8805. //>>excludeStart("ide", pragmas.excludeIdeData);
  8806. args: [],
  8807. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8808. referencedClasses: ["String"],
  8809. //>>excludeEnd("ide");
  8810. pragmas: [],
  8811. messageSends: ["nextPutAll:", "lf"]
  8812. }, function ($methodClass){ return function (){
  8813. var self=this,$self=this;
  8814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8815. return $core.withContext(function($ctx1) {
  8816. //>>excludeEnd("ctx");
  8817. return $self._nextPutAll_($recv($globals.String)._lf());
  8818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8819. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8820. //>>excludeEnd("ctx");
  8821. }; }),
  8822. $globals.StringStream);
  8823. $core.addMethod(
  8824. $core.method({
  8825. selector: "next:",
  8826. protocol: "reading",
  8827. //>>excludeStart("ide", pragmas.excludeIdeData);
  8828. args: ["anInteger"],
  8829. 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",
  8830. referencedClasses: [],
  8831. //>>excludeEnd("ide");
  8832. pragmas: [],
  8833. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8834. }, function ($methodClass){ return function (anInteger){
  8835. var self=this,$self=this;
  8836. var tempCollection;
  8837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8838. return $core.withContext(function($ctx1) {
  8839. //>>excludeEnd("ctx");
  8840. tempCollection=$recv($recv($self._collection())._class())._new();
  8841. $recv(anInteger)._timesRepeat_((function(){
  8842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8843. return $core.withContext(function($ctx2) {
  8844. //>>excludeEnd("ctx");
  8845. if(!$core.assert($self._atEnd())){
  8846. tempCollection=$recv(tempCollection).__comma($self._next());
  8847. return tempCollection;
  8848. }
  8849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8851. //>>excludeEnd("ctx");
  8852. }));
  8853. return tempCollection;
  8854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8855. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8856. //>>excludeEnd("ctx");
  8857. }; }),
  8858. $globals.StringStream);
  8859. $core.addMethod(
  8860. $core.method({
  8861. selector: "nextPut:",
  8862. protocol: "writing",
  8863. //>>excludeStart("ide", pragmas.excludeIdeData);
  8864. args: ["aString"],
  8865. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8866. referencedClasses: [],
  8867. //>>excludeEnd("ide");
  8868. pragmas: [],
  8869. messageSends: ["nextPutAll:"]
  8870. }, function ($methodClass){ return function (aString){
  8871. var self=this,$self=this;
  8872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8873. return $core.withContext(function($ctx1) {
  8874. //>>excludeEnd("ctx");
  8875. $self._nextPutAll_(aString);
  8876. return self;
  8877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8878. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8879. //>>excludeEnd("ctx");
  8880. }; }),
  8881. $globals.StringStream);
  8882. $core.addMethod(
  8883. $core.method({
  8884. selector: "nextPutAll:",
  8885. protocol: "writing",
  8886. //>>excludeStart("ide", pragmas.excludeIdeData);
  8887. args: ["aString"],
  8888. 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)",
  8889. referencedClasses: [],
  8890. //>>excludeEnd("ide");
  8891. pragmas: [],
  8892. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8893. }, function ($methodClass){ return function (aString){
  8894. var self=this,$self=this;
  8895. var pre,post;
  8896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8897. return $core.withContext(function($ctx1) {
  8898. //>>excludeEnd("ctx");
  8899. if($core.assert($recv([$self._position()
  8900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8901. ,$ctx1.sendIdx["position"]=1
  8902. //>>excludeEnd("ctx");
  8903. ][0]).__eq([$recv([$self._collection()
  8904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8905. ,$ctx1.sendIdx["collection"]=1
  8906. //>>excludeEnd("ctx");
  8907. ][0])._size()
  8908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8909. ,$ctx1.sendIdx["size"]=1
  8910. //>>excludeEnd("ctx");
  8911. ][0]))){
  8912. [$self._setCollection_([$recv([$self._collection()
  8913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8914. ,$ctx1.sendIdx["collection"]=2
  8915. //>>excludeEnd("ctx");
  8916. ][0]).__comma(aString)
  8917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8918. ,$ctx1.sendIdx[","]=1
  8919. //>>excludeEnd("ctx");
  8920. ][0])
  8921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8922. ,$ctx1.sendIdx["setCollection:"]=1
  8923. //>>excludeEnd("ctx");
  8924. ][0];
  8925. } else {
  8926. pre=[$recv([$self._collection()
  8927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8928. ,$ctx1.sendIdx["collection"]=3
  8929. //>>excludeEnd("ctx");
  8930. ][0])._copyFrom_to_((1),[$self._position()
  8931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8932. ,$ctx1.sendIdx["position"]=2
  8933. //>>excludeEnd("ctx");
  8934. ][0])
  8935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8936. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8937. //>>excludeEnd("ctx");
  8938. ][0];
  8939. post=$recv([$self._collection()
  8940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8941. ,$ctx1.sendIdx["collection"]=4
  8942. //>>excludeEnd("ctx");
  8943. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8945. ,$ctx1.sendIdx["position"]=3
  8946. //>>excludeEnd("ctx");
  8947. ][0]).__plus((1))
  8948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8949. ,$ctx1.sendIdx["+"]=2
  8950. //>>excludeEnd("ctx");
  8951. ][0]).__plus([$recv(aString)._size()
  8952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8953. ,$ctx1.sendIdx["size"]=2
  8954. //>>excludeEnd("ctx");
  8955. ][0])
  8956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8957. ,$ctx1.sendIdx["+"]=1
  8958. //>>excludeEnd("ctx");
  8959. ][0],[$recv($self._collection())._size()
  8960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8961. ,$ctx1.sendIdx["size"]=3
  8962. //>>excludeEnd("ctx");
  8963. ][0]);
  8964. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8966. ,$ctx1.sendIdx[","]=2
  8967. //>>excludeEnd("ctx");
  8968. ][0]);
  8969. }
  8970. $self._position_($recv([$self._position()
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. ,$ctx1.sendIdx["position"]=4
  8973. //>>excludeEnd("ctx");
  8974. ][0]).__plus($recv(aString)._size()));
  8975. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8976. return self;
  8977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8978. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8979. //>>excludeEnd("ctx");
  8980. }; }),
  8981. $globals.StringStream);
  8982. $core.addMethod(
  8983. $core.method({
  8984. selector: "nextPutString:",
  8985. protocol: "writing",
  8986. //>>excludeStart("ide", pragmas.excludeIdeData);
  8987. args: ["aString"],
  8988. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8989. referencedClasses: [],
  8990. //>>excludeEnd("ide");
  8991. pragmas: [],
  8992. messageSends: ["nextPutAll:"]
  8993. }, function ($methodClass){ return function (aString){
  8994. var self=this,$self=this;
  8995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8996. return $core.withContext(function($ctx1) {
  8997. //>>excludeEnd("ctx");
  8998. $self._nextPutAll_(aString);
  8999. return self;
  9000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9001. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  9002. //>>excludeEnd("ctx");
  9003. }; }),
  9004. $globals.StringStream);
  9005. $core.addMethod(
  9006. $core.method({
  9007. selector: "print:",
  9008. protocol: "writing",
  9009. //>>excludeStart("ide", pragmas.excludeIdeData);
  9010. args: ["anObject"],
  9011. source: "print: anObject\x0a\x09anObject printOn: self",
  9012. referencedClasses: [],
  9013. //>>excludeEnd("ide");
  9014. pragmas: [],
  9015. messageSends: ["printOn:"]
  9016. }, function ($methodClass){ return function (anObject){
  9017. var self=this,$self=this;
  9018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9019. return $core.withContext(function($ctx1) {
  9020. //>>excludeEnd("ctx");
  9021. $recv(anObject)._printOn_(self);
  9022. return self;
  9023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9024. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  9025. //>>excludeEnd("ctx");
  9026. }; }),
  9027. $globals.StringStream);
  9028. $core.addMethod(
  9029. $core.method({
  9030. selector: "printSymbol:",
  9031. protocol: "writing",
  9032. //>>excludeStart("ide", pragmas.excludeIdeData);
  9033. args: ["anObject"],
  9034. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9035. referencedClasses: [],
  9036. //>>excludeEnd("ide");
  9037. pragmas: [],
  9038. messageSends: ["asSymbolPrintOn:"]
  9039. }, function ($methodClass){ return function (anObject){
  9040. var self=this,$self=this;
  9041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9042. return $core.withContext(function($ctx1) {
  9043. //>>excludeEnd("ctx");
  9044. $recv(anObject)._asSymbolPrintOn_(self);
  9045. return self;
  9046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9047. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  9048. //>>excludeEnd("ctx");
  9049. }; }),
  9050. $globals.StringStream);
  9051. $core.addMethod(
  9052. $core.method({
  9053. selector: "space",
  9054. protocol: "writing",
  9055. //>>excludeStart("ide", pragmas.excludeIdeData);
  9056. args: [],
  9057. source: "space\x0a\x09self nextPut: ' '",
  9058. referencedClasses: [],
  9059. //>>excludeEnd("ide");
  9060. pragmas: [],
  9061. messageSends: ["nextPut:"]
  9062. }, function ($methodClass){ return function (){
  9063. var self=this,$self=this;
  9064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9065. return $core.withContext(function($ctx1) {
  9066. //>>excludeEnd("ctx");
  9067. $self._nextPut_(" ");
  9068. return self;
  9069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9070. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  9071. //>>excludeEnd("ctx");
  9072. }; }),
  9073. $globals.StringStream);
  9074. $core.addMethod(
  9075. $core.method({
  9076. selector: "tab",
  9077. protocol: "writing",
  9078. //>>excludeStart("ide", pragmas.excludeIdeData);
  9079. args: [],
  9080. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9081. referencedClasses: ["String"],
  9082. //>>excludeEnd("ide");
  9083. pragmas: [],
  9084. messageSends: ["nextPutAll:", "tab"]
  9085. }, function ($methodClass){ return function (){
  9086. var self=this,$self=this;
  9087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9088. return $core.withContext(function($ctx1) {
  9089. //>>excludeEnd("ctx");
  9090. return $self._nextPutAll_($recv($globals.String)._tab());
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9093. //>>excludeEnd("ctx");
  9094. }; }),
  9095. $globals.StringStream);
  9096. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9097. //>>excludeStart("ide", pragmas.excludeIdeData);
  9098. $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.";
  9099. //>>excludeEnd("ide");
  9100. $core.addMethod(
  9101. $core.method({
  9102. selector: "initialize",
  9103. protocol: "initialization",
  9104. //>>excludeStart("ide", pragmas.excludeIdeData);
  9105. args: [],
  9106. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9107. referencedClasses: ["OrderedCollection"],
  9108. //>>excludeEnd("ide");
  9109. pragmas: [],
  9110. messageSends: ["initialize", "new"]
  9111. }, function ($methodClass){ return function (){
  9112. var self=this,$self=this;
  9113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9114. return $core.withContext(function($ctx1) {
  9115. //>>excludeEnd("ctx");
  9116. [(
  9117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9118. $ctx1.supercall = true,
  9119. //>>excludeEnd("ctx");
  9120. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9122. ,$ctx1.supercall = false
  9123. //>>excludeEnd("ctx");
  9124. ][0];
  9125. $self.read=[$recv($globals.OrderedCollection)._new()
  9126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9127. ,$ctx1.sendIdx["new"]=1
  9128. //>>excludeEnd("ctx");
  9129. ][0];
  9130. $self.write=$recv($globals.OrderedCollection)._new();
  9131. $self.readIndex=(1);
  9132. return self;
  9133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9134. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9135. //>>excludeEnd("ctx");
  9136. }; }),
  9137. $globals.Queue);
  9138. $core.addMethod(
  9139. $core.method({
  9140. selector: "next",
  9141. protocol: "accessing",
  9142. //>>excludeStart("ide", pragmas.excludeIdeData);
  9143. args: [],
  9144. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9145. referencedClasses: [],
  9146. //>>excludeEnd("ide");
  9147. pragmas: [],
  9148. messageSends: ["nextIfAbsent:", "error:"]
  9149. }, function ($methodClass){ return function (){
  9150. var self=this,$self=this;
  9151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9152. return $core.withContext(function($ctx1) {
  9153. //>>excludeEnd("ctx");
  9154. return $self._nextIfAbsent_((function(){
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. return $core.withContext(function($ctx2) {
  9157. //>>excludeEnd("ctx");
  9158. return $self._error_("Cannot read from empty Queue.");
  9159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9161. //>>excludeEnd("ctx");
  9162. }));
  9163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9164. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9165. //>>excludeEnd("ctx");
  9166. }; }),
  9167. $globals.Queue);
  9168. $core.addMethod(
  9169. $core.method({
  9170. selector: "nextIfAbsent:",
  9171. protocol: "accessing",
  9172. //>>excludeStart("ide", pragmas.excludeIdeData);
  9173. args: ["aBlock"],
  9174. 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",
  9175. referencedClasses: ["OrderedCollection"],
  9176. //>>excludeEnd("ide");
  9177. pragmas: [],
  9178. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9179. }, function ($methodClass){ return function (aBlock){
  9180. var self=this,$self=this;
  9181. var result;
  9182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9183. return $core.withContext(function($ctx1) {
  9184. //>>excludeEnd("ctx");
  9185. var $early={};
  9186. try {
  9187. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9189. return $core.withContext(function($ctx2) {
  9190. //>>excludeEnd("ctx");
  9191. $recv($self.write)._ifEmpty_((function(){
  9192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9193. return $core.withContext(function($ctx3) {
  9194. //>>excludeEnd("ctx");
  9195. if($core.assert($recv($self.readIndex).__gt((1)))){
  9196. $self.read=[];
  9197. $self.readIndex=(1);
  9198. $self.readIndex;
  9199. }
  9200. throw $early=[$recv(aBlock)._value()];
  9201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9202. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9203. //>>excludeEnd("ctx");
  9204. }));
  9205. $self.read=$self.write;
  9206. $self.readIndex=(1);
  9207. $self.write=$recv($globals.OrderedCollection)._new();
  9208. return $recv($self.read)._first();
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9211. //>>excludeEnd("ctx");
  9212. }));
  9213. $recv($self.read)._at_put_($self.readIndex,nil);
  9214. $self.readIndex=$recv($self.readIndex).__plus((1));
  9215. return result;
  9216. }
  9217. catch(e) {if(e===$early)return e[0]; throw e}
  9218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9219. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9220. //>>excludeEnd("ctx");
  9221. }; }),
  9222. $globals.Queue);
  9223. $core.addMethod(
  9224. $core.method({
  9225. selector: "nextPut:",
  9226. protocol: "accessing",
  9227. //>>excludeStart("ide", pragmas.excludeIdeData);
  9228. args: ["anObject"],
  9229. source: "nextPut: anObject\x0a\x09write add: anObject",
  9230. referencedClasses: [],
  9231. //>>excludeEnd("ide");
  9232. pragmas: [],
  9233. messageSends: ["add:"]
  9234. }, function ($methodClass){ return function (anObject){
  9235. var self=this,$self=this;
  9236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9237. return $core.withContext(function($ctx1) {
  9238. //>>excludeEnd("ctx");
  9239. $recv($self.write)._add_(anObject);
  9240. return self;
  9241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9242. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9243. //>>excludeEnd("ctx");
  9244. }; }),
  9245. $globals.Queue);
  9246. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9247. //>>excludeStart("ide", pragmas.excludeIdeData);
  9248. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9249. //>>excludeEnd("ide");
  9250. $core.addMethod(
  9251. $core.method({
  9252. selector: "compile:",
  9253. protocol: "evaluating",
  9254. //>>excludeStart("ide", pragmas.excludeIdeData);
  9255. args: ["aString"],
  9256. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9257. referencedClasses: [],
  9258. //>>excludeEnd("ide");
  9259. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9260. messageSends: []
  9261. }, function ($methodClass){ return function (aString){
  9262. var self=this,$self=this;
  9263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9264. return $core.withContext(function($ctx1) {
  9265. //>>excludeEnd("ctx");
  9266. return self.compile(aString);
  9267. return self;
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9270. //>>excludeEnd("ctx");
  9271. }; }),
  9272. $globals.RegularExpression);
  9273. $core.addMethod(
  9274. $core.method({
  9275. selector: "exec:",
  9276. protocol: "evaluating",
  9277. //>>excludeStart("ide", pragmas.excludeIdeData);
  9278. args: ["aString"],
  9279. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9280. referencedClasses: [],
  9281. //>>excludeEnd("ide");
  9282. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9283. messageSends: []
  9284. }, function ($methodClass){ return function (aString){
  9285. var self=this,$self=this;
  9286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9287. return $core.withContext(function($ctx1) {
  9288. //>>excludeEnd("ctx");
  9289. return self.exec(aString) || nil;
  9290. return self;
  9291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9292. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9293. //>>excludeEnd("ctx");
  9294. }; }),
  9295. $globals.RegularExpression);
  9296. $core.addMethod(
  9297. $core.method({
  9298. selector: "test:",
  9299. protocol: "evaluating",
  9300. //>>excludeStart("ide", pragmas.excludeIdeData);
  9301. args: ["aString"],
  9302. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9303. referencedClasses: [],
  9304. //>>excludeEnd("ide");
  9305. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9306. messageSends: []
  9307. }, function ($methodClass){ return function (aString){
  9308. var self=this,$self=this;
  9309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9310. return $core.withContext(function($ctx1) {
  9311. //>>excludeEnd("ctx");
  9312. return self.test(aString);
  9313. return self;
  9314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9315. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9316. //>>excludeEnd("ctx");
  9317. }; }),
  9318. $globals.RegularExpression);
  9319. $core.addMethod(
  9320. $core.method({
  9321. selector: "fromString:",
  9322. protocol: "instance creation",
  9323. //>>excludeStart("ide", pragmas.excludeIdeData);
  9324. args: ["aString"],
  9325. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9326. referencedClasses: [],
  9327. //>>excludeEnd("ide");
  9328. pragmas: [],
  9329. messageSends: ["fromString:flag:"]
  9330. }, function ($methodClass){ return function (aString){
  9331. var self=this,$self=this;
  9332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9333. return $core.withContext(function($ctx1) {
  9334. //>>excludeEnd("ctx");
  9335. return $self._fromString_flag_(aString,"");
  9336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9337. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9338. //>>excludeEnd("ctx");
  9339. }; }),
  9340. $globals.RegularExpression.a$cls);
  9341. $core.addMethod(
  9342. $core.method({
  9343. selector: "fromString:flag:",
  9344. protocol: "instance creation",
  9345. //>>excludeStart("ide", pragmas.excludeIdeData);
  9346. args: ["aString", "anotherString"],
  9347. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9348. referencedClasses: [],
  9349. //>>excludeEnd("ide");
  9350. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9351. messageSends: []
  9352. }, function ($methodClass){ return function (aString,anotherString){
  9353. var self=this,$self=this;
  9354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9355. return $core.withContext(function($ctx1) {
  9356. //>>excludeEnd("ctx");
  9357. return new RegExp(aString, anotherString);
  9358. return self;
  9359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9360. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9361. //>>excludeEnd("ctx");
  9362. }; }),
  9363. $globals.RegularExpression.a$cls);
  9364. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9365. $core.addMethod(
  9366. $core.method({
  9367. selector: "at:",
  9368. protocol: "accessing",
  9369. //>>excludeStart("ide", pragmas.excludeIdeData);
  9370. args: ["anIndex"],
  9371. 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 ]",
  9372. referencedClasses: [],
  9373. //>>excludeEnd("ide");
  9374. pragmas: [],
  9375. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9376. }, function ($methodClass){ return function (anIndex){
  9377. var self=this,$self=this;
  9378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9379. return $core.withContext(function($ctx1) {
  9380. //>>excludeEnd("ctx");
  9381. return $self._at_ifAbsent_(anIndex,(function(){
  9382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9383. return $core.withContext(function($ctx2) {
  9384. //>>excludeEnd("ctx");
  9385. return $self._errorNotFound();
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9388. //>>excludeEnd("ctx");
  9389. }));
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9392. //>>excludeEnd("ctx");
  9393. }; }),
  9394. $globals.TKeyValueCollection);
  9395. $core.addMethod(
  9396. $core.method({
  9397. selector: "at:ifAbsent:",
  9398. protocol: "accessing",
  9399. //>>excludeStart("ide", pragmas.excludeIdeData);
  9400. args: ["anIndex", "aBlock"],
  9401. 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",
  9402. referencedClasses: [],
  9403. //>>excludeEnd("ide");
  9404. pragmas: [],
  9405. messageSends: ["subclassResponsibility"]
  9406. }, function ($methodClass){ return function (anIndex,aBlock){
  9407. var self=this,$self=this;
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. return $core.withContext(function($ctx1) {
  9410. //>>excludeEnd("ctx");
  9411. $self._subclassResponsibility();
  9412. return self;
  9413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9414. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9415. //>>excludeEnd("ctx");
  9416. }; }),
  9417. $globals.TKeyValueCollection);
  9418. $core.addMethod(
  9419. $core.method({
  9420. selector: "at:ifAbsentPut:",
  9421. protocol: "accessing",
  9422. //>>excludeStart("ide", pragmas.excludeIdeData);
  9423. args: ["aKey", "aBlock"],
  9424. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9425. referencedClasses: [],
  9426. //>>excludeEnd("ide");
  9427. pragmas: [],
  9428. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9429. }, function ($methodClass){ return function (aKey,aBlock){
  9430. var self=this,$self=this;
  9431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9432. return $core.withContext(function($ctx1) {
  9433. //>>excludeEnd("ctx");
  9434. return $self._at_ifAbsent_(aKey,(function(){
  9435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9436. return $core.withContext(function($ctx2) {
  9437. //>>excludeEnd("ctx");
  9438. return $self._at_put_(aKey,$recv(aBlock)._value());
  9439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9441. //>>excludeEnd("ctx");
  9442. }));
  9443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9444. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9445. //>>excludeEnd("ctx");
  9446. }; }),
  9447. $globals.TKeyValueCollection);
  9448. $core.addMethod(
  9449. $core.method({
  9450. selector: "at:ifPresent:",
  9451. protocol: "accessing",
  9452. //>>excludeStart("ide", pragmas.excludeIdeData);
  9453. args: ["anIndex", "aBlock"],
  9454. 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 ]",
  9455. referencedClasses: [],
  9456. //>>excludeEnd("ide");
  9457. pragmas: [],
  9458. messageSends: ["at:ifPresent:ifAbsent:"]
  9459. }, function ($methodClass){ return function (anIndex,aBlock){
  9460. var self=this,$self=this;
  9461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9462. return $core.withContext(function($ctx1) {
  9463. //>>excludeEnd("ctx");
  9464. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9465. return nil;
  9466. }));
  9467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9468. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9469. //>>excludeEnd("ctx");
  9470. }; }),
  9471. $globals.TKeyValueCollection);
  9472. $core.addMethod(
  9473. $core.method({
  9474. selector: "at:ifPresent:ifAbsent:",
  9475. protocol: "accessing",
  9476. //>>excludeStart("ide", pragmas.excludeIdeData);
  9477. args: ["anIndex", "aBlock", "anotherBlock"],
  9478. 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",
  9479. referencedClasses: [],
  9480. //>>excludeEnd("ide");
  9481. pragmas: [],
  9482. messageSends: ["subclassResponsibility"]
  9483. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9484. var self=this,$self=this;
  9485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9486. return $core.withContext(function($ctx1) {
  9487. //>>excludeEnd("ctx");
  9488. $self._subclassResponsibility();
  9489. return self;
  9490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9491. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9492. //>>excludeEnd("ctx");
  9493. }; }),
  9494. $globals.TKeyValueCollection);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "at:put:",
  9498. protocol: "accessing",
  9499. //>>excludeStart("ide", pragmas.excludeIdeData);
  9500. args: ["anIndex", "anObject"],
  9501. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9502. referencedClasses: [],
  9503. //>>excludeEnd("ide");
  9504. pragmas: [],
  9505. messageSends: ["subclassResponsibility"]
  9506. }, function ($methodClass){ return function (anIndex,anObject){
  9507. var self=this,$self=this;
  9508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9509. return $core.withContext(function($ctx1) {
  9510. //>>excludeEnd("ctx");
  9511. $self._subclassResponsibility();
  9512. return self;
  9513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9514. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9515. //>>excludeEnd("ctx");
  9516. }; }),
  9517. $globals.TKeyValueCollection);
  9518. $core.addMethod(
  9519. $core.method({
  9520. selector: "indexOf:",
  9521. protocol: "accessing",
  9522. //>>excludeStart("ide", pragmas.excludeIdeData);
  9523. args: ["anObject"],
  9524. 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 ]",
  9525. referencedClasses: [],
  9526. //>>excludeEnd("ide");
  9527. pragmas: [],
  9528. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9529. }, function ($methodClass){ return function (anObject){
  9530. var self=this,$self=this;
  9531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9532. return $core.withContext(function($ctx1) {
  9533. //>>excludeEnd("ctx");
  9534. return $self._indexOf_ifAbsent_(anObject,(function(){
  9535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9536. return $core.withContext(function($ctx2) {
  9537. //>>excludeEnd("ctx");
  9538. return $self._errorNotFound();
  9539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9541. //>>excludeEnd("ctx");
  9542. }));
  9543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9544. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9545. //>>excludeEnd("ctx");
  9546. }; }),
  9547. $globals.TKeyValueCollection);
  9548. $core.addMethod(
  9549. $core.method({
  9550. selector: "indexOf:ifAbsent:",
  9551. protocol: "accessing",
  9552. //>>excludeStart("ide", pragmas.excludeIdeData);
  9553. args: ["anObject", "aBlock"],
  9554. 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",
  9555. referencedClasses: [],
  9556. //>>excludeEnd("ide");
  9557. pragmas: [],
  9558. messageSends: ["subclassResponsibility"]
  9559. }, function ($methodClass){ return function (anObject,aBlock){
  9560. var self=this,$self=this;
  9561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9562. return $core.withContext(function($ctx1) {
  9563. //>>excludeEnd("ctx");
  9564. $self._subclassResponsibility();
  9565. return self;
  9566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9567. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9568. //>>excludeEnd("ctx");
  9569. }; }),
  9570. $globals.TKeyValueCollection);
  9571. $core.addMethod(
  9572. $core.method({
  9573. selector: "with:do:",
  9574. protocol: "enumerating",
  9575. //>>excludeStart("ide", pragmas.excludeIdeData);
  9576. args: ["anotherCollection", "aBlock"],
  9577. 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) ]",
  9578. referencedClasses: [],
  9579. //>>excludeEnd("ide");
  9580. pragmas: [],
  9581. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9582. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9583. var self=this,$self=this;
  9584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9585. return $core.withContext(function($ctx1) {
  9586. //>>excludeEnd("ctx");
  9587. $self._withIndexDo_((function(each,index){
  9588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9589. return $core.withContext(function($ctx2) {
  9590. //>>excludeEnd("ctx");
  9591. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9593. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9594. //>>excludeEnd("ctx");
  9595. }));
  9596. return self;
  9597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9598. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9599. //>>excludeEnd("ctx");
  9600. }; }),
  9601. $globals.TKeyValueCollection);
  9602. $core.addMethod(
  9603. $core.method({
  9604. selector: "withIndexDo:",
  9605. protocol: "enumerating",
  9606. //>>excludeStart("ide", pragmas.excludeIdeData);
  9607. args: ["aBlock"],
  9608. 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",
  9609. referencedClasses: [],
  9610. //>>excludeEnd("ide");
  9611. pragmas: [],
  9612. messageSends: ["subclassResponsibility"]
  9613. }, function ($methodClass){ return function (aBlock){
  9614. var self=this,$self=this;
  9615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9616. return $core.withContext(function($ctx1) {
  9617. //>>excludeEnd("ctx");
  9618. $self._subclassResponsibility();
  9619. return self;
  9620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9621. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9622. //>>excludeEnd("ctx");
  9623. }; }),
  9624. $globals.TKeyValueCollection);
  9625. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9626. $core.addMethod(
  9627. $core.method({
  9628. selector: "at:ifAbsent:",
  9629. protocol: "accessing",
  9630. //>>excludeStart("ide", pragmas.excludeIdeData);
  9631. args: ["anIndex", "aBlock"],
  9632. 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'>",
  9633. referencedClasses: [],
  9634. //>>excludeEnd("ide");
  9635. 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"]]],
  9636. messageSends: []
  9637. }, function ($methodClass){ return function (anIndex,aBlock){
  9638. var self=this,$self=this;
  9639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9640. return $core.withContext(function($ctx1) {
  9641. //>>excludeEnd("ctx");
  9642. return anIndex >= 1 && anIndex <= self.length
  9643. ? self[anIndex - 1]
  9644. : aBlock._value()
  9645. ;
  9646. return self;
  9647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9648. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9649. //>>excludeEnd("ctx");
  9650. }; }),
  9651. $globals.TNativeZeroBasedCollection);
  9652. $core.addMethod(
  9653. $core.method({
  9654. selector: "at:ifPresent:ifAbsent:",
  9655. protocol: "accessing",
  9656. //>>excludeStart("ide", pragmas.excludeIdeData);
  9657. args: ["anIndex", "aBlock", "anotherBlock"],
  9658. 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'>",
  9659. referencedClasses: [],
  9660. //>>excludeEnd("ide");
  9661. 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"]]],
  9662. messageSends: []
  9663. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9664. var self=this,$self=this;
  9665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9666. return $core.withContext(function($ctx1) {
  9667. //>>excludeEnd("ctx");
  9668. return anIndex >= 1 && anIndex <= self.length
  9669. ? aBlock._value_(self[anIndex - 1])
  9670. : anotherBlock._value()
  9671. ;
  9672. return self;
  9673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9674. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9675. //>>excludeEnd("ctx");
  9676. }; }),
  9677. $globals.TNativeZeroBasedCollection);
  9678. $core.addMethod(
  9679. $core.method({
  9680. selector: "detect:ifNone:",
  9681. protocol: "enumerating",
  9682. //>>excludeStart("ide", pragmas.excludeIdeData);
  9683. args: ["aBlock", "anotherBlock"],
  9684. 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'>",
  9685. referencedClasses: [],
  9686. //>>excludeEnd("ide");
  9687. 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"]]],
  9688. messageSends: []
  9689. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9690. var self=this,$self=this;
  9691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9692. return $core.withContext(function($ctx1) {
  9693. //>>excludeEnd("ctx");
  9694. for(var i = 0; i < self.length; i++)
  9695. if(aBlock._value_(self[i]))
  9696. return self[i];
  9697. return anotherBlock._value();
  9698. ;
  9699. return self;
  9700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9701. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9702. //>>excludeEnd("ctx");
  9703. }; }),
  9704. $globals.TNativeZeroBasedCollection);
  9705. $core.addMethod(
  9706. $core.method({
  9707. selector: "do:",
  9708. protocol: "enumerating",
  9709. //>>excludeStart("ide", pragmas.excludeIdeData);
  9710. args: ["aBlock"],
  9711. 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'>",
  9712. referencedClasses: [],
  9713. //>>excludeEnd("ide");
  9714. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9715. messageSends: []
  9716. }, function ($methodClass){ return function (aBlock){
  9717. var self=this,$self=this;
  9718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9719. return $core.withContext(function($ctx1) {
  9720. //>>excludeEnd("ctx");
  9721. for(var i=0; i < self.length; i++) {
  9722. aBlock._value_(self[i]);
  9723. }
  9724. ;
  9725. return self;
  9726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9727. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9728. //>>excludeEnd("ctx");
  9729. }; }),
  9730. $globals.TNativeZeroBasedCollection);
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "indexOf:ifAbsent:",
  9734. protocol: "accessing",
  9735. //>>excludeStart("ide", pragmas.excludeIdeData);
  9736. args: ["anObject", "aBlock"],
  9737. 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'>",
  9738. referencedClasses: [],
  9739. //>>excludeEnd("ide");
  9740. 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"]]],
  9741. messageSends: []
  9742. }, function ($methodClass){ return function (anObject,aBlock){
  9743. var self=this,$self=this;
  9744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9745. return $core.withContext(function($ctx1) {
  9746. //>>excludeEnd("ctx");
  9747. for(var i=0; i < self.length; i++) {
  9748. if($recv(self[i]).__eq(anObject)) {return i+1}
  9749. };
  9750. return aBlock._value();
  9751. ;
  9752. return self;
  9753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9754. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9755. //>>excludeEnd("ctx");
  9756. }; }),
  9757. $globals.TNativeZeroBasedCollection);
  9758. $core.addMethod(
  9759. $core.method({
  9760. selector: "indexOf:startingAt:ifAbsent:",
  9761. protocol: "accessing",
  9762. //>>excludeStart("ide", pragmas.excludeIdeData);
  9763. args: ["anObject", "start", "aBlock"],
  9764. 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'>",
  9765. referencedClasses: [],
  9766. //>>excludeEnd("ide");
  9767. 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"]]],
  9768. messageSends: []
  9769. }, function ($methodClass){ return function (anObject,start,aBlock){
  9770. var self=this,$self=this;
  9771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9772. return $core.withContext(function($ctx1) {
  9773. //>>excludeEnd("ctx");
  9774. for(var i=start - 1; i < self.length; i++){
  9775. if($recv(self[i]).__eq(anObject)) {return i+1}
  9776. }
  9777. return aBlock._value();
  9778. ;
  9779. return self;
  9780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9781. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9782. //>>excludeEnd("ctx");
  9783. }; }),
  9784. $globals.TNativeZeroBasedCollection);
  9785. $core.addMethod(
  9786. $core.method({
  9787. selector: "single",
  9788. protocol: "accessing",
  9789. //>>excludeStart("ide", pragmas.excludeIdeData);
  9790. args: [],
  9791. 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'>",
  9792. referencedClasses: [],
  9793. //>>excludeEnd("ide");
  9794. 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];"]]],
  9795. messageSends: []
  9796. }, function ($methodClass){ return function (){
  9797. var self=this,$self=this;
  9798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9799. return $core.withContext(function($ctx1) {
  9800. //>>excludeEnd("ctx");
  9801. if (self.length == 0) throw new Error("Collection is empty");
  9802. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9803. return self[0];;
  9804. return self;
  9805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9806. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9807. //>>excludeEnd("ctx");
  9808. }; }),
  9809. $globals.TNativeZeroBasedCollection);
  9810. $core.addMethod(
  9811. $core.method({
  9812. selector: "size",
  9813. protocol: "accessing",
  9814. //>>excludeStart("ide", pragmas.excludeIdeData);
  9815. args: [],
  9816. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9817. referencedClasses: [],
  9818. //>>excludeEnd("ide");
  9819. pragmas: [["inlineJS:", ["return self.length"]]],
  9820. messageSends: []
  9821. }, function ($methodClass){ return function (){
  9822. var self=this,$self=this;
  9823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9824. return $core.withContext(function($ctx1) {
  9825. //>>excludeEnd("ctx");
  9826. return self.length;
  9827. return self;
  9828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9829. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9830. //>>excludeEnd("ctx");
  9831. }; }),
  9832. $globals.TNativeZeroBasedCollection);
  9833. $core.addMethod(
  9834. $core.method({
  9835. selector: "with:do:",
  9836. protocol: "enumerating",
  9837. //>>excludeStart("ide", pragmas.excludeIdeData);
  9838. args: ["anotherCollection", "aBlock"],
  9839. 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'>",
  9840. referencedClasses: [],
  9841. //>>excludeEnd("ide");
  9842. 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"]]],
  9843. messageSends: []
  9844. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9845. var self=this,$self=this;
  9846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9847. return $core.withContext(function($ctx1) {
  9848. //>>excludeEnd("ctx");
  9849. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9850. for(var i=0; i<self.length; i++) {
  9851. aBlock._value_value_(self[i], anotherCollection[i]);
  9852. }
  9853. ;
  9854. return self;
  9855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9856. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9857. //>>excludeEnd("ctx");
  9858. }; }),
  9859. $globals.TNativeZeroBasedCollection);
  9860. $core.addMethod(
  9861. $core.method({
  9862. selector: "withIndexDo:",
  9863. protocol: "enumerating",
  9864. //>>excludeStart("ide", pragmas.excludeIdeData);
  9865. args: ["aBlock"],
  9866. 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'>",
  9867. referencedClasses: [],
  9868. //>>excludeEnd("ide");
  9869. 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"]]],
  9870. messageSends: []
  9871. }, function ($methodClass){ return function (aBlock){
  9872. var self=this,$self=this;
  9873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9874. return $core.withContext(function($ctx1) {
  9875. //>>excludeEnd("ctx");
  9876. for(var i=0; i < self.length; i++) {
  9877. aBlock._value_value_(self[i], i+1);
  9878. }
  9879. ;
  9880. return self;
  9881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9882. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9883. //>>excludeEnd("ctx");
  9884. }; }),
  9885. $globals.TNativeZeroBasedCollection);
  9886. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9887. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9888. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9889. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9890. });